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 16:54:49 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Eli.

On Mon, Aug 08, 2016 at 06:42:20PM +0300, Eli Zaretskii wrote:
> > Date: Mon, 8 Aug 2016 14:36:14 +0000
> > Cc: address@hidden, address@hidden, address@hidden, address@hidden
> > From: Alan Mackenzie <address@hidden>

> > 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.

> I thought our policy was to leave advising to users, and never do
> that in core.

I suppose so.  In that case, I can do the advising in standalone CC
Mode, but we hard code a solution in savannah master.

> I asked a few questions a couple of days ago, with the purpose of
> coming up with idea for how to solve this issue in a more acceptable
> way.  You never answered them.  Could you please humor me?

Sorry about that.  I think you mean the following.  Otherwise, would you
please clarify.

#########################################################################

>> Things are cached in text properties on the text itself.  These
>> properties can only be examined before the text is deleted.

> OK, so you must also have code that computes and places those
> properties, right?

Yes.

> What triggers that code?

before/after-change-functions.  For example, in C++ Mode, if a "<"
template delimiter is about is in a region about to be deleted, and the
matching ">" is after that region, the pertinent function called from
c-before-change (c-before-change-check-<>-operators) removes the
syntax-table properties from each of them.

> E.g., when a file is visited, what invokes that code, and how much of
> the buffer it processes when invoked?

On a newly visited file, the entire buffer is scanned by (the components
of) c-before-change and c-after-change, setting the text properties.

> If it doesn't process the entire buffer in one go, how is it invoked
> to process the rest of the buffer?

It does process the entire buffer in one go.

#########################################################################

> If nothing better comes up, I'd prefer to do something special in
> insert-file-contents, specifically for CC Mode, rather than going to
> the extremes you describe above and in the other messages.

What I'm looking at at the moment is calling revert-buffer a second time
if CC Mode signals a missing before-change-functions the first time.
After the test scenario, M-x revert-buffer works, so it might work if
called from the code instead.

> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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