From 625b793218bbbe6c2c52d68dc82cd3599ef4e918 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 2 Apr 2025 16:59:56 -0400 Subject: [PATCH] fix: over-aggressive doom--run-switch-frame-hooks-fn Due to a typo in the hook's self-removal, causing this function to trigger many times per second. It isn't doing much thanks to the debouncing, but was still legitimately triggering doom-switch-frame-hook every ~2 seconds despite no change in frame focus. Also removes the ineffectual inhibit-redisplay let-bind. Amend: 653b465c74b2 --- lisp/doom-ui.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/doom-ui.el b/lisp/doom-ui.el index 5e64d48d9..94ab493d2 100644 --- a/lisp/doom-ui.el +++ b/lisp/doom-ui.el @@ -121,7 +121,7 @@ non-interactive code, or the user accidentally (and rapidly) un-and-refocusing the frame through some other means.") (defun doom--run-switch-frame-hooks-fn (_) - (remove-hook 'pre-redisplay-functions #'doom--run-switch-frame-hooks) + (remove-hook 'pre-redisplay-functions #'doom--run-switch-frame-hooks-fn) (let ((gc-cons-threshold most-positive-fixnum)) (dolist (fr (visible-frame-list)) (let ((state (frame-focus-state fr))) @@ -139,12 +139,11 @@ the frame through some other means.") (let (last-focus-state) (defun doom-run-switch-frame-hooks-fn () "Trigger `doom-switch-frame-hook' once per frame focus change." - (let ((inhibit-redisplay t)) - (or (equal last-focus-state - (setq last-focus-state - (mapcar #'frame-focus-state (frame-list)))) - ;; Defer until next redisplay - (add-hook 'pre-redisplay-functions #'doom--run-switch-frame-hooks-fn))))) + (or (equal last-focus-state + (setq last-focus-state + (mapcar #'frame-focus-state (frame-list)))) + ;; Defer until next redisplay + (add-hook 'pre-redisplay-functions #'doom--run-switch-frame-hooks-fn)))) (defun doom-protect-fallback-buffer-h () "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'."