mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-25 14:13:37 -05:00
refactor: doom-switch-frame-hook
Redesign this hook around `after-focus-change-function`, along with debouncing, to prevent it from triggering too aggressively (due to misbehaving desktop environments, elisp packages that tinker with frame focus, or accidental (and rapid) focus changes by the user). `doom-switch-{window,buffer}-hook` have also been simplified, and `doom-switch-window-hook` now will not trigger when focusing another frame (only when you switch windows *within* any one frame). This also fixes diff-hl not updating when refocusing an Emacs frame.
This commit is contained in:
@@ -50,7 +50,7 @@ Only has an effect in GUI Emacs.")
|
||||
;; ...then refresh the rest only when we switch to them or refocus the active
|
||||
;; frame, not all at once.
|
||||
(add-hook 'doom-switch-buffer-hook #'+magit-revert-buffer-maybe-h)
|
||||
(add-hook 'focus-in-hook #'+magit-mark-stale-buffers-h)
|
||||
(add-hook 'doom-switch-frame-hook #'+magit-mark-stale-buffers-h)
|
||||
|
||||
;; The default location for git-credential-cache is in
|
||||
;; ~/.cache/git/credential. However, if ~/.git-credential-cache/ exists, then
|
||||
|
@@ -368,7 +368,7 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
|
||||
;; In case the user saves the file to a new location
|
||||
after-save-hook
|
||||
;; ...or makes external changes then returns to Emacs
|
||||
focus-in-hook
|
||||
doom-switch-frame-hook
|
||||
;; ...or when we change the current project!
|
||||
projectile-after-switch-project-hook
|
||||
;; ...when the visited file changes (e.g. it's renamed)
|
||||
|
@@ -118,8 +118,9 @@ Respects `diff-hl-disable-on-remote'."
|
||||
:n "{" #'diff-hl-show-hunk-previous
|
||||
:n "}" #'diff-hl-show-hunk-next
|
||||
:n "S" #'diff-hl-show-hunk-stage-hunk))
|
||||
;; UX: Refresh gutter on ESC or refocusing the Emacs frame.
|
||||
(add-hook! '(doom-escape-hook doom-switch-window-hook) :append
|
||||
;; UX: Refresh gutter in the selected buffer on ESC, switching windows, or
|
||||
;; refocusing the frame.
|
||||
(add-hook! '(doom-escape-hook doom-switch-window-hook doom-switch-frame-hook) :append
|
||||
(defun +vc-gutter-update-h (&rest _)
|
||||
"Return nil to prevent shadowing other `doom-escape-hook' hooks."
|
||||
(ignore (or inhibit-redisplay
|
||||
|
Reference in New Issue
Block a user