[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master c59e878: Inhibit modification hooks when saving eieio-persist

From: Stefan Monnier
Subject: Re: master c59e878: Inhibit modification hooks when saving eieio-persistent's
Date: Sat, 02 May 2020 18:09:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> >> Not necessarily: it could be too slow (because of the cost to
>> >> enter/leave `combine-change-calls`).
>> > You mean when it's called in iteration?  That makes sense.
>> Another reason is that we don't know that `object-write` is only called
>> in temp buffers.
> I understand that answer for `inhibit-modification-hooks', but not for
> `combine-change-calls' - what is bad about combining change calls when
> writing to an arbitrary buffer?

`combine-change-calls` is a bit less blunt, but it should still be used
with care.

For example, if you don't run the buffer modification hooks in the body,
it means that the `syntax-ppss` and `syntax-propertize` won't be
properly flushed, so if you use them interspersed with buffer
modifications you may get incorrect results.

As this is a common problem, `combine-change-calls` is careful to
preserve the `syntax-ppss-flush-cache` on `before-change-functions`, but
it shows the risk of what can happen with other change-functions.

> BTW, while we are on the subject, I don't understand this sentence in
> the doc of the related `combine-after-change-calls' (which I don't
> suggest to use):
> | If BODY makes changes in the buffer, they are recorded and the
> | functions on `after-change-functions' are called several times when
> | BODY is finished.
> Why several times - I thought this is what the thing would avoid?  And
> how often is "several times"?

I think it's as many times as there were modifications, tho I haven't
looked at this code in too many years to remember for sure.
I'm not sure why it was designed that way.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]