Don't invoke doom/escape too eagerly from evil

This fixes an issue where certain evil plugins would call
evil-force-normal-state non-interactively, causing `doom-escape-hook` to
wreck havoc. Instead, this should only happen when
evil-force-normal-state is called interactively (e.g. via ESC in normal
mode).

Fixes evil-mc-make-cursor-move-next-line and
evil-mc-make-cursor-move-prev-line.
This commit is contained in:
Henrik Lissner 2018-06-07 02:43:07 +02:00
parent ef9d8fb2e8
commit 69a796ff60
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 7 additions and 1 deletions

View file

@ -358,3 +358,9 @@ more information on modifiers."
(when (and (not count) evil-auto-balance-windows) (when (and (not count) evil-auto-balance-windows)
(balance-windows (window-parent))) (balance-windows (window-parent)))
(if file (evil-edit file))) (if file (evil-edit file)))
;;;###autoload
(defun +evil*escape (&rest _)
"Call `doom/escape' if `evil-force-normal-state' is called interactively."
(when (called-interactively-p 'any)
(call-interactively #'doom/escape)))

View file

@ -120,7 +120,7 @@ variable for an explanation of the defaults (in comments). See
(setq save-silently t) (setq save-silently t)
(add-hook 'after-save-hook #'+evil|save-buffer)) (add-hook 'after-save-hook #'+evil|save-buffer))
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'. ;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
(advice-add #'evil-force-normal-state :after #'doom/escape) (advice-add #'evil-force-normal-state :after #'+evil*escape)
;; Don't move cursor when indenting ;; Don't move cursor when indenting
(advice-add #'evil-indent :around #'+evil*static-reindent) (advice-add #'evil-indent :around #'+evil*static-reindent)
;; monkey patch `evil-ex-replace-special-filenames' to improve support for ;; monkey patch `evil-ex-replace-special-filenames' to improve support for