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: Alan Mackenzie
Subject: Re: Unbalanced change hooks (part 2)
Date: Mon, 8 Aug 2016 14:36:14 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Eli.

On Tue, Aug 02, 2016 at 09:30:37PM +0300, Eli Zaretskii wrote:
> > Date: Tue, 02 Aug 2016 20:17:35 +0300
> > From: Eli Zaretskii <address@hidden>
> > Cc: address@hidden, address@hidden, address@hidden, address@hidden

> > > Anyhow, it's not just CC Mode.  As already discussed, there are 13 other
> > > files which use before-change-functions, and some of these uses are
> > > going to assume it works as documented, just as CC Mode did.  Sporadic
> > > failures are going to occur in some of these other places, due to those
> > > hook functions sometimes not being called.
 
> > I will believe that when I see specific bug reports about those other
> > packages.

> Btw, I'm slowly but surely arriving to the conclusion that the
> problems we are discussing can only happen when insert-file-contents
> is called with VISIT and REPLACE non-nil, i.e. when reverting a
> buffer.  Do we have any evidence to the contrary?  If we do, can
> someone show or point to such contradicting evidence?

> If my conclusion is correct, then we should probably focus on this
> particular use case and look for a solution for it, as opposed to
> trying to solve some more general problem that seems not to exist.  It
> might be much easier and simpler.

Using buffer-undo-list temporarily to reverse a change and run
c-before-change seems to work well when the undo list is enabled.  When
it isn't enabled, I run into problems which don't look like being solved
easily.

If you're right in supposing that only insert-file-contents with those
particular parameters can cause the omission of the
before-change-functions call, then a solution would be for CC Mode to
advise those commands which call insert-f-c this way.  That advice would
cause the command to test and clear a flag set by CC Mode, and if it was
non-nil, to repeat the command.

Repeating find-file and revert-buffer in these circumstances appears to
work.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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