unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Hansen <rhansen@rhansen.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 56210@debbugs.gnu.org, larsi@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	[thread overview]
Message-ID: <d960a836-f14a-2dc5-532f-4c153c153372@rhansen.org> (raw)
In-Reply-To: <83pmiwa7y3.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 1786 bytes --]

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?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-06-25 20:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25  6:21 bug#56210: 29.0.50; Keyboard macros do not trigger after-change-functions Richard Hansen
2022-06-25 11:51 ` Lars Ingebrigtsen
2022-06-25 18:06   ` Richard Hansen
2022-06-25 18:56     ` Eli Zaretskii
2022-06-25 20:34       ` Richard Hansen [this message]
2022-06-26  8:10         ` Eli Zaretskii
2022-06-27  3:21           ` Richard Hansen
2022-06-27  7:50             ` Lars Ingebrigtsen
2022-06-27 16:52               ` Richard Hansen
2022-06-27 16:54             ` Eli Zaretskii
2022-06-27 17:07               ` Richard Hansen
2022-06-27 17:17                 ` Eli Zaretskii
2022-06-27 17:22                   ` Richard Hansen
2022-06-28 11:31                   ` Lars Ingebrigtsen
2022-06-28 12:20                     ` Eli Zaretskii
2022-06-28 12:26                       ` Lars Ingebrigtsen
2022-06-27 17:23                 ` Richard Hansen
2022-06-29 23:17               ` Richard Hansen

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=d960a836-f14a-2dc5-532f-4c153c153372@rhansen.org \
    --to=rhansen@rhansen.org \
    --cc=56210@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.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).