all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* New hook before-region-change-functions wanted
@ 2017-09-08 14:46 Alan Mackenzie
  2017-09-08 15:07 ` John Wiegley
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Alan Mackenzie @ 2017-09-08 14:46 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-09-12 15:46 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-08 14:46 New hook before-region-change-functions wanted Alan Mackenzie
2017-09-08 15:07 ` John Wiegley
2017-09-08 15:10 ` Eli Zaretskii
2017-09-08 15:12   ` Alan Mackenzie
2017-09-08 20:47 ` Dmitry Gutov
2017-09-09 13:46   ` Stefan Monnier
2017-09-08 22:22 ` Richard Stallman
2017-09-09  8:33   ` Alan Mackenzie
2017-09-10  2:44     ` Richard Stallman
2017-09-10  7:37       ` Alan Mackenzie
2017-09-11  1:17         ` Richard Stallman
2017-09-11 16:45           ` Alan Mackenzie
2017-09-12 15:46       ` Andreas Röhler
2017-09-09 13:44 ` Stefan Monnier
2017-09-10 18:53   ` Alan Mackenzie
2017-09-10 22:21     ` Stefan Monnier
2017-09-10 23:02       ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.