From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/region-to-refontify.html | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 devdocs/elisp/region-to-refontify.html (limited to 'devdocs/elisp/region-to-refontify.html') diff --git a/devdocs/elisp/region-to-refontify.html b/devdocs/elisp/region-to-refontify.html new file mode 100644 index 00000000..6553e3dd --- /dev/null +++ b/devdocs/elisp/region-to-refontify.html @@ -0,0 +1,10 @@ +

Region to Fontify after a Buffer Change

When a buffer is changed, the region that Font Lock refontifies is by default the smallest sequence of whole lines that spans the change. While this works well most of the time, sometimes it doesn’t—for example, when a change alters the syntactic meaning of text on an earlier line.

You can enlarge (or even reduce) the region to refontify by setting the following variable:

Variable: font-lock-extend-after-change-region-function +
+

This buffer-local variable is either nil or a function for Font Lock mode to call to determine the region to scan and fontify.

The function is given three parameters, the standard beg, end, and old-len from after-change-functions (see Change Hooks). It should return either a cons of the beginning and end buffer positions (in that order) of the region to fontify, or nil (which means choose the region in the standard way). This function needs to preserve point, the match-data, and the current restriction. The region it returns may start or end in the middle of a line.

Since this function is called after every buffer change, it should be reasonably fast.

+
+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Region-to-Refontify.html +

+
-- cgit v1.2.3