feature/workspaces: fix buffer getting killed across workspaces
This commit is contained in:
parent
b082ba6460
commit
a17fc86761
2 changed files with 8 additions and 0 deletions
|
@ -453,6 +453,12 @@ the next."
|
||||||
;; Hooks
|
;; Hooks
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +workspaces|protect-buffers-in-other-persps ()
|
||||||
|
"Return nil if this buffer is present in other perspectives/workspaces (bury
|
||||||
|
it, don't kill it)."
|
||||||
|
(not (persp-other-persps-with-buffer-except-nil (current-buffer))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +workspaces|delete-associated-workspace (&optional frame)
|
(defun +workspaces|delete-associated-workspace (&optional frame)
|
||||||
"Delete workspace associated with current frame.
|
"Delete workspace associated with current frame.
|
||||||
|
|
|
@ -114,6 +114,7 @@ Uses `+workspaces-main' to determine the name of the main workspace."
|
||||||
;; kill-buffer-query-functions
|
;; kill-buffer-query-functions
|
||||||
(remove-hook 'kill-buffer-query-functions 'persp-kill-buffer-query-function)
|
(remove-hook 'kill-buffer-query-functions 'persp-kill-buffer-query-function)
|
||||||
(add-hook 'kill-buffer-query-functions 'persp-kill-buffer-query-function t)
|
(add-hook 'kill-buffer-query-functions 'persp-kill-buffer-query-function t)
|
||||||
|
(add-hook 'kill-buffer-query-functions #'+workspaces|protect-buffers-in-other-persps)
|
||||||
|
|
||||||
;; Remap `buffer-list' to current workspace's buffers in
|
;; Remap `buffer-list' to current workspace's buffers in
|
||||||
;; `doom-buffer-list'
|
;; `doom-buffer-list'
|
||||||
|
@ -121,6 +122,7 @@ Uses `+workspaces-main' to determine the name of the main workspace."
|
||||||
(advice-add #'display-buffer :after #'+workspaces*auto-add-buffer)
|
(advice-add #'display-buffer :after #'+workspaces*auto-add-buffer)
|
||||||
(advice-add #'doom-buffer-list :override #'+workspace-buffer-list))
|
(advice-add #'doom-buffer-list :override #'+workspace-buffer-list))
|
||||||
(t
|
(t
|
||||||
|
(remove-hook 'kill-buffer-query-functions #'+workspaces|protect-buffers-in-other-persps)
|
||||||
(advice-remove #'switch-to-buffer #'+workspaces*auto-add-buffer)
|
(advice-remove #'switch-to-buffer #'+workspaces*auto-add-buffer)
|
||||||
(advice-remove #'display-buffer #'+workspaces*auto-add-buffer)
|
(advice-remove #'display-buffer #'+workspaces*auto-add-buffer)
|
||||||
(advice-remove #'doom-buffer-list #'+workspace-buffer-list))))
|
(advice-remove #'doom-buffer-list #'+workspace-buffer-list))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue