Subject: Re: bug#30823: 25.3; modification-hooks of overlays are not run in some cases

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 Aug 2018 19:34:04 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: Noam Postavsky <[email-masked]>, [email-masked],
>         [email-masked]
> Date: Sun, 19 Aug 2018 16:46:09 -0400
> 
> >> Coming back to this, there is also the possibility of passing true for
> >> PREPARE, though I'm not sure if that would be better or worse.  Any
> >> comments?
> > AFAIR, we never want to use PREPARE = true when dealing with the
> > *Messages* buffer, you can see that elsewhere in message_dolog.  The
> > reason I believe is that we might trigger infinite recursion if the
> > modification hooks log a message for some reason.
> 
> The current code already allows running `message` in this way (and that
> leads to suboptimal behavior, tho nothing really serious).  I think we
> should use `true` here and then actively try and detect nested uses of
> `message` and deal with those in an ad-hoc way (e.g. bind
> inhibit-modification-hooks during the nested call so the recursion is at
> most 2 deep).

That doesn't cater to some of the uses of 'message', as I explained in
the discussion to which you pointed.

> The patch I sent in
> https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00600.html
> went in this direction and my experimentation with it did not encounter
> any serious problem.  IOW I think the comment near message_dolog is
> largely out of date.

Once again, interested readers may wish to read the whole discussion,
because some of the issues raised there are not taken care of by this
function, and some of the comment is justified, as I tried to explain.