>From 2e5a84b47b72519aabe8e4aa392e2b53858aa8cf Mon Sep 17 00:00:00 2001 From: gazally Date: Sun, 20 Nov 2016 14:24:51 -0800 Subject: [PATCH] Don't add empty keyboard macro to macro ring * lisp/kmacro.el (kmacro-end-call-mouse): Don't save a newly defined macro if it is empty. --- lisp/kmacro.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 2e743b4..49787f5 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -744,7 +744,13 @@ kmacro-end-call-mouse 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)) -- 2.10.1