Minor optimization of doom*switch-buffer-hooks
This commit is contained in:
parent
625a8a9056
commit
fdb95d9ee6
1 changed files with 9 additions and 9 deletions
|
@ -377,15 +377,15 @@ from the default."
|
||||||
(funcall orig-fn window norecord))
|
(funcall orig-fn window norecord))
|
||||||
(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)
|
||||||
(let ((buf (window-normalize-buffer-to-switch-to buffer-or-name)))
|
(if (or doom-inhibit-switch-buffer-hooks
|
||||||
(if (or doom-inhibit-switch-buffer-hooks
|
(eq (window-normalize-buffer-to-switch-to buffer-or-name)
|
||||||
(eq buf (current-buffer)))
|
(current-buffer)))
|
||||||
(apply orig-fn buf args)
|
(apply orig-fn buffer-or-name 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))
|
||||||
(apply orig-fn buf args))
|
(apply orig-fn buffer-or-name args))
|
||||||
(run-hooks 'doom-after-switch-buffer-hook)))))
|
(run-hooks 'doom-after-switch-buffer-hook))))
|
||||||
|
|
||||||
(defun doom|init-custom-hooks ()
|
(defun doom|init-custom-hooks ()
|
||||||
(advice-add #'select-frame :around #'doom*switch-frame-hooks)
|
(advice-add #'select-frame :around #'doom*switch-frame-hooks)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue