aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2009-12-28 20:34:10 +0100
committerTassilo Horn2009-12-28 20:34:10 +0100
commit543f553a8db74d2e450d966544013478a2ced902 (patch)
treea98314fb52a658419da1252b06813321612dc8b1
parentac859983d70c71997a295239e2bc917130a6bd97 (diff)
downloademacs-543f553a8db74d2e450d966544013478a2ced902.tar.gz
emacs-543f553a8db74d2e450d966544013478a2ced902.zip
* font-lock.el (font-lock-refresh-defaults): New function, which
can be used to let font-lock react to external changes in variables like font-lock-defaults and keywords. See http://thread.gmane.org/gmane.emacs.devel/118777/focus=118802
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/font-lock.el17
2 files changed, 24 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a454f132733..236f2fe35ad 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12009-12-28 Tassilo Horn <tassilo@member.fsf.org>
2
3 * font-lock.el (font-lock-refresh-defaults): New function, which
4 can be used to let font-lock react to external changes in
5 variables like font-lock-defaults and keywords.
6 See http://thread.gmane.org/gmane.emacs.devel/118777/focus=118802
7
12009-12-28 Dan Nicolaescu <dann@ics.uci.edu> 82009-12-28 Dan Nicolaescu <dann@ics.uci.edu>
2 9
3 * vc-rcs.el (vc-rcs-register): Fix registering a specific version. 10 * vc-rcs.el (vc-rcs-register): Fix registering a specific version.
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 95d061b3024..c2fd86ed726 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1767,6 +1767,23 @@ A LEVEL of nil is equal to a LEVEL of 0, a LEVEL of t is equal to
1767 1767
1768(defvar font-lock-set-defaults nil) ; Whether we have set up defaults. 1768(defvar font-lock-set-defaults nil) ; Whether we have set up defaults.
1769 1769
1770(defun font-lock-refresh-defaults ()
1771 "Restart fontification in current buffer after recomputing from defaults.
1772Recompute fontification variables using `font-lock-defaults' (or,
1773if nil, using `font-lock-defaults-alist') and
1774`font-lock-maximum-decoration'. Then restart fontification.
1775
1776Use this function when you have changed any of the above
1777variables directly.
1778
1779Note: This function will erase modifications done by
1780`font-lock-add-keywords' or `font-lock-remove-keywords', but will
1781preserve `hi-lock-mode' highlighting patterns."
1782 (let ((hi-lock--inhibit-font-lock-hook t))
1783 (font-lock-mode -1))
1784 (kill-local-variable 'font-lock-set-defaults)
1785 (font-lock-mode 1))
1786
1770(defvar font-lock-mode-major-mode) 1787(defvar font-lock-mode-major-mode)
1771(defun font-lock-set-defaults () 1788(defun font-lock-set-defaults ()
1772 "Set fontification defaults appropriately for this mode. 1789 "Set fontification defaults appropriately for this mode.