GNU bug report logs - #56210
29.0.50; Keyboard macros do not trigger after-change-functions

Previous Next

Package: emacs;

Reported by: Richard Hansen <rhansen <at> rhansen.org>

Date: Sat, 25 Jun 2022 06:23:02 UTC

Severity: normal

Found in version 29.0.50

Done: Richard Hansen <rhansen <at> rhansen.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Richard Hansen <rhansen <at> rhansen.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 56210 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: bug#56210: 29.0.50; Keyboard macros do not trigger after-change-functions
Date: Sat, 25 Jun 2022 16:34:11 -0400
[Message part 1 (text/plain, inline)]
On 2022-06-25 14:56, Eli Zaretskii wrote:
> Maybe we should step back and ask what do you think the below do?
> 
>    (execute-kbd-macro (kbd "x"))
> 
> What is, in your mental model, the effect of the above in Emacs?

I would expect that to be roughly equivalent to typing "x" on the physical keyboard, which would insert an event into some sort of event queue.  (I'm not familiar enough with Emacs to know whether that queue is per-buffer, per-window, per-frame, per-terminal, per-process, or something else.)  Under normal circumstances, the event would be dispatched to the buffer associated with the `selected-window' of the `selected-frame', and insert an "x".

I think my understanding of "current buffer" is incorrect.  My current mental model of `with-current-buffer' is that it behaves as if the window's associated buffer is briefly switched to the specified buffer (like "C-x b" does) except it doesn't actually go to the expense of rendering the other buffer in the window (or update the toolbar, etc.).  Looking at the documentation of `set-window-buffer', that mental model appears to be wrong.

But if my mental model is wrong, why does my original code insert "x" into the temporary buffer?  It is not due to something specific to `ert-with-test-buffer', because if I evaluate the following in *scratch* then I see the same behavior that Lars saw with `with-temp-buffer' (the "x" is inserted into *scratch*):

    (ert-with-test-buffer () (execute-kbd-macro (kbd "x")))

Maybe `ert-run-tests-batch-and-exit' is setting it up to more closely simulate a user interacting with Emacs?  Or maybe the behavior is caused by batch mode?

Regardless, given that the temporary buffer is modified in my original example, shouldn't `after-change-functions' run?
[OpenPGP_signature (application/pgp-signature, attachment)]

This bug report was last modified 2 years and 329 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.