aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBasil L. Contovounesios2018-05-10 03:08:10 +0100
committerStefan Monnier2018-07-13 11:28:16 -0400
commit34eba3e33334166a3b195f00650dee4674c80a9d (patch)
tree55bd5a572549b958fe748ff27e95bfff689aaffa
parentb16f08015f69ecb1e665411533e6f8b64ccb847e (diff)
downloademacs-34eba3e33334166a3b195f00650dee4674c80a9d.tar.gz
emacs-34eba3e33334166a3b195f00650dee4674c80a9d.zip
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.
-rw-r--r--lisp/cus-theme.el31
1 files changed, 14 insertions, 17 deletions
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 53389956ad2..995c55b2b20 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -47,7 +47,7 @@
47Do not call this mode function yourself. It is meant for internal use." 47Do not call this mode function yourself. It is meant for internal use."
48 (use-local-map custom-new-theme-mode-map) 48 (use-local-map custom-new-theme-mode-map)
49 (custom--initialize-widget-variables) 49 (custom--initialize-widget-variables)
50 (set (make-local-variable 'revert-buffer-function) #'custom-theme-revert)) 50 (setq-local revert-buffer-function #'custom-theme-revert))
51(put 'custom-new-theme-mode 'mode-class 'special) 51(put 'custom-new-theme-mode 'mode-class 'special)
52 52
53(defvar custom-theme-name nil) 53(defvar custom-theme-name nil)
@@ -93,15 +93,14 @@ named *Custom Theme*."
93 (switch-to-buffer (get-buffer-create (or buffer "*Custom Theme*"))) 93 (switch-to-buffer (get-buffer-create (or buffer "*Custom Theme*")))
94 (let ((inhibit-read-only t)) 94 (let ((inhibit-read-only t))
95 (erase-buffer) 95 (erase-buffer)
96 (dolist (ov (overlays-in (point-min) (point-max))) 96 (delete-all-overlays))
97 (delete-overlay ov)))
98 (custom-new-theme-mode) 97 (custom-new-theme-mode)
99 (make-local-variable 'custom-theme-name) 98 (make-local-variable 'custom-theme-name)
100 (set (make-local-variable 'custom-theme--save-name) theme) 99 (setq-local custom-theme--save-name theme)
101 (set (make-local-variable 'custom-theme-faces) nil) 100 (setq-local custom-theme-faces nil)
102 (set (make-local-variable 'custom-theme-variables) nil) 101 (setq-local custom-theme-variables nil)
103 (set (make-local-variable 'custom-theme-description) "") 102 (setq-local custom-theme-description "")
104 (set (make-local-variable 'custom-theme--migrate-settings) nil) 103 (setq-local custom-theme--migrate-settings nil)
105 (make-local-variable 'custom-theme-insert-face-marker) 104 (make-local-variable 'custom-theme-insert-face-marker)
106 (make-local-variable 'custom-theme-insert-variable-marker) 105 (make-local-variable 'custom-theme-insert-variable-marker)
107 (make-local-variable 'custom-theme--listed-faces) 106 (make-local-variable 'custom-theme--listed-faces)
@@ -513,8 +512,7 @@ It includes all faces in list FACES."
513 (condition-case nil 512 (condition-case nil
514 (read (current-buffer)) 513 (read (current-buffer))
515 (end-of-file nil))))) 514 (end-of-file nil)))))
516 (and sexp (listp sexp) 515 (and (eq (car-safe sexp) 'deftheme)
517 (eq (car sexp) 'deftheme)
518 (setq doc (nth 2 sexp))))))) 516 (setq doc (nth 2 sexp)))))))
519 (princ "\n\nDocumentation:\n") 517 (princ "\n\nDocumentation:\n")
520 (princ (if (stringp doc) 518 (princ (if (stringp doc)
@@ -552,10 +550,10 @@ It includes all faces in list FACES."
552Do not call this mode function yourself. It is meant for internal use." 550Do not call this mode function yourself. It is meant for internal use."
553 (use-local-map custom-theme-choose-mode-map) 551 (use-local-map custom-theme-choose-mode-map)
554 (custom--initialize-widget-variables) 552 (custom--initialize-widget-variables)
555 (set (make-local-variable 'revert-buffer-function) 553 (setq-local revert-buffer-function
556 (lambda (_ignore-auto noconfirm) 554 (lambda (_ignore-auto noconfirm)
557 (when (or noconfirm (y-or-n-p "Discard current choices? ")) 555 (when (or noconfirm (y-or-n-p "Discard current choices? "))
558 (customize-themes (current-buffer)))))) 556 (customize-themes (current-buffer))))))
559(put 'custom-theme-choose-mode 'mode-class 'special) 557(put 'custom-theme-choose-mode 'mode-class 'special)
560 558
561;;;###autoload 559;;;###autoload
@@ -568,7 +566,7 @@ omitted, a buffer named *Custom Themes* is used."
568 (let ((inhibit-read-only t)) 566 (let ((inhibit-read-only t))
569 (erase-buffer)) 567 (erase-buffer))
570 (custom-theme-choose-mode) 568 (custom-theme-choose-mode)
571 (set (make-local-variable 'custom--listed-themes) nil) 569 (setq-local custom--listed-themes nil)
572 (make-local-variable 'custom-theme-allow-multiple-selections) 570 (make-local-variable 'custom-theme-allow-multiple-selections)
573 (and (null custom-theme-allow-multiple-selections) 571 (and (null custom-theme-allow-multiple-selections)
574 (> (length custom-enabled-themes) 1) 572 (> (length custom-enabled-themes) 1)
@@ -662,8 +660,7 @@ Theme files are named *-theme.el in `"))
662 (condition-case nil 660 (condition-case nil
663 (read (current-buffer)) 661 (read (current-buffer))
664 (end-of-file nil))))) 662 (end-of-file nil)))))
665 (and sexp (listp sexp) 663 (and (eq (car-safe sexp) 'deftheme)
666 (eq (car sexp) 'deftheme)
667 (setq doc (nth 2 sexp)))))))) 664 (setq doc (nth 2 sexp))))))))
668 (cond ((null doc) 665 (cond ((null doc)
669 "(no documentation available)") 666 "(no documentation available)")