Delete the hook that commit 9fcf8c898d added
to persp-created-functions, and change spacemacs/ivy-spacemacs-layouts,
spacemacs/helm-perspectives, spacemacs/helm-persp-switch-project, and
spacemacs/ivy-persp-switch-project to achieve the intended goal of adding
the desired buffers after creating a new perspective.
Change spacemacs/helm-persp-switch-project and
spacemacs/ivy-persp-switch-project as follows: If the user selects a
project but then quits without selecting a file or buffer, the new
perspective is now immediately killed. Otherwise, if the perspective did
not already exist, any buffers that belong to the selected project are
added to the perspective.
Add the following actions to spacemacs/ivy-spacemacs-layouts and
spacemacs/helm-perspectives:
* Create a new perspective with the Spacemacs home buffer (default action).
* Create a new perspective with the buffers that belong to the current
buffer's project.
* Create a new perspective with the buffers that belong to the current
perspective (i.e., make a copy of the current perspective).
This commit resolves the problem reported in
9fcf8c898d (commitcomment-33343455).
This commit also fixes a problem with the default action for
spacemacs/ivy-spacemacs-layouts and spacemacs/helm-perspectives. According to
commit 7b931a9f5b, the default action is supposed
to display the home buffer if the action creates a new perspective, which was
determined by checking whether the perspective was missing from the list of
perspectives _before_ switching. However, commit
eb7ca651fe changed this logic so it was checking
whether the perspective was missing from the list of perspectives _after_
switching. This commit restores the correct logic.
* CHANGELOG.develop: Update.
* layers/+completion/ivy/funcs.el (spacemacs/ivy-spacemacs-layouts): Add
"Copy Current Layout" and "Create Project Layout" actions to the docstring.
Use spacemacs//create-persp-with-home-buffer for the default action.
* layers/+completion/ivy/packages.el (ivy/post-init-persp-mode): Add
actions for spacemacs//create-persp-with-current-project-buffers and
persp-copy.
* layers/+spacemacs/spacemacs-layouts/funcs.el
(spacemacs||switch-layout): New macro. Switch to the named perspective,
and initialize it using the provided forms if the perspective is new.
(spacemacs//create-persp-with-current-project-buffers): New function.
Create a new perspective with the current project's buffers.
(spacemacs||switch-project-persp): New macro. Switch to the named
perspective, and evaluate the provided forms with
projectile-after-switch-project-hook bound with a hook that adds the
current project's buffers to the perspective. If the user quits during the
evaluation of the forms, kill the perspective.
(spacemacs//create-persp-with-home-buffer): New function. Switch to the
named perspective, and go to the Spacemacs home buffer if the perspective
is new.
(spacemacs/helm-perspectives): Use spacemacs//create-persp-with-home-buffer
for the default action. Add actions for
spacemacs//create-persp-with-current-project-buffers and persp-copy.
(spacemacs//helm-persp-switch-project-action): New function. Switch to the
named perspective and call projectile-switch-project-by-name, using the new
spacemacs||switch-project-persp macro. Bind helm-quit-hook with a hook
that kills the new perspective if the user quits
projectile-switch-project-by-name.
(spacemacs/helm-persp-switch-project): Use
spacemacs//helm-persp-switch-project-action.
(spacemacs//ivy-persp-switch-project-action): New function. Switch to the
named perspective and call counsel-projectile-switch-project-action with a
hook to add the project's buffers to the new perspective.
(spacemacs/ivy-persp-switch-project): Delete advice for
counsel-projectile-switch-project-action. Use
spacemacs//ivy-persp-switch-project-action instead.
(spacemacs//add-project-buffers-to-persp): Deleted.
* layers/+spacemacs/spacemacs-layouts/packages.el
(spacemacs-layouts/init-persp-mode): Don't add a hook to
persp-created-functions.
global-hl-todo-mode uses function to activate only for modes that are in the
activate list but are not org-mode.
Reference: 24b9925b1b/hl-todo.el (L185-L188)
Adds a comment re `hl-todo-activate-in-modes` var
Two `SPC h SPC` toggles were missing their documentation:
- Nameless
- Minibuffer System Monitor (the symon package)
Now they match the other entries by showing:
- current state
- name (this was only shown before)
- documentation
- key binding (only minibuffer-system-monitor shows a key binding)
The nameless key binding `SPC m T n` only works in emacs-lisp-mode. It's key
binding might need to be described another way.
Defines a transient state for symbol-overlay, and bind it to ~SPC s o~ and ~SPC s O~.
Updates:
* update due to the signature change of `symbol-overlay-get-list`.
* align the docstring using `^^` and add `quit` button.
I have introduced a bug by merging
efa04de617.
This change removes the symptom with the
cost of again violating the 80 chars limit
in spacemacs-editing-visual's packages.el.
Fix issue #11282.
When a new perspective (layout) is created and we are in a Projectile
project, add all buffers belonging to that project to the perspective.
* layers/+spacemacs/spacemacs-layouts/funcs.el
(spacemacs//add-project-buffers-to-persp): Add new function.
* layers/+spacemacs/spacemacs-layouts/packages.el
(spacemacs-layouts/init-persp-mode): Add
spacemacs//add-project-buffers-to-persp to persp-created-functions.
Window sizing and layouts can be affected by a large transient state hint,
so having a option for minified hint is especially useful here.
Also reformats the full hint to place `golden ratio` under the "Resize" heading,
reducing overall height by one row.
Fixes helm not being loaded before calls to:
read-file-name and completing-read.
These are some commands that call either of those two functions:
spacemacs/rename-current-buffer-file (SPC f R)
In a Treemacs window:
treemacs-add-project-to-workspace (C-c C-p a)
In a Magit buffer:
magit-checkout (b b)
Thanks Miciah for a more elegant solution.
This commit also reverts:
Fix helm loading for layouts transient state #11705
because it's not needed anymore.
And the previously commented out transient hook minibuffer-setup-hook (it
doesn't seem to ever have been used) is removed because:
- It loads helm after a command is called that uses helm (instead of before)
- (spacemacs|hide-lighter helm-mode) has previously been moved to the
helm/init-helm :config section.
Moved:
- ("ai" "irc") to both the `erc` and `rcirc` layers. They don't have to be
renamed until the layers are loaded.
- ("ay" "ipython notebook") to the `ipython-notebook` layer.
- ("p$" "projects/shell")
("'" "open shell")
("as" "shells")
to the `shell` layer.
- The commands with keybindings from spacemacs-bootstrap/packages.el to
spacemacs-defaults/keybindings.el.
Removed:
- ("gd" "diff") it seems to be an old group name, there's no `SPC g d` group at
the moment.
- ("Re" "elisp") and ("Rp" "pcre") because they have moved to:
("xr" "regular expressions")
("xre" "elisp")
("xrp" "pcre")
- ("xm" "move") seems to be an old move text group, the current keybindings are
`SPC x J` and `SPC x K` which opens the Move Text Transient State.
- ("b" "persp-buffers") because `SPC b` is also renamed as ("b" "buffers") which
is more general and not persp-mode specific.
problems:
the delete file prompt doesn't show which file it's about to delete,
and when the deletion request is canceled, then the question remains in the
minibuffer (the text disappears when an action updates the minibuffer, like
moving the cursor, but it might be confusing to still be seeing the question
after it's been answered)
solution:
show the file name in the delete file prompt, and show a canceled message
By analogy with the "zz", "zb", "zt" vim / evil bindings, this adds an
additional key binding "z" for `recenter-top-bottom` to the following
transient states which navigate around the buffer in large jumps:
- auto-symbol-highlight
- error
- buffer
- vcs
- org-babel
This allows for repositioning of the buffer for visibility without having to
exit the transient state.
Minor updates are also made to documentation of other transient states.
1. Fix `short-name` for directories. Previously it was empty string.
2. Remove redundant check for existing buffer:
1. `(get-buffer new-name)` always return `nil`, because `new-name` is a path
to file, not a file name.
2. `(find-file new-name)` handles this situation.
3. `dired-rename-file` handles this situation as well.
3. Use `dired-rename-file` to do the dirty stuff.
1. Renames files and directories.
2. All associated buffers are updated. If you rename a directory, all buffers
that were visiting files from that directory now visit files from new
directory.
4. Properly handle recentf list update for directories - all files from the
renamed directory are removed from recentf list and the same files but from
new directory are added back.