emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112090: * lisp/whitespace.el (whites


From: Dmitry Gutov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112090: * lisp/whitespace.el (whitespace-font-lock-keywords): Change description.
Date: Tue, 19 Mar 2013 09:06:49 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112090
fixes bug: http://debbugs.gnu.org/13817
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Tue 2013-03-19 09:06:49 +0400
message:
  * 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'.
modified:
  lisp/ChangeLog
  lisp/whitespace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-19 04:23:36 +0000
+++ b/lisp/ChangeLog    2013-03-19 05:06:49 +0000
@@ -2,6 +2,10 @@
 
        * whitespace.el (whitespace-color-on): Use `prepend' OVERRIDE
        value for `whitespace-line' face (Bug#13875).
+       (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' (Bug#13817).
 
 2013-03-19  Leo Liu  <address@hidden>
 

=== modified file 'lisp/whitespace.el'
--- a/lisp/whitespace.el        2013-03-19 04:23:36 +0000
+++ b/lisp/whitespace.el        2013-03-19 05:06:49 +0000
@@ -1868,7 +1868,7 @@
   "Used to remember whether a buffer initially had font lock on or not.")
 
 (defvar whitespace-font-lock-keywords nil
-  "Used to save locally `font-lock-keywords' value.")
+  "Used to save the value `whitespace-color-on' adds to `font-lock-keywords'.")
 
 
 (defconst whitespace-help-text
@@ -2158,9 +2158,7 @@
   "Turn on color visualization."
   (when (whitespace-style-face-p)
     (unless whitespace-font-lock
-      (setq whitespace-font-lock t
-           whitespace-font-lock-keywords
-           (copy-sequence font-lock-keywords)))
+      (setq whitespace-font-lock t))
     ;; save current point and refontify when necessary
     (set (make-local-variable 'whitespace-point)
         (point))
@@ -2179,8 +2177,8 @@
         font-lock-mode)
     (font-lock-mode 0)
     ;; Add whitespace-mode color into font lock.
-    (font-lock-add-keywords
-     nil
+    (setq
+     whitespace-font-lock-keywords
      `(
        ,@(when (memq 'spaces whitespace-active-style)
            ;; Show SPACEs.
@@ -2257,8 +2255,8 @@
                 ((memq 'space-after-tab::space whitespace-active-style)
                  ;; Show SPACEs after TAB (TABs).
                  (whitespace-space-after-tab-regexp 'space)))
-              1 whitespace-space-after-tab t))))
-     t)
+              1 whitespace-space-after-tab t)))))
+    (font-lock-add-keywords nil whitespace-font-lock-keywords t)
     ;; Now turn on font lock and highlight blanks.
     (font-lock-mode 1)))
 
@@ -2271,8 +2269,8 @@
     (remove-hook 'post-command-hook #'whitespace-post-command-hook t)
     (remove-hook 'before-change-functions #'whitespace-buffer-changed t)
     (when whitespace-font-lock
-      (setq whitespace-font-lock nil
-           font-lock-keywords   whitespace-font-lock-keywords))
+      (setq whitespace-font-lock nil))
+    (font-lock-remove-keywords nil whitespace-font-lock-keywords)
     ;; restore original font lock state
     (font-lock-mode whitespace-font-lock-mode)))
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]