[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unbalanced change hooks (part 2) [Documentation fix still remaining]
From: |
Stefan Monnier |
Subject: |
Re: Unbalanced change hooks (part 2) [Documentation fix still remaining] |
Date: |
Tue, 30 Aug 2016 14:14:51 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> Normally the before-change-functions and the after-change-functions
> hooks are called in balanced pairs around each buffer change,
I could agree with that.
> enabling state to be determined in a before-change function and used in an
> after-change function.
But this encourages reliance on this pairing, even though experience
shows that it's better to try not to rely on it (both in the sense that
I personally believe that it results in better designs, and in the
sense that such designs will break down in the non-"normal" case).
So I'm strongly opposed to such statements.
> However on rare occasions, before-change-functions is not called
> before a buffer change and
That would be documenting bugs as being normal behavior.
> after-change-functions is thus called twice in succession. Your
> program should be ready to deal with such an occurrence.
Two successive calls of a-c-f are indeed acceptable and code should be
ready to deal with such occurrence, but only because a previous b-c-f
call covered both changes, not because b-c-f failed to be called.
Stefan