[Top][All Lists]

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

Re: (insert ?\n) spuriously calls before-change-functions twice. Help!

From: Stefan Monnier
Subject: Re: (insert ?\n) spuriously calls before-change-functions twice. Help!
Date: Tue, 05 Jan 2010 14:52:37 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

> I think I've tracked down what's happening.  After inserting the ?\n (any
> other character is just the same), Emacs clears any text properties from
> the new character by calling set_properties.  This, in its turn, invokes
> before-change-functions.  A more detailed call stack is:

Sounds like a bug indeed.

> There doesn't seem to be any system in where the two change hooks are
> invoked.  For example, insert directly calls signal_after_change, yet not
> signal_before_change; surely invocations of these should be paired.

Agreed.  Patch very welcome,

> For CC Mode, I will put in a test for two consecutive invocations of
> before-change-functions without an after-change-functions between them.
> In such a case, I then ignore the second invocation.  I think.

Even if we fix the bug, there can be any number of reasons why the two
hooks may occasionally not be paired, so your hooks should be robust
against such situations.  IOW it's best to try and avoid relying in the
after-hook on info passed from the before hook.


reply via email to

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