aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Forsman <axelsfor@gmail.com>2023-07-12 16:27:42 +0200
committerAxel Forsman <axelsfor@gmail.com>2023-07-12 16:37:32 +0200
commiteec337a039f1041cf9008e9ddd19d6d7ad821caa (patch)
tree38468dd55a44fa94a8d824c900bcfa98cfb7ce98
parente511c42a10b15bdd6e0ec7f7b530c63b2dfa0fb6 (diff)
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.
-rw-r--r--evil-commands.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/evil-commands.el b/evil-commands.el
index c3e42d6..ffd5955 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.