emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 34eba3e 7/8: Minor cus-theme.el simplifications


From: Stefan Monnier
Subject: [Emacs-diffs] master 34eba3e 7/8: Minor cus-theme.el simplifications
Date: Fri, 13 Jul 2018 11:40:07 -0400 (EDT)

branch: master
commit 34eba3e33334166a3b195f00650dee4674c80a9d
Author: Basil L. Contovounesios <address@hidden>
Commit: Stefan Monnier <address@hidden>

    Minor cus-theme.el simplifications
    
    * lisp/cus-theme.el (custom-new-theme-mode, customize-themes)
    (custom-theme-choose-mode): Use setq-local.
    (customize-create-theme): Ditto.  Use delete-all-overlays.
    (describe-theme-1, custom-theme-summary): Simplify logic.
---
 lisp/cus-theme.el | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 5338995..995c55b 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -47,7 +47,7 @@
 Do not call this mode function yourself.  It is meant for internal use."
   (use-local-map custom-new-theme-mode-map)
   (custom--initialize-widget-variables)
-  (set (make-local-variable 'revert-buffer-function) #'custom-theme-revert))
+  (setq-local revert-buffer-function #'custom-theme-revert))
 (put 'custom-new-theme-mode 'mode-class 'special)
 
 (defvar custom-theme-name nil)
@@ -93,15 +93,14 @@ named *Custom Theme*."
   (switch-to-buffer (get-buffer-create (or buffer "*Custom Theme*")))
   (let ((inhibit-read-only t))
     (erase-buffer)
-    (dolist (ov (overlays-in (point-min) (point-max)))
-      (delete-overlay ov)))
+    (delete-all-overlays))
   (custom-new-theme-mode)
   (make-local-variable 'custom-theme-name)
-  (set (make-local-variable 'custom-theme--save-name) theme)
-  (set (make-local-variable 'custom-theme-faces) nil)
-  (set (make-local-variable 'custom-theme-variables) nil)
-  (set (make-local-variable 'custom-theme-description) "")
-  (set (make-local-variable 'custom-theme--migrate-settings) nil)
+  (setq-local custom-theme--save-name theme)
+  (setq-local custom-theme-faces nil)
+  (setq-local custom-theme-variables nil)
+  (setq-local custom-theme-description "")
+  (setq-local custom-theme--migrate-settings nil)
   (make-local-variable 'custom-theme-insert-face-marker)
   (make-local-variable 'custom-theme-insert-variable-marker)
   (make-local-variable 'custom-theme--listed-faces)
@@ -513,8 +512,7 @@ It includes all faces in list FACES."
                        (condition-case nil
                            (read (current-buffer))
                          (end-of-file nil)))))
-           (and sexp (listp sexp)
-                (eq (car sexp) 'deftheme)
+            (and (eq (car-safe sexp) 'deftheme)
                 (setq doc (nth 2 sexp)))))))
     (princ "\n\nDocumentation:\n")
     (princ (if (stringp doc)
@@ -552,10 +550,10 @@ It includes all faces in list FACES."
 Do not call this mode function yourself.  It is meant for internal use."
   (use-local-map custom-theme-choose-mode-map)
   (custom--initialize-widget-variables)
-  (set (make-local-variable 'revert-buffer-function)
-       (lambda (_ignore-auto noconfirm)
-        (when (or noconfirm (y-or-n-p "Discard current choices? "))
-          (customize-themes (current-buffer))))))
+  (setq-local revert-buffer-function
+              (lambda (_ignore-auto noconfirm)
+                (when (or noconfirm (y-or-n-p "Discard current choices? "))
+                  (customize-themes (current-buffer))))))
 (put 'custom-theme-choose-mode 'mode-class 'special)
 
 ;;;###autoload
@@ -568,7 +566,7 @@ omitted, a buffer named *Custom Themes* is used."
   (let ((inhibit-read-only t))
     (erase-buffer))
   (custom-theme-choose-mode)
-  (set (make-local-variable 'custom--listed-themes) nil)
+  (setq-local custom--listed-themes nil)
   (make-local-variable 'custom-theme-allow-multiple-selections)
   (and (null custom-theme-allow-multiple-selections)
        (> (length custom-enabled-themes) 1)
@@ -662,8 +660,7 @@ Theme files are named *-theme.el in `"))
                          (condition-case nil
                              (read (current-buffer))
                            (end-of-file nil)))))
-             (and sexp (listp sexp)
-                  (eq (car sexp) 'deftheme)
+              (and (eq (car-safe sexp) 'deftheme)
                   (setq doc (nth 2 sexp))))))))
     (cond ((null doc)
           "(no documentation available)")



reply via email to

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