aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-30 13:08:55 +0100
committerLars Ingebrigtsen2019-10-30 13:16:44 +0100
commite1409379f7ce60eb845a0b9c3a614af4f5fac694 (patch)
tree95136e61c64a5c8222bbb81e7cc7f1b3bcc6ab07 /lisp
parent305dbc7e2be05748039aacb1a3d697f6f64bed4c (diff)
downloademacs-e1409379f7ce60eb845a0b9c3a614af4f5fac694.tar.gz
emacs-e1409379f7ce60eb845a0b9c3a614af4f5fac694.zip
Add a convenience function to be used when working on font locking
* doc/lispref/modes.texi (Font Lock Basics): Document it. * lisp/font-lock.el (font-lock-refontify): New convenience command.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/font-lock.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 9ae082736cc..971e37309e9 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1100,6 +1100,15 @@ accessible portion of the current buffer."
1100 "Function to make sure a region has been fontified. 1100 "Function to make sure a region has been fontified.
1101Called with two arguments BEG and END.") 1101Called with two arguments BEG and END.")
1102 1102
1103(defun font-lock-refontify ()
1104 "Reinitialise the font-lock machinery and re-fontify the buffer.
1105This functions is a convenience functions when developing font
1106locking for a mode, and is not meant to be called from lisp functions."
1107 (interactive)
1108 (declare (interactive-only t))
1109 (setq font-lock-major-mode nil)
1110 (font-lock-ensure))
1111
1103(defun font-lock-ensure (&optional beg end) 1112(defun font-lock-ensure (&optional beg end)
1104 "Make sure the region BEG...END has been fontified. 1113 "Make sure the region BEG...END has been fontified.
1105If the region is not specified, it defaults to the entire accessible 1114If the region is not specified, it defaults to the entire accessible