fix: scope pdf-view evil-normal-state to explicit window switches only
This commit is contained in:
12
config.el
12
config.el
@@ -1123,10 +1123,16 @@ Otherwise: runs interactive ement-connect, then opens rooms after sync."
|
||||
|
||||
;; Re-activate Evil normal state when switching to a pdf-view window.
|
||||
;; Without this, j/k do not respond after SPC w w until the user clicks.
|
||||
(add-hook 'window-selection-change-functions
|
||||
(lambda (_frame)
|
||||
;; Uses targeted advice on window-switch commands to avoid interfering
|
||||
;; with org-agenda which triggers window-selection-change-functions internally.
|
||||
(defun my/pdf-view-ensure-normal-state (&rest _)
|
||||
"Activate evil-normal-state when landing on a pdf-view-mode buffer."
|
||||
(when (derived-mode-p 'pdf-view-mode)
|
||||
(evil-normal-state))))
|
||||
(evil-normal-state)))
|
||||
|
||||
(advice-add 'evil-window-next :after #'my/pdf-view-ensure-normal-state)
|
||||
(advice-add 'evil-window-prev :after #'my/pdf-view-ensure-normal-state)
|
||||
(advice-add 'other-window :after #'my/pdf-view-ensure-normal-state)
|
||||
|
||||
;; Open PDFs from org export in Emacs (pdf-view-mode) instead of Preview
|
||||
(when (eq system-type 'darwin)
|
||||
|
||||
Reference in New Issue
Block a user