spacemacs//fixup-window-configs is added as an `:around` advice for
`rename-buffer`. It should preserve `rename-buffer`'s return value,
which is the new name of the buffer.
Helm v3.3 no longer uses ido to get buffer list. So the change perp-mode makes
to ido won't affect helm anymore. Hence helm buffer list commands such as
helm-mini and helm-buffer-list will shows all buffers regardless of current
layout. Also `SPC l l` crashes with new helm.
This PR fixes them. We use the new helm variable helm-buffer-list-reorder-fn
to filter buffers. Because we compose this value users are still able to
customize this variable.
Add layer variable documentation for persp-autokill-buffer-on-remove
Set to kill-weak, then buffers are deleted when the layout is deleted.
https://github.com/Bad-ptr/persp-mode.el#suggested-configuration
Add usage section
- describe the core usage of layouts
Add keybindings section
- include all keybindings for the layer
Fix formatting
- = instead of ~ and vice versa
Resolve#11698
Add key bindings to the `SPC p l` persp switch project prompt:
- helm `C-d`
- ivy `d` in the `M-o` actions list
They create a new perspective with the project name
and open a dired buffer at the project root.
The suggestion to also add it to ivy was provided by nixmaniack.
Instead of using a single variable for all transient states' full-hint
toggle functions, define a unique variable for each toggle function so that
toggling the full hint for one transient state does not affect the others.
* CHANGELOG.develop: Add an entry for this change.
* layers/+spacemacs/spacemacs-defaults/keybindings.el
(spacemacs--window-manipulation-ts-full-hint-toggle): New variable.
(spacemacs//window-manipulation-ts-toggle-hint)
(spacemacs//window-manipulation-ts-hint): Replace
spacemacs--ts-full-hint-toggle with
spacemacs--window-manipulation-ts-full-hint-toggle.
* layers/+spacemacs/spacemacs-layouts/config.el
(spacemacs--ts-full-hint-toggle): Delete variable.
(spacemacs--layouts-ts-full-hint-toggle)
(spacemacs--workspaces-ts-full-hint-toggle): New variables.
* layers/+spacemacs/spacemacs-layouts/funcs.el
(spacemacs//layouts-ts-toggle-hint, spacemacs//layouts-ts-hint): Replace
spacemacs--ts-full-hint-toggle with spacemacs--layouts-ts-full-hint-toggle.
(spacemacs//workspaces-ts-toggle-hint, spacemacs//workspaces-ts-hint):
Replace spacemacs--ts-full-hint-toggle with
spacemacs--workspaces-ts-full-hint-toggle.
Use nil and t instead of 0 and 1 for spacemacs--ts-full-hint values.
* layers/+spacemacs/spacemacs-layouts/config.el
(spacemacs--ts-full-hint-toggle): Define with an initial value of nil.
* layers/+spacemacs/spacemacs-defaults/keybindings.el
(spacemacs//window-manipulation-ts-toggle-hint)
(spacemacs//window-manipulation-ts-hint):
* layers/+spacemacs/spacemacs-layouts/funcs.el
(spacemacs//layouts-ts-toggle-hint, spacemacs//layouts-ts-hint)
(spacemacs//workspaces-ts-toggle-hint, spacemacs//workspaces-ts-hint):
Replace (logxor ... 1) and (equal 1 ...) with (not ...) and a simple truth
check.
Remove empty lines:
- Two in the Layouts Transients State.
- Three in the Workspaces Transient State.
In the Layouts Transient State:
Move the navigation keys:
[n/C-l] next layout
[N/p/C-h] prev layout
closer to the top, to match the order in the Workspaces Transient State.
Change to a more generic description, without mentioning the other
completion name.
From: [l] layout w/helm/ivy
To: [l] another layout
Shorten the descriptions:
From: [w] workspaces transient state
To: [w] workspaces TS
and
From: [t] show a buffer without adding it to current layout
To: [t] show buffer w/o adding to layout
Indicate what's being added:
From: [A] add all from layout
To: [A] add all buffers from layout
In the Workspaces Transient State:
Rename "create" to "clone, because it's more descriptive and the
docstring for the variable "eyebrowse-new-workspace" says:
"nil: Clone last workspace."
From: [c/C] create workspace
To: [c/C] clone workspace
Add "TS" to the description to indicate that it switches to the Layouts
Transient State and then it will match "workspaces TS" in the Layouts
Transient State.
From: [l] layouts
To: [l] layouts TS
Instead of sorting "[l] layouts TS" alphabetically by it's key letter,
move it to the bottom of the "Go to" column. This has two benefits:
- The workspaces navigation keys are grouped together, without having
"[l] layouts TS" in the middle.
- And "[l] layouts TS" will be the last entry in the "Go to" column.
This matches the location of "[w] workspaces TS" in the Layouts
Transient State.
Change to a more generic description, without mentioning the other
completion name.
From: [w] workspace w/helm/ivy
To: [w] another workspace
Updated the Workspaces Transient State "SPC l w".
Added a new key: "[s/S] single win workspace" to the Actions column.
It creates a new workspace with a single window, that shows the
Spacemacs home buffer.
Moved the existing key: "[c/C] create workspace" to the Actions column.
Guard :requires against ivy not projectile. projectile is already owned by
buil-in spacemacs-project layer, so it's always t.
This prevents install of ivy, counsel, swiper and counsel-projectile
packages regardless of helm layer
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.
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.
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.
Fix issue #11207.
Only try to disable eyebrowse's advice on rename-buffer if we can find that
advice. If eyebrowse is older than version 0.7.6 (2017-11-22), the advice
will not exist, and attempting to delete it will cause an error:
ad-disable-advice: rename-buffer is not advised
* layers/+spacemacs/spacemacs-layouts/funcs.el
(spacemacs//activate-persp-mode): Only disable the
eyebrowse-fixup-window-configs advice for rename-buffer if the advice
exists.
Before this commit, spacemacs-layouts/init-eyebrowse advised rename-buffer
with spacemacs//fixup-window-config. However, this advice causes problems
if persp-mode is not activated when a function tries to rename a buffer.
In particular, Spacemacs's CI uses Emacs's batch mode to run
spacemacs/publish-doc, which uses rename-buffer. In batch mode, persp-mode
is not activated, and consequently spacemacs/publish-doc was failing:
Publishing file /home/travis/.emacs.d/news/news01.org using ‘org-html-publish-to-html’
Skipping check for new version (reason: dotfile)
Wrong type argument: hash-table-p, nil
Warning (emacs): recentf mode: Wrong type argument: hash-table-p, nil
spacemacs/publish-doc failed
In order to avoid problems, this commit moves the advising of rename-buffer
from spacemacs-layouts/init-eyebrowse to spacemacs//activate-persp-mode.
* layers/+spacemacs/spacemacs-layouts/packages.el
(spacemacs-layouts/init-eyebrowse): Move advice from here...
* layers/+spacemacs/spacemacs-layouts/funcs.el
(spacemacs//activate-persp-mode): ...to here.
Eyebrowse stores window configurations for workspaces in frame properties.
These window configurations reference buffers by name, which means that
these references must be updated when a buffer is renamed. To this end,
eyebrowse advises rename-buffer.
Spacemacs integrates eyebrowse with persp-mode by saving the eyebrowse
workspaces for a perspective as a parameter for that perspective so that
Spacemacs can restore a perspective's workspaces when switching to that
perspective. However, eyebrowse's advice for rename-buffer fails to update
inactive workspaces, for which the window configurations are stored in
perspective parameters and not frame properties.
This commit disables eyebrowse's advice and adds perspective-aware advice
to update buffer references in workspace window configurations.
* layers/+spacemacs/spacemacs-layouts/funcs.el
(spacemacs//fixup-window-configs): New.
* layers/+spacemacs/spacemacs-layouts/packages.el
(spacemacs-layouts/init-eyebrowse): Remove eyebrowse-fixup-window-configs
advice for rename-buffer and advise with spacemacs//fixup-window-configs
instead.
This fixes issue #5776.
* layers/+spacemacs/spacemacs-layouts/packages.el
(spacemacs-layouts/init-persp-mode):
Set persp-add-buffer-on-after-change-major-mode to 'free.
This reverts commit 29c78ce841 and all other fixes
that have been made afterwards.
The motivation is that use-package is seen by many as a replacement for
`require`. Is use-package always defer the loading of packages then is breaks
this use case, this does not respect POLA so even if it was making Spacemacs
loading faster (up to 3s faster on some startup on my machine) we just cannot
use it, it would be irresponsible. Spacemacs should be easy to use, loading
performance will come with time but it is not a priority.