diff options
| author | Eli Zaretskii | 2020-04-08 18:33:52 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-04-08 18:33:52 +0300 |
| commit | 18d1bc0a09db280cc1653706f7f8022786f77c94 (patch) | |
| tree | 8d07889770657d7555af2412f5f57f038004a844 | |
| parent | 08486f4cae8e209cd70bd13534beff336faffd9e (diff) | |
| download | emacs-18d1bc0a09db280cc1653706f7f8022786f77c94.tar.gz emacs-18d1bc0a09db280cc1653706f7f8022786f77c94.zip | |
Improve documentation of 'jit-lock-contextually'
* lisp/jit-lock.el (jit-lock-contextually): Clarify the jit-lock
operation when 'jit-lock-contextually' is non-nil and non-t.
* doc/lispref/modes.texi (Syntactic Font Lock)
(Other Font Lock Variables): Document the relation between
'jit-lock-register', 'font-lock-keywords-only', and syntactic
refontification.
| -rw-r--r-- | doc/lispref/modes.texi | 11 | ||||
| -rw-r--r-- | lisp/jit-lock.el | 22 |
2 files changed, 24 insertions, 9 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index a8ddd45f891..e685391c955 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi | |||
| @@ -3214,6 +3214,11 @@ The optional argument @var{contextual}, if non-@code{nil}, forces Font | |||
| 3214 | Lock mode to always refontify a syntactically relevant part of the | 3214 | Lock mode to always refontify a syntactically relevant part of the |
| 3215 | buffer, and not just the modified lines. This argument can usually be | 3215 | buffer, and not just the modified lines. This argument can usually be |
| 3216 | omitted. | 3216 | omitted. |
| 3217 | |||
| 3218 | When Font Lock is activated in a buffer, it calls this function with a | ||
| 3219 | non-@code{nil} value of @var{contextual} if the value of | ||
| 3220 | @code{font-lock-keywords-only} (@pxref{Syntactic Font Lock}) is | ||
| 3221 | @code{nil}. | ||
| 3217 | @end defun | 3222 | @end defun |
| 3218 | 3223 | ||
| 3219 | @defun jit-lock-unregister function | 3224 | @defun jit-lock-unregister function |
| @@ -3380,7 +3385,11 @@ table in special cases. @xref{Syntax Properties}. | |||
| 3380 | If the value of this variable is non-@code{nil}, Font Lock does not do | 3385 | If the value of this variable is non-@code{nil}, Font Lock does not do |
| 3381 | syntactic fontification, only search-based fontification based on | 3386 | syntactic fontification, only search-based fontification based on |
| 3382 | @code{font-lock-keywords}. It is normally set by Font Lock mode based | 3387 | @code{font-lock-keywords}. It is normally set by Font Lock mode based |
| 3383 | on the @var{keywords-only} element in @code{font-lock-defaults}. | 3388 | on the @var{keywords-only} element in @code{font-lock-defaults}. If |
| 3389 | the value is @code{nil}, Font Lock will call @code{jit-lock-register} | ||
| 3390 | (@pxref{Other Font Lock Variables}) to set up for automatic | ||
| 3391 | refontification of buffer text following a modified line to reflect | ||
| 3392 | the new syntactic context due to the change. | ||
| 3384 | @end defvar | 3393 | @end defvar |
| 3385 | 3394 | ||
| 3386 | @defvar font-lock-syntax-table | 3395 | @defvar font-lock-syntax-table |
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index d73cd74da0b..95cc02197c1 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el | |||
| @@ -101,16 +101,22 @@ See also `jit-lock-stealth-nice'." | |||
| 101 | 101 | ||
| 102 | (defvaralias 'jit-lock-defer-contextually 'jit-lock-contextually) | 102 | (defvaralias 'jit-lock-defer-contextually 'jit-lock-contextually) |
| 103 | (defcustom jit-lock-contextually 'syntax-driven | 103 | (defcustom jit-lock-contextually 'syntax-driven |
| 104 | "If non-nil, means fontification should be syntactically true. | 104 | "If non-nil, fontification should be syntactically true. |
| 105 | If nil, means fontification occurs only on those lines modified. This | 105 | If nil, refontification occurs only on lines that were modified. This |
| 106 | means where modification on a line causes syntactic change on subsequent lines, | 106 | means where modification on a line causes syntactic change on subsequent lines, |
| 107 | those subsequent lines are not refontified to reflect their new context. | 107 | those subsequent lines are not refontified to reflect their new context. |
| 108 | If t, means fontification occurs on those lines modified and all | 108 | If t, fontification occurs on those lines modified and all subsequent lines. |
| 109 | subsequent lines. This means those subsequent lines are refontified to reflect | 109 | This means those subsequent lines are refontified to reflect their new |
| 110 | their new syntactic context, after `jit-lock-context-time' seconds. | 110 | syntactic context, after `jit-lock-context-time' seconds. |
| 111 | If any other value, e.g., `syntax-driven', means syntactically true | 111 | If any other value, e.g., `syntax-driven', it means refontification of |
| 112 | fontification occurs only if syntactic fontification is performed using the | 112 | subsequent lines to reflect their new syntactic context may or may not |
| 113 | buffer mode's syntax table, i.e., only if `font-lock-keywords-only' is nil. | 113 | occur after `jit-lock-context-time', depending on the the font-lock |
| 114 | definitions of the buffer. Specifically, if `font-lock-keywords-only' | ||
| 115 | is nil in a buffer, which generally means the syntactic fontification | ||
| 116 | is done using the buffer mode's syntax table, the syntactic | ||
| 117 | refontification will be triggered (because in that case font-lock | ||
| 118 | calls `jit-lock-register' to set up for syntactic refontification, | ||
| 119 | and sets the buffer-local value of `jit-lock-contextually' to t). | ||
| 114 | 120 | ||
| 115 | The value of this variable is used when JIT Lock mode is turned on." | 121 | The value of this variable is used when JIT Lock mode is turned on." |
| 116 | :type '(choice (const :tag "never" nil) | 122 | :type '(choice (const :tag "never" nil) |