diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-03-30 21:33:20 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-03-30 21:33:20 -0400 |
commit | bc9a6fcd29cd2e35a34e42f6e8b9492c98c1560f (patch) | |
tree | e44d050c05b9104e1259aa73d7acf9dde443f19a /lisp/font-lock.el | |
parent | 2e4b0c98a77657e787e04ae680403b187b271c21 (diff) | |
download | emacs-bc9a6fcd29cd2e35a34e42f6e8b9492c98c1560f.tar.gz emacs-bc9a6fcd29cd2e35a34e42f6e8b9492c98c1560f.tar.bz2 emacs-bc9a6fcd29cd2e35a34e42f6e8b9492c98c1560f.zip |
Let jit-lock know the result of font-lock-extend-region-functions.
* lisp/jit-lock.el (jit-lock--run-functions): New function.
(jit-lock-fontify-now): Use it. Handle fontification bounds more
precisely in case the backend functions fontify more than requested.
Don't round up to whole lines since that shouldn't be needed
any more.
* lisp/font-lock.el (font-lock-fontify-region-function): Adjust docstring.
(font-lock-inhibit-thing-lock): Make obsolete.
(font-lock-default-fontify-region): Return the bounds actually used.
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-validate/fix-slot-value):
Fix compilation error.
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r-- | lisp/font-lock.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 6c8392bc090..96b290e34f4 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -585,11 +585,14 @@ This is normally set via `font-lock-defaults'.") This is used when turning off Font Lock mode. This is normally set via `font-lock-defaults'.") -(defvar font-lock-fontify-region-function 'font-lock-default-fontify-region +(defvar font-lock-fontify-region-function #'font-lock-default-fontify-region "Function to use for fontifying a region. It should take two args, the beginning and end of the region, and an optional third arg VERBOSE. If VERBOSE is non-nil, the function should print status -messages. This is normally set via `font-lock-defaults'.") +messages. This is normally set via `font-lock-defaults'. +If it fontifies a larger region, it should ideally return a list of the form +\(jit-lock-bounds BEG . END) indicating the bounds of the region actually +fontified.") (defvar font-lock-unfontify-region-function 'font-lock-default-unfontify-region "Function to use for unfontifying a region. @@ -600,6 +603,7 @@ This is normally set via `font-lock-defaults'.") "List of Font Lock mode related modes that should not be turned on. Currently, valid mode names are `fast-lock-mode', `jit-lock-mode' and `lazy-lock-mode'. This is normally set via `font-lock-defaults'.") +(make-obsolete-variable 'font-lock-inhibit-thing-lock nil "25.1") (defvar-local font-lock-multiline nil "Whether font-lock should cater to multiline keywords. @@ -935,7 +939,7 @@ The value of this variable is used when Font Lock mode is turned on." ;; Don't fontify eagerly (and don't abort if the buffer is large). (set (make-local-variable 'font-lock-fontified) t) ;; Use jit-lock. - (jit-lock-register 'font-lock-fontify-region + (jit-lock-register #'font-lock-fontify-region (not font-lock-keywords-only)) ;; Tell jit-lock how we extend the region to refontify. (add-hook 'jit-lock-after-change-extend-region-functions @@ -1220,7 +1224,8 @@ This function is the default `font-lock-fontify-region-function'." (font-lock-fontify-syntactic-keywords-region start end))) (unless font-lock-keywords-only (font-lock-fontify-syntactically-region beg end loudly)) - (font-lock-fontify-keywords-region beg end loudly))))) + (font-lock-fontify-keywords-region beg end loudly) + `(jit-lock-bounds ,beg . ,end))))) ;; The following must be rethought, since keywords can override fontification. ;; ;; Now scan for keywords, but not if we are inside a comment now. |