GNU bug report logs - #46982
28.0.50; after-change-functions in an indirect buffer are not called if the change is done while base buffer is active (and vice versa)

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> gmail.com>

Date: Sun, 7 Mar 2021 04:33:02 UTC

Severity: normal

Found in version 28.0.50

Full log


Message #8 received at 46982 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> gmail.com>
Cc: 46982 <at> debbugs.gnu.org
Subject: Re: bug#46982: 28.0.50; after-change-functions in an indirect
 buffer are not called if the change is done while base buffer is active
 (and vice versa)
Date: Thu, 16 Jun 2022 22:36:29 -0400
> 1. emacs -Q
> 2. M-x clone-indirect-buffer <RET>
> 3. M-: (setq-local after-change-functions (append after-change-functions
>    '((lambda (&rest _) (message "Buffer 1"))))) <RET>
> 4. C-x o
> 5. M-: (setq-local after-change-functions (append after-change-functions
>    '((lambda (&rest _) (message "Buffer 2"))))) <RET>
> 6. Type something. "Buffer 2" message is displayed. "Buffer 1" message
>    is _not_ displayed.
> 7. C-x o
> 8. Type something. "Buffer 1" message is displayed. "Buffer 2" message
>    is _not_ displayed.

That's on purpose, yes.

> The current behaviour can potentially break major modes using
> after-change-functions if base buffer and indirect buffer do not have
> the same major mode.

It's currently the responsibility of the code that sets up the indirect
buffer(s) to setup a `before/after-change-functions` in the base buffer
that runs (some of) the `before/after-change-functions` in the indirect
buffer(s) where they are needed.


        Stefan





This bug report was last modified 3 years and 83 days ago.

Previous Next


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