From 69a796ff60f4d61765460c5ab5ac12b9f8397913 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Jun 2018 02:43:07 +0200 Subject: [PATCH] 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. --- modules/feature/evil/autoload/evil.el | 6 ++++++ modules/feature/evil/config.el | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/feature/evil/autoload/evil.el b/modules/feature/evil/autoload/evil.el index 98c432ae0..20fd27355 100644 --- a/modules/feature/evil/autoload/evil.el +++ b/modules/feature/evil/autoload/evil.el @@ -358,3 +358,9 @@ more information on modifiers." (when (and (not count) evil-auto-balance-windows) (balance-windows (window-parent))) (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))) diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index 5f3de983a..25ae2790d 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -120,7 +120,7 @@ variable for an explanation of the defaults (in comments). See (setq save-silently t) (add-hook 'after-save-hook #'+evil|save-buffer)) ;; 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 (advice-add #'evil-indent :around #'+evil*static-reindent) ;; monkey patch `evil-ex-replace-special-filenames' to improve support for