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: 653b465c74
This commit is contained in:
Henrik Lissner
2025-04-02 16:59:56 -04:00
parent d4c02bcd08
commit 625b793218

View File

@ -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'."