emacs-diffs
[Top][All Lists]
Advanced

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

master 8a42354 2/4: Prefer setq-local in whitespace.el


From: Stefan Kangas
Subject: master 8a42354 2/4: Prefer setq-local in whitespace.el
Date: Mon, 7 Dec 2020 05:30:40 -0500 (EST)

branch: master
commit 8a42354b0a00e47e13fa4068d99afef0e05da25e
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Prefer setq-local in whitespace.el
    
    * lisp/whitespace.el (whitespace-turn-on, whitespace-color-on): Prefer
    setq-local.
---
 lisp/whitespace.el | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 02ee7bc..814f3e5 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1986,13 +1986,13 @@ resultant list will be returned."
   ;; 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-keywords) nil)
-  (set (make-local-variable 'whitespace-display-table) nil)
-  (set (make-local-variable 'whitespace-display-table-was-local) nil)
-  (set (make-local-variable 'whitespace-active-style)
-       (if (listp whitespace-style)
-          whitespace-style
-        (list whitespace-style)))
+  (setq-local whitespace-font-lock-keywords nil)
+  (setq-local whitespace-display-table nil)
+  (setq-local whitespace-display-table-was-local nil)
+  (setq-local whitespace-active-style
+              (if (listp whitespace-style)
+                 whitespace-style
+               (list whitespace-style)))
   ;; turn on whitespace
   (when whitespace-active-style
     (whitespace-color-on)
@@ -2034,19 +2034,14 @@ resultant list will be returned."
   "Turn on color visualization."
   (when (whitespace-style-face-p)
     ;; save current point and refontify when necessary
-    (set (make-local-variable 'whitespace-point)
-         (point))
+    (setq-local whitespace-point (point))
     (setq whitespace-point--used
           (let ((ol (make-overlay (point) (point) nil nil t)))
             (delete-overlay ol) ol))
-    (set (make-local-variable 'whitespace-font-lock-refontify)
-        0)
-    (set (make-local-variable 'whitespace-bob-marker)
-        (point-min-marker))
-    (set (make-local-variable 'whitespace-eob-marker)
-        (point-max-marker))
-    (set (make-local-variable 'whitespace-buffer-changed)
-        nil)
+    (setq-local whitespace-font-lock-refontify 0)
+    (setq-local whitespace-bob-marker (point-min-marker))
+    (setq-local whitespace-eob-marker (point-max-marker))
+    (setq-local whitespace-buffer-changed nil)
     (add-hook 'post-command-hook #'whitespace-post-command-hook nil t)
     (add-hook 'before-change-functions #'whitespace-buffer-changed nil t)
     ;; Add whitespace-mode color into font lock.



reply via email to

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