GNU bug report logs - #78042
31.0.50; Improper sequence of `before/after-change-functions` calls

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 24 Apr 2025 15:40:02 UTC

Severity: normal

Found in version 31.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 78042 <at> debbugs.gnu.org
Subject: Re: bug#78042: Improper sequence of `before/after-change-functions`
 calls
Date: Fri, 25 Apr 2025 10:32:32 +0300
> Date: Thu, 24 Apr 2025 21:35:09 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> The code that runs those hooks is really littered at odd places, with no
> good/standard way to control when to run it and when not.
> I suggest the patch below (which includes a corresponding test).
> Any objection?
> 
> 
> diff --git a/src/coding.c b/src/coding.c
> index 63b0dbeb18b..b4209986918 100644
> --- a/src/coding.c
> +++ b/src/coding.c
> @@ -7363,6 +7363,7 @@ decode_coding (struct coding_system *coding)
>    struct ccl_spec cclspec;
>    int carryover;
>    int i;
> +  specpdl_ref count = SPECPDL_INDEX ();
>  
>    USE_SAFE_ALLOCA;
>  
> @@ -7389,6 +7390,8 @@ decode_coding (struct coding_system *coding)
>  
>        undo_list = BVAR (current_buffer, undo_list);
>        bset_undo_list (current_buffer, Qt);
> +      /* The caller should run *-change-functions over the whole region.  */
> +      specbind (Qinhibit_modification_hooks, Qt);
>      }

How do we make sure this requirement is heeded to?

And how do we document this incompatible change in NEWS?




This bug report was last modified 17 days ago.

Previous Next


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