aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2013-03-19 09:06:49 +0400
committerDmitry Gutov2013-03-19 09:06:49 +0400
commit7ec31b02ef777b3174ca5be807d2987c69f061cd (patch)
tree9f2974e7f2958b1b140307703cbf6fa72caad031
parentbad98418bf75efc6dd8ac393157413bc6ef769b4 (diff)
downloademacs-7ec31b02ef777b3174ca5be807d2987c69f061cd.tar.gz
emacs-7ec31b02ef777b3174ca5be807d2987c69f061cd.zip
* lisp/whitespace.el (whitespace-font-lock-keywords): Change description.
(whitespace-color-on): Don't save `font-lock-keywords' value, save the constructed keywords instead. (whitespace-color-off): Use `font-lock-remove-keywords'. Fixes: debbugs:13817
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/whitespace.el18
2 files changed, 12 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 85e89566b4d..a64703c3d24 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,10 @@
2 2
3 * whitespace.el (whitespace-color-on): Use `prepend' OVERRIDE 3 * whitespace.el (whitespace-color-on): Use `prepend' OVERRIDE
4 value for `whitespace-line' face (Bug#13875). 4 value for `whitespace-line' face (Bug#13875).
5 (whitespace-font-lock-keywords): Change description.
6 (whitespace-color-on): Don't save `font-lock-keywords' value, save
7 the constructed keywords instead.
8 (whitespace-color-off): Use `font-lock-remove-keywords' (Bug#13817).
5 9
62013-03-19 Leo Liu <sdl.web@gmail.com> 102013-03-19 Leo Liu <sdl.web@gmail.com>
7 11
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 382d6f482e2..0346d17954a 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1868,7 +1868,7 @@ cleaning up these problems."
1868 "Used to remember whether a buffer initially had font lock on or not.") 1868 "Used to remember whether a buffer initially had font lock on or not.")
1869 1869
1870(defvar whitespace-font-lock-keywords nil 1870(defvar whitespace-font-lock-keywords nil
1871 "Used to save locally `font-lock-keywords' value.") 1871 "Used to save the value `whitespace-color-on' adds to `font-lock-keywords'.")
1872 1872
1873 1873
1874(defconst whitespace-help-text 1874(defconst whitespace-help-text
@@ -2158,9 +2158,7 @@ resultant list will be returned."
2158 "Turn on color visualization." 2158 "Turn on color visualization."
2159 (when (whitespace-style-face-p) 2159 (when (whitespace-style-face-p)
2160 (unless whitespace-font-lock 2160 (unless whitespace-font-lock
2161 (setq whitespace-font-lock t 2161 (setq whitespace-font-lock t))
2162 whitespace-font-lock-keywords
2163 (copy-sequence font-lock-keywords)))
2164 ;; save current point and refontify when necessary 2162 ;; save current point and refontify when necessary
2165 (set (make-local-variable 'whitespace-point) 2163 (set (make-local-variable 'whitespace-point)
2166 (point)) 2164 (point))
@@ -2179,8 +2177,8 @@ resultant list will be returned."
2179 font-lock-mode) 2177 font-lock-mode)
2180 (font-lock-mode 0) 2178 (font-lock-mode 0)
2181 ;; Add whitespace-mode color into font lock. 2179 ;; Add whitespace-mode color into font lock.
2182 (font-lock-add-keywords 2180 (setq
2183 nil 2181 whitespace-font-lock-keywords
2184 `( 2182 `(
2185 ,@(when (memq 'spaces whitespace-active-style) 2183 ,@(when (memq 'spaces whitespace-active-style)
2186 ;; Show SPACEs. 2184 ;; Show SPACEs.
@@ -2257,8 +2255,8 @@ resultant list will be returned."
2257 ((memq 'space-after-tab::space whitespace-active-style) 2255 ((memq 'space-after-tab::space whitespace-active-style)
2258 ;; Show SPACEs after TAB (TABs). 2256 ;; Show SPACEs after TAB (TABs).
2259 (whitespace-space-after-tab-regexp 'space))) 2257 (whitespace-space-after-tab-regexp 'space)))
2260 1 whitespace-space-after-tab t)))) 2258 1 whitespace-space-after-tab t)))))
2261 t) 2259 (font-lock-add-keywords nil whitespace-font-lock-keywords t)
2262 ;; Now turn on font lock and highlight blanks. 2260 ;; Now turn on font lock and highlight blanks.
2263 (font-lock-mode 1))) 2261 (font-lock-mode 1)))
2264 2262
@@ -2271,8 +2269,8 @@ resultant list will be returned."
2271 (remove-hook 'post-command-hook #'whitespace-post-command-hook t) 2269 (remove-hook 'post-command-hook #'whitespace-post-command-hook t)
2272 (remove-hook 'before-change-functions #'whitespace-buffer-changed t) 2270 (remove-hook 'before-change-functions #'whitespace-buffer-changed t)
2273 (when whitespace-font-lock 2271 (when whitespace-font-lock
2274 (setq whitespace-font-lock nil 2272 (setq whitespace-font-lock nil))
2275 font-lock-keywords whitespace-font-lock-keywords)) 2273 (font-lock-remove-keywords nil whitespace-font-lock-keywords)
2276 ;; restore original font lock state 2274 ;; restore original font lock state
2277 (font-lock-mode whitespace-font-lock-mode))) 2275 (font-lock-mode whitespace-font-lock-mode)))
2278 2276