From fdb95d9ee67c03396e00e92b03d95d87cb626aa9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 4 Jun 2018 21:09:24 +0200 Subject: [PATCH] Minor optimization of doom*switch-buffer-hooks --- core/core-ui.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/core-ui.el b/core/core-ui.el index a5a371dd6..a052e7dbf 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -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)