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: Mon, 08 Aug 2016 20:17:42 +0300

> Date: Mon, 8 Aug 2016 16:54:49 +0000
> Cc: address@hidden, address@hidden, address@hidden, address@hidden
> From: Alan Mackenzie <address@hidden>
> 
> > 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.

So, if worse comes to worst, you could trigger such a complete scan
after revert-buffer, e.g. in a specialized revert-buffer-function.

Do you have a way of completely forgetting everything about a certain
region of buffer text, and rescanning that region anew?  If so, would
it work to do this in c-after-change, since its arguments tell you
both the old and the new buffer positions where the changes were made?
If this works, it might be less expensive then rescanning the entire
buffer.

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

I don't understand how this could work reliably: it has the same
problems as the original recipe.  Am I missing something?



reply via email to

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