summaryrefslogtreecommitdiff
path: root/lisp/kmacro.el
diff options
context:
space:
mode:
authorGemini Lasswell <gazally@runbox.com>2017-12-18 10:08:59 -0800
committerGemini Lasswell <gazally@runbox.com>2017-12-31 11:10:26 -0800
commit312c5655669a882186884626f0cf361de70e679d (patch)
tree8229f70ac78519ac7d586b804e31ae703d5c0c5c /lisp/kmacro.el
parent39ca289a7a33d514c2a46f005db4e7173fb7e9f5 (diff)
downloademacs-312c5655669a882186884626f0cf361de70e679d.tar.gz
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.
Diffstat (limited to 'lisp/kmacro.el')
-rw-r--r--lisp/kmacro.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 5729f2fc8d3..beb52e56351 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))