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:
parent
7c7ee6602c
commit
adb125f41f
1 changed files with 8 additions and 0 deletions
|
@ -55,6 +55,14 @@ directives. By default, this only recognizes C directives.")
|
||||||
((modulep! :emacs undo) 'undo-fu)
|
((modulep! :emacs undo) 'undo-fu)
|
||||||
((> emacs-major-version 27) 'undo-redo)))
|
((> 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
|
;; Slow this down from 0.02 to prevent blocking in large or folded buffers
|
||||||
;; like magit while incrementally highlighting matches.
|
;; like magit while incrementally highlighting matches.
|
||||||
(setq-hook! '(magit-mode-hook so-long-minor-mode-hook)
|
(setq-hook! '(magit-mode-hook so-long-minor-mode-hook)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue