emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Dmitry Gutov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112094: * lisp/whitespace.el (whitespace-font-lock, whitespace-font-lock-mode):
Date: Tue, 19 Mar 2013 19:12:40 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112094
fixes bug: http://debbugs.gnu.org/13817
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Tue 2013-03-19 19:12:40 +0400
message:
  * lisp/whitespace.el (whitespace-font-lock, whitespace-font-lock-mode):
  Remove vars.
  (whitespace-color-on, whitespace-color-off): Use
  `font-lock-fontify-buffer'.
modified:
  lisp/ChangeLog
  lisp/whitespace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-19 12:47:10 +0000
+++ b/lisp/ChangeLog    2013-03-19 15:12:40 +0000
@@ -1,3 +1,10 @@
+2013-03-19  Dmitry Gutov  <address@hidden>
+
+       * whitespace.el (whitespace-font-lock, whitespace-font-lock-mode):
+       Remove vars.
+       (whitespace-color-on, whitespace-color-off): Use
+       `font-lock-fontify-buffer' (Bug#13817).
+
 2013-03-19  Stefan Monnier  <address@hidden>
 
        * mouse.el (mouse--down-1-maybe-follows-link): Fix follow-link

=== modified file 'lisp/whitespace.el'
--- a/lisp/whitespace.el        2013-03-19 05:06:49 +0000
+++ b/lisp/whitespace.el        2013-03-19 15:12:40 +0000
@@ -1861,12 +1861,6 @@
 ;;;; Internal functions
 
 
-(defvar whitespace-font-lock-mode nil
-  "Used to remember whether a buffer had font lock mode on or not.")
-
-(defvar whitespace-font-lock nil
-  "Used to remember whether a buffer initially had font lock on or not.")
-
 (defvar whitespace-font-lock-keywords nil
   "Used to save the value `whitespace-color-on' adds to `font-lock-keywords'.")
 
@@ -2106,8 +2100,6 @@
   ;; prepare local hooks
   (add-hook 'write-file-functions 'whitespace-write-file-hook nil t)
   ;; create whitespace local buffer environment
-  (set (make-local-variable 'whitespace-font-lock-mode) nil)
-  (set (make-local-variable 'whitespace-font-lock) nil)
   (set (make-local-variable 'whitespace-font-lock-keywords) nil)
   (set (make-local-variable 'whitespace-display-table) nil)
   (set (make-local-variable 'whitespace-display-table-was-local) nil)
@@ -2157,8 +2149,6 @@
 (defun whitespace-color-on ()
   "Turn on color visualization."
   (when (whitespace-style-face-p)
-    (unless whitespace-font-lock
-      (setq whitespace-font-lock t))
     ;; save current point and refontify when necessary
     (set (make-local-variable 'whitespace-point)
         (point))
@@ -2172,10 +2162,6 @@
         nil)
     (add-hook 'post-command-hook #'whitespace-post-command-hook nil t)
     (add-hook 'before-change-functions #'whitespace-buffer-changed nil t)
-    ;; turn off font lock
-    (set (make-local-variable 'whitespace-font-lock-mode)
-        font-lock-mode)
-    (font-lock-mode 0)
     ;; Add whitespace-mode color into font lock.
     (setq
      whitespace-font-lock-keywords
@@ -2257,22 +2243,17 @@
                  (whitespace-space-after-tab-regexp 'space)))
               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)))
+    (font-lock-fontify-buffer)))
 
 
 (defun whitespace-color-off ()
   "Turn off color visualization."
   ;; turn off font lock
   (when (whitespace-style-face-p)
-    (font-lock-mode 0)
     (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-remove-keywords nil whitespace-font-lock-keywords)
-    ;; restore original font lock state
-    (font-lock-mode whitespace-font-lock-mode)))
+    (font-lock-fontify-buffer)))
 
 
 (defun whitespace-trailing-regexp (limit)


reply via email to

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