Propagate buffer errors up the call stack
Delegates set-buffer(nil) errors (when switch hooks are called with an invalid or dead buffer) to the caller to handle. Fixes #668, #674
This commit is contained in:
parent
4b8ac0ad3d
commit
14890376b1
1 changed files with 7 additions and 6 deletions
|
@ -366,7 +366,7 @@ from the default."
|
||||||
(defvar doom-inhibit-switch-window-hooks nil)
|
(defvar doom-inhibit-switch-window-hooks nil)
|
||||||
|
|
||||||
(defun doom*switch-frame-hooks (orig-fn frame &optional norecord)
|
(defun doom*switch-frame-hooks (orig-fn frame &optional norecord)
|
||||||
(if (eq frame (selected-frame))
|
(if (or (null frame) (eq frame (selected-frame)))
|
||||||
(funcall orig-fn frame norecord)
|
(funcall orig-fn frame norecord)
|
||||||
(run-hooks 'doom-before-switch-frame-hook)
|
(run-hooks 'doom-before-switch-frame-hook)
|
||||||
(prog1 (funcall orig-fn frame norecord)
|
(prog1 (funcall orig-fn frame norecord)
|
||||||
|
@ -374,6 +374,7 @@ from the default."
|
||||||
(run-hooks 'doom-after-switch-frame-hook)))))
|
(run-hooks 'doom-after-switch-frame-hook)))))
|
||||||
(defun doom*switch-window-hooks (orig-fn window &optional norecord)
|
(defun doom*switch-window-hooks (orig-fn window &optional norecord)
|
||||||
(if (or doom-inhibit-switch-window-hooks
|
(if (or doom-inhibit-switch-window-hooks
|
||||||
|
(null window)
|
||||||
(eq window (selected-window))
|
(eq window (selected-window))
|
||||||
(window-minibuffer-p)
|
(window-minibuffer-p)
|
||||||
(window-minibuffer-p window))
|
(window-minibuffer-p window))
|
||||||
|
@ -385,11 +386,11 @@ from the default."
|
||||||
(with-selected-window window
|
(with-selected-window window
|
||||||
(run-hooks 'doom-after-switch-window-hook)))))
|
(run-hooks 'doom-after-switch-window-hook)))))
|
||||||
(defun doom*switch-buffer-hooks (orig-fn buffer-or-name &rest args)
|
(defun doom*switch-buffer-hooks (orig-fn buffer-or-name &rest args)
|
||||||
(if (or doom-inhibit-switch-buffer-hooks
|
(let ((dest (get-buffer buffer-or-name)))
|
||||||
(eq (get-buffer buffer-or-name)
|
(if (or doom-inhibit-switch-buffer-hooks
|
||||||
(current-buffer)))
|
(null dest)
|
||||||
(apply orig-fn buffer-or-name args)
|
(eq dest (current-buffer)))
|
||||||
(let ((dest (get-buffer buffer-or-name)))
|
(apply orig-fn dest args)
|
||||||
(run-hooks 'doom-before-switch-buffer-hook)
|
(run-hooks 'doom-before-switch-buffer-hook)
|
||||||
(prog1
|
(prog1
|
||||||
(let ((doom-inhibit-switch-buffer-hooks t))
|
(let ((doom-inhibit-switch-buffer-hooks t))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue