1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

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.
This commit is contained in:
Gemini Lasswell 2017-12-18 10:08:59 -08:00
parent 39ca289a7a
commit 312c565566
2 changed files with 7 additions and 2 deletions

View File

@ -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))

View File

@ -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 '(""))