emacs-devel
[Top][All Lists]
Advanced

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

New hook before-region-change-functions wanted


From: Alan Mackenzie
Subject: New hook before-region-change-functions wanted
Date: Fri, 8 Sep 2017 14:46:57 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

Hello, Emacs.

I would like to implement a new abnormal hook,
before-change-region-functions.  It would be called just before a change
in the buffer's restriction (i.e., from widen and from narrow-to-region)
and each function on it would take two parameters, the beginning and end
of the new region being set.

The reason I want it is as part of the solution to bug #22983
(syntax-ppss returns wrong result).  I envisage two (or possibly more)
mutually independent caches, and a switch being made to the appropriate
cache when the region is changed.  This switch would be made inside a
function on before-change-region-functions.

While it is true that this hook is not absolutely necessary, in that the
cache switch could be made by the first call to syntax-ppss after the
region change, it makes the cache switch clean.  In particular, the
cache will always be in synch with the region, and any functions which
examine the cache at an arbitrary time (for example, jit-lock
functions), will get the right cache.  The mechanism will also work a
little faster with the new hook than without it, given that changes of
restriction are more rarely effected than syntax-ppss is called.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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