branch: elpa/evil
commit eec337a039f1041cf9008e9ddd19d6d7ad821caa
Author: Axel Forsman <[email protected]>
Commit: Axel Forsman <[email protected]>

    Enter Insert mode on "o"/"O" even with indent fail
    
    Commit bf98a96b769b578aaf80826c4233bcd0211ffc0b did this by reordering
    such that indenting happened after having already changed to Insert
    state, which had to be reverted in commit
    3641c6e619fd3caef15c9e9a9e4420a57e079f2c for i_CTRL-A correctness. Use
    unwind-protect to satisfy both requirements.
---
 evil-commands.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index c3e42d699b..ffd5955834 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2811,9 +2811,10 @@ The insertion will be repeated COUNT times."
   (setq evil-insert-count count
         evil-insert-lines t
         evil-insert-vcount nil)
-  (when evil-auto-indent
-    (indent-according-to-mode))
-  (evil-insert-state 1))
+  (unwind-protect
+      (when evil-auto-indent
+        (indent-according-to-mode))
+    (evil-insert-state 1)))
 
 (evil-define-command evil-open-below (count)
   "Insert a new line below point and switch to Insert state.
@@ -2827,9 +2828,10 @@ The insertion will be repeated COUNT times."
   (setq evil-insert-count count
         evil-insert-lines t
         evil-insert-vcount nil)
-  (when evil-auto-indent
-    (indent-according-to-mode))
-  (evil-insert-state 1))
+  (unwind-protect
+      (when evil-auto-indent
+        (indent-according-to-mode))
+    (evil-insert-state 1)))
 
 (defun evil--insert-line (count vcount non-blank-p)
   "Switch to insert state at the beginning of the current line.

Reply via email to