mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
fix(evil): persist evil state after mode changes
For example: when doom-guess-mode-h is triggered (see #7141), or when the user invokes a mode function through M-x. Fix: #7141
This commit is contained in:
@ -55,6 +55,14 @@ directives. By default, this only recognizes C directives.")
|
||||
((modulep! :emacs undo) 'undo-fu)
|
||||
((> emacs-major-version 27) 'undo-redo)))
|
||||
|
||||
;; Fix #7141
|
||||
(defadvice! +evil--persist-state-a (fn &rest args)
|
||||
"When changing major modes, Evil's state is lost. This advice preserves it."
|
||||
:around #'set-auto-mode
|
||||
(if evil-state
|
||||
(evil-save-state (apply fn args))
|
||||
(apply fn args)))
|
||||
|
||||
;; Slow this down from 0.02 to prevent blocking in large or folded buffers
|
||||
;; like magit while incrementally highlighting matches.
|
||||
(setq-hook! '(magit-mode-hook so-long-minor-mode-hook)
|
||||
|
Reference in New Issue
Block a user