ui/workspaces: associate buffers on buffer switch
We stop relying on the built-in mechanism for auto-registering a buffer to the current workspace, because it misses many buffers (e.g. when we switch buffers with SPC b b). Instead, we add buffers when they are interactively switched to.
This commit is contained in:
parent
0290b687a5
commit
7a4bce3f9a
1 changed files with 8 additions and 4 deletions
|
@ -91,12 +91,16 @@ Uses `+workspaces-main' to determine the name of the main workspace."
|
|||
|
||||
(advice-add #'persp-asave-on-exit :around #'+workspaces*autosave-real-buffers)
|
||||
|
||||
;; Ensure buffers we've opened/switched to are auto-added to the current
|
||||
;; perspective
|
||||
(setq persp-add-buffer-on-find-file t
|
||||
persp-add-buffer-on-after-change-major-mode t)
|
||||
;; Don't rely on the built-in mechanism for auto-registering a buffer to the
|
||||
;; current workspace. Instead, we add buffers when they are switched to.
|
||||
(setq persp-add-buffer-on-find-file nil
|
||||
persp-add-buffer-on-after-change-major-mode nil)
|
||||
(add-hook 'persp-add-buffer-on-after-change-major-mode-filter-functions #'doom-unreal-buffer-p)
|
||||
|
||||
(defun +workspaces|add-current-buffer ()
|
||||
(persp-add-buffer (current-buffer) (get-current-persp)))
|
||||
(add-hook 'doom-switch-buffer-hook #'+workspaces|add-current-buffer)
|
||||
|
||||
(defun +workspaces|init-persp-mode ()
|
||||
(cond (persp-mode
|
||||
;; `persp-kill-buffer-query-function' must be last
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue