[Top][All Lists]

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

Re: Severe regressions in context of keyboard macros

From: Christoph Arenz
Subject: Re: Severe regressions in context of keyboard macros
Date: Mon, 23 Sep 2019 13:57:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 9/20/19 7:54 PM, Eli Zaretskii wrote:
Calc seems to have various tricks related to keyboard macros (e.g.,
search for "kbd-macro"),
Yes, there are a number of hits for "kbd-macro". However as far as I
understand, calc relies on emacs' normal keyboard macro functions to
record the macro in the first place.

so someone who knows Calc should go over that
hmm... who would that be?
Not that I understand a lot of the codebase of calc or emacs, but let's give it a try...

So, with regard to keyboard macros, is the following change intentional?
Having a scratch buffer with
(push ?a unread-command-events)
the key presses <f3> C-x C-e <f4> resulted in an "a" being inserted, and
a keyboard macro being recorded.
The behavior before 30a6b1f81412044a was that last-kbd-event was set to
"^X^E" and afterwards to "^X^Ea".
I see nothing wrong with either behavior.
My understanding is that for calc prefix keys, calc relies on the capability to have a single key press be handled as two events: fancy-prefix-other-key triggers the second event by pushing onto unread-command-events via calc-unread-command. Nonetheless during macro definition, the key following the prefix key should only be recorded as a single key press.

This can be achieved by getting back to the former behavior of having
(push ?a unread-command-events) store "^X^E" in last-kbd-macro when evaluated during a keyboard macro definition.

How about the following patch? It solved the calc bug for me and I could not find other regressions so far. Running make check showed no difference.
As mentioned, I do not understand all potential effects, so it should be given some thoughts and tests.

Thanks, Christoph


Parent:     96dd0196c2 * etc/HISTORY: Add Emacs 26.3 release release date.
Follows:    emacs-26.3 (1)

Fix double-recording of events during definition of keyboard macros.

Avoid double-recording of prefix-keys in calc during keyboard
macro definition which leads to errors and wrong results at macro

This patch changes behavior as follows:
After evaluation of (push ?a unread-command-events) with `<f3> C-x
C-e <f4>' last-kbd-macro is "^X^E" as in emacs-24.5 and no longer

See also:
- bug report #37057:
25.2; Calc; Key erroneously recorded twice in keyboard macro

- mail discussion:

Committer: Christoph Arenz <address@hidden>

1 file changed, 4 insertions(+), 2 deletions(-)
src/keyboard.c | 6 ++++--

modified   src/keyboard.c
@@ -3047,8 +3047,10 @@ read_char (int commandflag, Lisp_Object map,
   /* When we consume events from the various unread-*-events lists, we
      bypass the code that records input, so record these events now if
-     they were not recorded already.  */
-  if (!recorded)
+     they were not recorded already.
+     However, avoid double-recording those events in case of a keyboard
+     macro being defined. */
+  if ((!recorded) && (NILP (KVAR (current_kboard, defining_kbd_macro))))
       record_char (c);
       recorded = true;

reply via email to

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