mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Minor optimization of doom*switch-buffer-hooks
This commit is contained in:
@ -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)
|
||||
(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)))))
|
||||
(if (or doom-inhibit-switch-buffer-hooks
|
||||
(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 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)
|
||||
|
Reference in New Issue
Block a user