summaryrefslogtreecommitdiff
path: root/devdocs/elisp/region-to-refontify.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/region-to-refontify.html')
-rw-r--r--devdocs/elisp/region-to-refontify.html10
1 files changed, 10 insertions, 0 deletions
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 @@
+ <h4 class="subsubsection">Region to Fontify after a Buffer Change</h4> <p>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. </p> <p>You can enlarge (or even reduce) the region to refontify by setting the following variable: </p> <dl> <dt id="font-lock-extend-after-change-region-function">Variable: <strong>font-lock-extend-after-change-region-function</strong>
+</dt> <dd>
+<p>This buffer-local variable is either <code>nil</code> or a function for Font Lock mode to call to determine the region to scan and fontify. </p> <p>The function is given three parameters, the standard <var>beg</var>, <var>end</var>, and <var>old-len</var> from <code>after-change-functions</code> (see <a href="change-hooks">Change Hooks</a>). It should return either a cons of the beginning and end buffer positions (in that order) of the region to fontify, or <code>nil</code> (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. </p> <p>Since this function is called after every buffer change, it should be reasonably fast. </p>
+</dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Region-to-Refontify.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Region-to-Refontify.html</a>
+ </p>
+</div>