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))
|
||||
(run-hooks 'doom-after-switch-window-hook))))
|
||||
(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
|
||||
(eq buf (current-buffer)))
|
||||
(apply orig-fn buf args)
|
||||
(eq (window-normalize-buffer-to-switch-to buffer-or-name)
|
||||
(current-buffer)))
|
||||
(apply orig-fn buffer-or-name args)
|
||||
(run-hooks 'doom-before-switch-buffer-hook)
|
||||
(prog1
|
||||
(let ((doom-inhibit-switch-buffer-hooks t))
|
||||
(apply orig-fn buf args))
|
||||
(run-hooks 'doom-after-switch-buffer-hook)))))
|
||||
(apply orig-fn buffer-or-name args))
|
||||
(run-hooks 'doom-after-switch-buffer-hook))))
|
||||
|
||||
(defun doom|init-custom-hooks ()
|
||||
(advice-add #'select-frame :around #'doom*switch-frame-hooks)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue