unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Christoph Arenz <tiga.arenz@web.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Severe regressions in context of keyboard macros
Date: Mon, 23 Sep 2019 13:57:00 +0200	[thread overview]
Message-ID: <a5802e94-3bbf-3e60-f844-0ff14cdec928@web.de> (raw)
In-Reply-To: <83d0fusvjd.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3273 bytes --]

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?
> You?
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
playback.

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
"^X^Ea".

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

- mail discussion:
https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00424.html

Committer: Christoph Arenz <tiga.arenz@web.de>

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;



[-- Attachment #2: Type: text/html, Size: 5139 bytes --]

  reply	other threads:[~2019-09-23 11:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19  8:17 Severe regressions in context of keyboard macros Christoph Arenz
2019-09-20  7:23 ` Eli Zaretskii
2019-09-20 15:43   ` Christoph Arenz
2019-09-20 17:54     ` Eli Zaretskii
2019-09-23 11:57       ` Christoph Arenz [this message]
2019-09-24  8:45         ` Eli Zaretskii
2019-09-26 10:46           ` Christoph Arenz
2019-09-26 10:56             ` Eli Zaretskii
2019-09-26 11:22               ` Christoph Arenz
2019-09-26 12:10                 ` Eli Zaretskii
2019-09-26 18:27                   ` Christoph Arenz
2019-09-28  9:18                     ` Christoph Arenz
2019-09-28  9:46                       ` Eli Zaretskii
2019-09-29 17:42                         ` Christoph Arenz
2019-10-15 12:12                           ` Eli Zaretskii
2019-09-28 12:35                       ` Stefan Monnier
2019-09-28 13:44                         ` Eli Zaretskii
2019-09-29 17:59                           ` Christoph Arenz
2019-09-27 14:58             ` Fwd: " Christoph Arenz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5802e94-3bbf-3e60-f844-0ff14cdec928@web.de \
    --to=tiga.arenz@web.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).