diff options
| author | Stefan Monnier | 2006-08-01 19:09:11 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2006-08-01 19:09:11 +0000 |
| commit | 2821e1b6f8af1bab644fedd85ba1405b24f15f42 (patch) | |
| tree | 122ba82646ed44b1894ca02a35399554971af97c | |
| parent | 663e16604c06d8c8961ef5716fc459be5ecfb4ff (diff) | |
| download | emacs-2821e1b6f8af1bab644fedd85ba1405b24f15f42.tar.gz emacs-2821e1b6f8af1bab644fedd85ba1405b24f15f42.zip | |
(font-lock-extend-region-function, font-lock-extend-region):
Move from font-core.el. Simplify.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/font-lock.el | 25 |
2 files changed, 37 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 039c0ad90fc..960200f8721 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,17 @@ | |||
| 1 | 2006-08-01 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2006-08-01 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * font-core.el (font-lock-extend-region-function) | ||
| 4 | (font-lock-extend-region): Move to font-lock.el. | ||
| 5 | |||
| 6 | * font-lock.el (font-lock-extend-region-function) | ||
| 7 | (font-lock-extend-region): Move from font-core.el. Simplify. | ||
| 8 | |||
| 9 | * jit-lock.el (jit-lock-fontify-now): Cause a second redisplay | ||
| 10 | if needed. | ||
| 11 | (jit-lock-start, jit-lock-end): New dynamic scoped vars. | ||
| 12 | (jit-lock-after-change-extend-region-functions): New hook. | ||
| 13 | (jit-lock-after-change): Use it instead of hard-coding font-lock code. | ||
| 14 | |||
| 3 | * font-lock.el (font-lock-extend-jit-lock-region-after-change): New fun. | 15 | * font-lock.el (font-lock-extend-jit-lock-region-after-change): New fun. |
| 4 | (font-lock-turn-on-thing-lock): Use it. | 16 | (font-lock-turn-on-thing-lock): Use it. |
| 5 | 17 | ||
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index ecf54895c1c..201d236f7ac 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -975,6 +975,31 @@ The value of this variable is used when Font Lock mode is turned on." | |||
| 975 | ;; directives correctly and cleanly. (It is the same problem as fontifying | 975 | ;; directives correctly and cleanly. (It is the same problem as fontifying |
| 976 | ;; multi-line strings and comments; regexps are not appropriate for the job.) | 976 | ;; multi-line strings and comments; regexps are not appropriate for the job.) |
| 977 | 977 | ||
| 978 | (defvar font-lock-extend-region-function nil | ||
| 979 | "A function that determines the region to fontify after a change. | ||
| 980 | |||
| 981 | This variable is either nil, or is a function that determines the | ||
| 982 | region to refontify after a change. | ||
| 983 | It is usually set by the major mode via `font-lock-defaults'. | ||
| 984 | Font-lock calls this function after each buffer change. | ||
| 985 | |||
| 986 | The function is given three parameters, the standard BEG, END, and OLD-LEN | ||
| 987 | from `after-change-functions'. It should return either a cons of the beginning | ||
| 988 | and end buffer positions \(in that order) of the region to fontify, or nil | ||
| 989 | \(which directs the caller to fontify a default region). This function | ||
| 990 | should preserve point and the match-data. | ||
| 991 | The region it returns may start or end in the middle of a line.") | ||
| 992 | |||
| 993 | (defun font-lock-extend-region (beg end old-len) | ||
| 994 | "Determine the region to fontify after a buffer change. | ||
| 995 | |||
| 996 | BEG END and OLD-LEN are the standard parameters from `after-change-functions'. | ||
| 997 | The return value is either nil \(which directs the caller to chose the region | ||
| 998 | itself), or a cons of the beginning and end \(in that order) of the region. | ||
| 999 | The region returned may start or end in the middle of a line." | ||
| 1000 | (if font-lock-extend-region-function | ||
| 1001 | (funcall font-lock-extend-region-function beg end old-len))) | ||
| 1002 | |||
| 978 | (defun font-lock-fontify-buffer () | 1003 | (defun font-lock-fontify-buffer () |
| 979 | "Fontify the current buffer the way the function `font-lock-mode' would." | 1004 | "Fontify the current buffer the way the function `font-lock-mode' would." |
| 980 | (interactive) | 1005 | (interactive) |