diff options
| author | Eli Zaretskii | 2015-12-19 16:14:11 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-12-19 16:14:11 +0200 |
| commit | 277d7efd24082f989c72a1a91df6ded8546bfbfb (patch) | |
| tree | 9ebf8a45d3bac985b888a6ff67b1089d1e9586a7 /doc | |
| parent | d30c30b04052aad10f817a3792e8c3719ee06423 (diff) | |
| download | emacs-277d7efd24082f989c72a1a91df6ded8546bfbfb.tar.gz emacs-277d7efd24082f989c72a1a91df6ded8546bfbfb.zip | |
Document new features of Font Lock
* doc/lispref/modes.texi (Other Font Lock Variables): Document
'font-lock-flush-function' and 'font-lock-ensure-function'.
(Font Lock Basics): Document the basic fontification functions
referenced in "Other Font Lock Variables".
* lisp/font-lock.el (font-lock-flush, font-lock-ensure): Doc fix.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/modes.texi | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index a1747707d11..3b8550e13b9 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi | |||
| @@ -2509,6 +2509,53 @@ Search-based fontification happens second. | |||
| 2509 | @node Font Lock Basics | 2509 | @node Font Lock Basics |
| 2510 | @subsection Font Lock Basics | 2510 | @subsection Font Lock Basics |
| 2511 | 2511 | ||
| 2512 | The Font Lock functionality is based on several basic functions. | ||
| 2513 | Each of these calls the function specified by the corresponding | ||
| 2514 | variable. This indirection allows major modes to modify the way | ||
| 2515 | fontification works in the buffers of that mode, and even use the Font | ||
| 2516 | Lock mechanisms for features that have nothing to do with | ||
| 2517 | fontification. (This is why the description below says ``should'' | ||
| 2518 | when it describes what the functions do: the major mode can customize | ||
| 2519 | the values of the corresponding variables to do something entirely | ||
| 2520 | different.) The variables mentioned below are described in @ref{Other | ||
| 2521 | Font Lock Variables}. | ||
| 2522 | |||
| 2523 | @ftable @code | ||
| 2524 | @item font-lock-fontify-buffer | ||
| 2525 | This function should fontify the current buffer's accessible portion, | ||
| 2526 | by calling the function specified by | ||
| 2527 | @code{font-lock-fontify-buffer-function}. | ||
| 2528 | |||
| 2529 | @item font-lock-unfontify-buffer | ||
| 2530 | Used when turning Font Lock off to remove the fontification. Calls | ||
| 2531 | the function specified by @code{font-lock-unfontify-buffer-function}. | ||
| 2532 | |||
| 2533 | @item font-lock-fontify-region beg end &optional loudly | ||
| 2534 | Should fontify the region between @var{beg} and @var{end}. If | ||
| 2535 | @var{loudly} is non-@code{nil}, should display status messages while | ||
| 2536 | fontifying. Calls the function specified by | ||
| 2537 | @code{font-lock-fontify-region-function}. | ||
| 2538 | |||
| 2539 | @item font-lock-unfontify-region beg end | ||
| 2540 | Should remove fontification from the region between @var{beg} and | ||
| 2541 | @var{end}. Calls the function specified by | ||
| 2542 | @code{font-lock-unfontify-region-function}. | ||
| 2543 | |||
| 2544 | @item font-lock-flush &optional beg end | ||
| 2545 | This function should mark the fontification of the region between | ||
| 2546 | @var{beg} and @var{end} as outdated. If not specified or @code{nil}, | ||
| 2547 | @var{beg} and @var{end} default to the beginning and end of the | ||
| 2548 | buffer's accessible portion. Calls the function specified by | ||
| 2549 | @code{font-lock-flush-function}. | ||
| 2550 | |||
| 2551 | @item font-lock-ensure &optional beg end | ||
| 2552 | This function should make sure the region between @var{beg} and | ||
| 2553 | @var{end} has been fontified. The optional arguments @var{beg} and | ||
| 2554 | @var{end} default to the beginning and the end of the buffer's | ||
| 2555 | accessible portion. Calls the function specified by | ||
| 2556 | @code{font-lock-ensure-function}. | ||
| 2557 | @end ftable | ||
| 2558 | |||
| 2512 | There are several variables that control how Font Lock mode highlights | 2559 | There are several variables that control how Font Lock mode highlights |
| 2513 | text. But major modes should not set any of these variables directly. | 2560 | text. But major modes should not set any of these variables directly. |
| 2514 | Instead, they should set @code{font-lock-defaults} as a buffer-local | 2561 | Instead, they should set @code{font-lock-defaults} as a buffer-local |
| @@ -2936,6 +2983,22 @@ arguments, the beginning and end of the region. The default value is | |||
| 2936 | @code{font-lock-default-unfontify-region}. | 2983 | @code{font-lock-default-unfontify-region}. |
| 2937 | @end defvar | 2984 | @end defvar |
| 2938 | 2985 | ||
| 2986 | @defvar font-lock-flush-function | ||
| 2987 | Function to use for declaring that a region's fontification is out of | ||
| 2988 | date. It takes two arguments, the beginning and end of the region. | ||
| 2989 | The default value of this variable is | ||
| 2990 | @code{font-lock-after-change-function}. | ||
| 2991 | @end defvar | ||
| 2992 | |||
| 2993 | @defvar font-lock-ensure-function | ||
| 2994 | Function to use for making sure a region of the current buffer has | ||
| 2995 | been fontified. It is called with two arguments, the beginning and | ||
| 2996 | end of the region. The default value of this variable is a function | ||
| 2997 | that calls @code{font-lock-default-fontify-buffer} if the buffer is | ||
| 2998 | not fontified; the effect is to make sure the entire accessible | ||
| 2999 | portion of the buffer is fontified. | ||
| 3000 | @end defvar | ||
| 3001 | |||
| 2939 | @defun jit-lock-register function &optional contextual | 3002 | @defun jit-lock-register function &optional contextual |
| 2940 | This function tells Font Lock mode to run the Lisp function | 3003 | This function tells Font Lock mode to run the Lisp function |
| 2941 | @var{function} any time it has to fontify or refontify part of the | 3004 | @var{function} any time it has to fontify or refontify part of the |