[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15126: 24.3; kmacro-end-and-call-macro repeats macro multiple times
From: |
Juri Linkov |
Subject: |
bug#15126: 24.3; kmacro-end-and-call-macro repeats macro multiple times following isearch-forward |
Date: |
Sat, 24 Aug 2013 12:45:01 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
> In Emacs 24.2.1 and all previous versions I've used,
> kmacro-end-and-call-macro calls the macro once more, and I can go
> through the file making changes one at a time, and I can stop when I
> want.
>
> In Emacs 24.3.1, kmacro-end-and-call-macro calls the macro repeatedly
> making changes to all the repeated text up to the end of the file.
Actually this is an old bug uncovered by another unrelated change.
Emacs 24.2.1 stored the key `C-x' in the keyboard macro.
Emacs 24.3.1 now stores the whole key sequence `C-x e'.
Storing `C-x' had no effect, but also made no sense.
It's clear that neither `C-x' nor `C-x e' should be stored.
So not storing `C-x e' will not execute the same macro repeatedly.
Currently I see only one way to fix this properly:
=== modified file 'lisp/isearch.el'
--- lisp/isearch.el 2013-08-08 23:59:14 +0000
+++ lisp/isearch.el 2013-08-24 09:27:30 +0000
@@ -2386,6 +2386,13 @@ (defun isearch-other-meta-char (&optiona
(isearch-unread-key-sequence keylist)
(setq main-event (car unread-command-events))
+ ;; Don't store special commands in the keyboard macro.
+ (let (overriding-terminal-local-map)
+ (when (memq (key-binding key)
+ '(kmacro-start-macro
+ kmacro-end-macro kmacro-end-and-call-macro))
+ (cancel-kbd-macro-events)))
+
;; If we got a mouse click event, that event contains the
;; window clicked on. maybe it was read with the buffer
;; it was clicked on. If so, that buffer, not the current one,