Subject: bug#66181: Subject: 29.1; Occur changes don't affect Dired buffer

From: Eli Zaretskii <[email-masked]>
Date: Mon, 25 Sep 2023 19:39:25 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 25 Sep 2023 09:52:36 -0400
> 
> >> > Stefan, do we have any safe means of running the hooks in this case?
> >> > I thought about running the buffer-local values of before- and
> >> > after-change-functions by hand from occur-after-change-function,
> >> > skipping the t entry, but I'm not sure this is safe.  It is certainly
> >> > messy, so if there's a more elegant way, I'd like to know.
> >> 
> >> Arguably, the `inhibit-modification-hooks` let-binding that surrounds
> >> code run from within modification hooks should be buffer-local, which
> >> would solve these problems, AFAIK.
> >
> > Not sure I understand: we let-bind inhibit-modification-hooks in C,
> > via specbind, and that binds the global value, since
> > inhibit-modification-hooks is not a per-buffer variable.  Or am I
> > missing something.
> 
> You're right that's what we currently do.
> 
> > Do you mean we should add a new specbind_local function that makes
> > only a buffer-local let-binding?
> 
> For example, yes.  Or we could call `Fmake_local_variable` before the
> `specbind`, or we could make `inhibit-modification-hooks` into one of
> those vars that are "really always" buffer-local, like `major-mode`,
> `buffer-file-name` and a few others.

Would it work (and be okay) to make inhibit-modification-hooks
buffer-local in a buffer in which occur-edit-mode is turned on?