diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 6d7c586e23c..668205d5c04 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -4118,16 +4118,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 diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 0d1bd18ee23..0f3c303316b 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -560,8 +560,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.