emacs-devel
[Top][All Lists]
Advanced

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

Re: Unbalanced change hooks (part 2)


From: Eli Zaretskii
Subject: Re: Unbalanced change hooks (part 2)
Date: Tue, 02 Aug 2016 22:25:45 +0300

> Date: Tue, 2 Aug 2016 19:00:24 +0000
> Cc: address@hidden, address@hidden, address@hidden, address@hidden
> From: Alan Mackenzie <address@hidden>
> 
> > > I thought we'd already agreed that no rational design would omit the
> > > before-change-hooks call from an arbitrary subset of changes.
> 
> > No, I don't think there was such an agreement.  The set of changes for
> > which before-change-functions are not called is not arbitrary.
> 
> Would you please characterize these circumstances in a way useful for
> people considering the use of before-change-functions.  If you like, I
> can then modify Elisp's "Change Hooks" with that information.

Let's leave this for later, and focus on solving the immediate problem
at hand.

> > If such an original design existed in the distant past, it was long
> > ago (as in 20 years or more) replaced with what we basically see
> > today, where every change always triggers a call to
> > after-change-functions, but only some (the majority, but not all)
> > trigger the call to before-change-functions.
> 
> >From the point of view of design, what is the benefit in not calling
> b-c-f for that subset of circumstances?

I'm not yet 100% sure, but I'm getting there.  In any case, the logic
is very clear, although its rationale I only half-understand for now.

> > The ELisp manual doesn't promise that these hooks will be called in
> > balanced pairs.
> 
> It does.  before-change-functions is described as:
> 
>     .... a list of functions to call before any buffer modification.
> 
> after-change-functions is likewise described as:
> 
>     .... a list of functions to call after any buffer modification.
> 
> .  It may not explicitly say they are paired, but it says each hook is
> called after every modification.  This naturally pairs them up.

Like I said, sticking to such a strict interpretation would cause our
code to be unnecessarily much too complex.  The modification hooks are
supposed to tell you that changes are about to be, or have been, made
in a region, but that doesn't necessarily mean you will have a single
call of before- and after- hook for each of the partial changes.



reply via email to

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