1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

Improve and correct documentation of 'font-lock-keywords-only'

* lisp/font-lock.el (font-lock-keywords-only):
* doc/lispref/modes.texi (Syntactic Font Lock): Improve
documentation of 'font-lock-keywords-only'.  (Bug#79692)
This commit is contained in:
Eli Zaretskii 2025-10-25 16:57:08 +03:00
parent 53aac6aecd
commit 0974418f2a
2 changed files with 16 additions and 11 deletions

View file

@ -4089,16 +4089,17 @@ table in special cases. @xref{Syntax Properties}.
@defvar font-lock-keywords-only
If the value of this variable is non-@code{nil}, Font Lock does not do
syntactic fontification, only search-based fontification based on
@code{font-lock-keywords}. It is normally set by Font Lock mode based
on the @var{keywords-only} element in @code{font-lock-defaults}. If
the value is @code{nil}, Font Lock will call @code{jit-lock-register}
(@pxref{Other Font Lock Variables}) to set up for automatic
refontification of buffer text following a modified line to reflect
the new syntactic context due to the change.
@code{font-lock-keywords}; this will usually have the effect of not
fontifying comments and strings. This variable is normally set by Font
Lock mode based on the @var{keywords-only} element in
@code{font-lock-defaults}. If the value is @code{nil}, Font Lock will
call @code{jit-lock-register} (@pxref{Other Font Lock Variables}) to set
up for automatic refontification of buffer text following a modified
line to reflect the new syntactic context due to the change.
To use only syntactic fontification, this variable should
be non-@code{nil}, while @code{font-lock-keywords} should be set to
@code{nil} (@pxref{Font Lock Basics}).
To use only syntactic fontification, both this variable and
@code{font-lock-keywords} should be set to @code{nil} (@pxref{Font Lock
Basics}).
@end defvar
@defvar font-lock-syntax-table

View file

@ -527,8 +527,12 @@ This is normally set via `font-lock-add-keywords' and
`font-lock-remove-keywords'.")
(defvar font-lock-keywords-only nil
"Non-nil means Font Lock should not fontify comments or strings.
This is normally set via `font-lock-defaults'.")
"Non-nil means Font Lock should not use syntactic fontifications.
This is normally set via `font-lock-defaults'. Setting it to a
non-nil value will usually cause comments and strings not to be
fontified, unless `font-lock-keywords' are set so as to fontify them,
or some other font-lock mechanism has the same effect even when this
variable is non-nil.")
(defvar-local font-lock-keywords-case-fold-search nil
"Non-nil means the patterns in `font-lock-keywords' are case-insensitive.