emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil e4fb2a3: Return to state after C-o in macro (#1549)


From: ELPA Syncer
Subject: [nongnu] elpa/evil e4fb2a3: Return to state after C-o in macro (#1549)
Date: Tue, 7 Dec 2021 17:57:49 -0500 (EST)

branch: elpa/evil
commit e4fb2a37c5bd3723c4869d7b6728a43b7321876e
Author: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Return to state after C-o in macro (#1549)
---
 evil-commands.el | 5 ++++-
 evil-tests.el    | 8 +++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index dc8a2e7..c036ddd 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2358,7 +2358,10 @@ when called interactively."
    (t
     (condition-case err
         (evil-with-single-undo
-          (execute-kbd-macro macro count))
+          (dotimes (_ (or count 1))
+            (execute-kbd-macro macro)
+            (when (eq 'evil-execute-in-normal-state last-command)
+              (evil-change-state evil--execute-normal-return-state))))
       ;; enter Normal state if the macro fails
       (error
        (evil-normal-state)
diff --git a/evil-tests.el b/evil-tests.el
index 4827486..cc6d543 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -356,7 +356,13 @@ with `M-x evil-tests-run'"))
         :state insert
         "ab[]cfg"
         ("\C-o~de\C-o.")
-        "abCdeF[]g"))))
+        "abCdeF[]g"))
+    (ert-info ("Returned to initial state when finishing a macro")
+      (evil-test-buffer
+        "[f]oo __ bar __ baz __ qux"
+        (evil-set-register ?q "f_cehi\C-o")
+        ("@q1" [escape] "@q2")
+        "foo hi1 bar hi2[] baz __ qux"))))
 
 (defun evil-test-suppress-keymap (state)
   "Verify that `self-insert-command' is suppressed in STATE"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]