emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 312c565: Don't add empty keyboard macro to macro


From: Gemini Lasswell
Subject: [Emacs-diffs] emacs-26 312c565: Don't add empty keyboard macro to macro ring (Bug#24992)
Date: Sun, 31 Dec 2017 14:29:40 -0500 (EST)

branch: emacs-26
commit 312c5655669a882186884626f0cf361de70e679d
Author: Gemini Lasswell <address@hidden>
Commit: Gemini Lasswell <address@hidden>

    Don't add empty keyboard macro to macro ring (Bug#24992)
    
    * lisp/kmacro.el (kmacro-end-call-mouse): Don't save a newly defined
    macro if it is empty.
    
    * test/lisp/kmacro-tests.el (kmacro-tests-end-and-call-macro-mouse):
    Remove expected failure tag.
---
 lisp/kmacro.el            | 8 +++++++-
 test/lisp/kmacro-tests.el | 1 -
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 5729f2f..beb52e5 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -746,7 +746,13 @@ macros, use \\[kmacro-name-last-macro]."
 If kbd macro currently being defined end it before activating it."
   (interactive "e")
   (when defining-kbd-macro
-    (end-kbd-macro))
+    (end-kbd-macro)
+    (when (and last-kbd-macro (= (length last-kbd-macro) 0))
+      (setq last-kbd-macro nil)
+      (message "Ignore empty macro")
+      ;; Don't call `kmacro-ring-empty-p' to avoid its messages.
+      (while (and (null last-kbd-macro) kmacro-ring)
+        (kmacro-pop-ring1))))
   (mouse-set-point event)
   (kmacro-call-macro nil t))
 
diff --git a/test/lisp/kmacro-tests.el b/test/lisp/kmacro-tests.el
index 690d502..c0180e3 100644
--- a/test/lisp/kmacro-tests.el
+++ b/test/lisp/kmacro-tests.el
@@ -312,7 +312,6 @@ cause the current test to fail."
 (kmacro-tests-deftest kmacro-tests-end-and-call-macro-mouse ()
   "Commands to end and call macro work under various conditions.
 This is a regression test for Bug#24992."
-  (:expected-result :failed)
   (cl-letf (((symbol-function #'mouse-set-point) #'ignore))
     ;; First, try it with no macro to record.
     (setq kmacro-tests-macros '(""))



reply via email to

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