summaryrefslogtreecommitdiff
path: root/devdocs/elisp/syntactic-font-lock.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/syntactic-font-lock.html
new repository
Diffstat (limited to 'devdocs/elisp/syntactic-font-lock.html')
-rw-r--r--devdocs/elisp/syntactic-font-lock.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/devdocs/elisp/syntactic-font-lock.html b/devdocs/elisp/syntactic-font-lock.html
new file mode 100644
index 00000000..4925bb4e
--- /dev/null
+++ b/devdocs/elisp/syntactic-font-lock.html
@@ -0,0 +1,19 @@
+ <h4 class="subsection">Syntactic Font Lock</h4> <p>Syntactic fontification uses a syntax table (see <a href="syntax-tables">Syntax Tables</a>) to find and highlight syntactically relevant text. If enabled, it runs prior to search-based fontification. The variable <code>font-lock-syntactic-face-function</code>, documented below, determines which syntactic constructs to highlight. There are several variables that affect syntactic fontification; you should set them by means of <code>font-lock-defaults</code> (see <a href="font-lock-basics">Font Lock Basics</a>). </p> <p>Whenever Font Lock mode performs syntactic fontification on a stretch of text, it first calls the function specified by <code>syntax-propertize-function</code>. Major modes can use this to apply <code>syntax-table</code> text properties to override the buffer’s syntax table in special cases. See <a href="syntax-properties">Syntax Properties</a>. </p> <dl> <dt id="font-lock-keywords-only">Variable: <strong>font-lock-keywords-only</strong>
+</dt> <dd><p>If the value of this variable is non-<code>nil</code>, Font Lock does not do syntactic fontification, only search-based fontification based on <code>font-lock-keywords</code>. It is normally set by Font Lock mode based on the <var>keywords-only</var> element in <code>font-lock-defaults</code>. If the value is <code>nil</code>, Font Lock will call <code>jit-lock-register</code> (see <a href="other-font-lock-variables">Other Font Lock Variables</a>) to set up for automatic refontification of buffer text following a modified line to reflect the new syntactic context due to the change. </p></dd>
+</dl> <dl> <dt id="font-lock-syntax-table">Variable: <strong>font-lock-syntax-table</strong>
+</dt> <dd><p>This variable holds the syntax table to use for fontification of comments and strings. It is normally set by Font Lock mode based on the <var>syntax-alist</var> element in <code>font-lock-defaults</code>. If this value is <code>nil</code>, syntactic fontification uses the buffer’s syntax table (the value returned by the function <code>syntax-table</code>; see <a href="syntax-table-functions">Syntax Table Functions</a>). </p></dd>
+</dl> <dl> <dt id="font-lock-syntactic-face-function">Variable: <strong>font-lock-syntactic-face-function</strong>
+</dt> <dd>
+<p>If this variable is non-<code>nil</code>, it should be a function to determine which face to use for a given syntactic element (a string or a comment). </p> <p>The function is called with one argument, the parse state at point returned by <code>parse-partial-sexp</code>, and should return a face. The default value returns <code>font-lock-comment-face</code> for comments and <code>font-lock-string-face</code> for strings (see <a href="faces-for-font-lock">Faces for Font Lock</a>). </p> <p>This variable is normally set through the “other” elements in <code>font-lock-defaults</code>: </p> <div class="lisp"> <pre class="lisp">(setq-local font-lock-defaults
+ `(,python-font-lock-keywords
+ nil nil nil nil
+ (font-lock-syntactic-face-function
+ . python-font-lock-syntactic-face-function)))
+</pre>
+</div> </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/Syntactic-Font-Lock.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Syntactic-Font-Lock.html</a>
+ </p>
+</div>