aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-06-14 01:06:26 -0400
committerChong Yidong2011-06-14 01:06:26 -0400
commitc5dd5a516c9f0f4b622452c42e34e95ca2e2fae5 (patch)
tree4a811ae80c86691b1ad0a7ffd454621739a6299e
parentb9958282dc60f74c942f34412123ddc76f7c592e (diff)
downloademacs-c5dd5a516c9f0f4b622452c42e34e95ca2e2fae5.tar.gz
emacs-c5dd5a516c9f0f4b622452c42e34e95ca2e2fae5.zip
Print theme summaries in *Custom Themes* buffer.
* lisp/cus-theme.el (describe-theme-1): Use custom-theme-p. (custom-theme-summary): New function. (customize-themes): Use it. * etc/themes/light-blue-theme.el: * etc/themes/misterioso-theme.el: * etc/themes/tango-dark-theme.el: * etc/themes/tango-theme.el: * etc/themes/tsdh-dark-theme.el: * etc/themes/tsdh-light-theme.el: * etc/themes/wheatgrass-theme.el: * etc/themes/wombat-theme.el: Tweak summaries for better listability.
-rw-r--r--etc/themes/light-blue-theme.el2
-rw-r--r--etc/themes/misterioso-theme.el2
-rw-r--r--etc/themes/tango-dark-theme.el2
-rw-r--r--etc/themes/tango-theme.el2
-rw-r--r--etc/themes/tsdh-dark-theme.el3
-rw-r--r--etc/themes/tsdh-light-theme.el3
-rw-r--r--etc/themes/wheatgrass-theme.el2
-rw-r--r--etc/themes/wombat-theme.el2
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/cus-theme.el73
10 files changed, 67 insertions, 30 deletions
diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el
index 60f9fa8dc9d..98c74b268af 100644
--- a/etc/themes/light-blue-theme.el
+++ b/etc/themes/light-blue-theme.el
@@ -26,7 +26,7 @@
26;;; Code: 26;;; Code:
27 27
28(deftheme light-blue 28(deftheme light-blue
29 "Theme with a light blue backgound.") 29 "Face colors utilizing a light blue backgound.")
30 30
31(let ((class '((class color) (min-colors 89)))) 31(let ((class '((class color) (min-colors 89))))
32 (custom-theme-set-faces 32 (custom-theme-set-faces
diff --git a/etc/themes/misterioso-theme.el b/etc/themes/misterioso-theme.el
index 864d31d9b09..ab4b2bc6191 100644
--- a/etc/themes/misterioso-theme.el
+++ b/etc/themes/misterioso-theme.el
@@ -22,7 +22,7 @@
22;;; Code: 22;;; Code:
23 23
24(deftheme misterioso 24(deftheme misterioso
25 "Theme for faces, using light colors on a dark gray background.") 25 "Predominantly blue/cyan faces on a dark cyan background.")
26 26
27(let ((class '((class color) (min-colors 89)))) 27(let ((class '((class color) (min-colors 89))))
28 28
diff --git a/etc/themes/tango-dark-theme.el b/etc/themes/tango-dark-theme.el
index a5731ab7d7d..b5621d10320 100644
--- a/etc/themes/tango-dark-theme.el
+++ b/etc/themes/tango-dark-theme.el
@@ -28,7 +28,7 @@
28;;; Code: 28;;; Code:
29 29
30(deftheme tango-dark 30(deftheme tango-dark
31 "Theme for faces, based on the Tango palette with a dark background. 31 "Face colors using the Tango palette (dark background).
32Basic, Font Lock, Isearch, Gnus, Message, Ediff, Flyspell, 32Basic, Font Lock, Isearch, Gnus, Message, Ediff, Flyspell,
33Semantic, and Ansi-Color faces are included.") 33Semantic, and Ansi-Color faces are included.")
34 34
diff --git a/etc/themes/tango-theme.el b/etc/themes/tango-theme.el
index 7be50a17f5f..c58e0036353 100644
--- a/etc/themes/tango-theme.el
+++ b/etc/themes/tango-theme.el
@@ -28,7 +28,7 @@
28;;; Code: 28;;; Code:
29 29
30(deftheme tango 30(deftheme tango
31 "Theme for faces, based on the Tango palette with a light background. 31 "Face colors using the Tango palette (light background).
32Basic, Font Lock, Isearch, Gnus, Message, Ediff, Flyspell, 32Basic, Font Lock, Isearch, Gnus, Message, Ediff, Flyspell,
33Semantic, and Ansi-Color faces are included.") 33Semantic, and Ansi-Color faces are included.")
34 34
diff --git a/etc/themes/tsdh-dark-theme.el b/etc/themes/tsdh-dark-theme.el
index b4fe0b59237..aaa43435ddf 100644
--- a/etc/themes/tsdh-dark-theme.el
+++ b/etc/themes/tsdh-dark-theme.el
@@ -20,7 +20,8 @@
20;;; Code: 20;;; Code:
21 21
22(deftheme tsdh-dark 22(deftheme tsdh-dark
23 "Theme with dark background used and created by Tassilo Horn.") 23 "Minor tweaks to the Emacs dark-background defaults.
24Used and created by Tassilo Horn.")
24 25
25(custom-theme-set-faces 26(custom-theme-set-faces
26 'tsdh-dark 27 'tsdh-dark
diff --git a/etc/themes/tsdh-light-theme.el b/etc/themes/tsdh-light-theme.el
index 4eda7a4b7c3..e7a2bafb03e 100644
--- a/etc/themes/tsdh-light-theme.el
+++ b/etc/themes/tsdh-light-theme.el
@@ -20,7 +20,8 @@
20;;; Code: 20;;; Code:
21 21
22(deftheme tsdh-light 22(deftheme tsdh-light
23 "Black on white theme used and created by Tassilo Horn.") 23 "Minor tweaks to the Emacs white-background defaults.
24Used and created by Tassilo Horn.")
24 25
25(custom-theme-set-faces 26(custom-theme-set-faces
26 'tsdh-light 27 'tsdh-light
diff --git a/etc/themes/wheatgrass-theme.el b/etc/themes/wheatgrass-theme.el
index 7fd241c5057..3a08bb63d96 100644
--- a/etc/themes/wheatgrass-theme.el
+++ b/etc/themes/wheatgrass-theme.el
@@ -20,7 +20,7 @@
20;;; Code: 20;;; Code:
21 21
22(deftheme wheatgrass 22(deftheme wheatgrass
23 "A high-contrast theme with a black background. 23 "High-contrast green/blue/brown faces on a black background.
24Basic, Font Lock, Isearch, Gnus, and Message faces are included. 24Basic, Font Lock, Isearch, Gnus, and Message faces are included.
25The default face foreground is wheat, with other faces in shades 25The default face foreground is wheat, with other faces in shades
26of green, brown, and blue.") 26of green, brown, and blue.")
diff --git a/etc/themes/wombat-theme.el b/etc/themes/wombat-theme.el
index 6a16b52ee24..2aa64f894bf 100644
--- a/etc/themes/wombat-theme.el
+++ b/etc/themes/wombat-theme.el
@@ -22,7 +22,7 @@
22;;; Code: 22;;; Code:
23 23
24(deftheme wombat 24(deftheme wombat
25 "Theme for faces, using easy-on-the eyes colors on a dark gray background. 25 "Medium-contrast faces with a dark gray background.
26Adapted, with permission, from a Vim color scheme by Lars H. Nielsen. 26Adapted, with permission, from a Vim color scheme by Lars H. Nielsen.
27Basic, Font Lock, Isearch, Gnus, Message, and Ansi-Color faces 27Basic, Font Lock, Isearch, Gnus, Message, and Ansi-Color faces
28are included.") 28are included.")
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7dac139c295..2cf968505af 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12011-06-14 Chong Yidong <cyd@stupidchicken.com>
2
3 * cus-theme.el (describe-theme-1): Use custom-theme-p.
4 (custom-theme-summary): New function.
5 (customize-themes): Use it.
6
12011-06-13 Glenn Morris <rgm@gnu.org> 72011-06-13 Glenn Morris <rgm@gnu.org>
2 8
3 * cus-dep.el (custom-make-dependencies): Use up command-line-args-left. 9 * cus-dep.el (custom-make-dependencies): Use up command-line-args-left.
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 86fb43be72a..7f926c85e56 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -483,25 +483,24 @@ It includes all faces in list FACES."
483 'help-theme-def fn) 483 'help-theme-def fn)
484 (princ "'")) 484 (princ "'"))
485 (princ ".\n") 485 (princ ".\n")
486 (if (not (memq theme custom-known-themes)) 486 (if (custom-theme-p theme)
487 (progn 487 (progn
488 (princ "It is not loaded.") 488 (if (custom-theme-enabled-p theme)
489 ;; Attempt to grab the theme documentation 489 (princ "It is loaded and enabled.")
490 (when fn 490 (princ "It is loaded but disabled."))
491 (with-temp-buffer 491 (setq doc (get theme 'theme-documentation)))
492 (insert-file-contents fn) 492 (princ "It is not loaded.")
493 (let ((sexp (let ((read-circle nil)) 493 ;; Attempt to grab the theme documentation
494 (condition-case nil 494 (when fn
495 (read (current-buffer)) 495 (with-temp-buffer
496 (end-of-file nil))))) 496 (insert-file-contents fn)
497 (and sexp (listp sexp) 497 (let ((sexp (let ((read-circle nil))
498 (eq (car sexp) 'deftheme) 498 (condition-case nil
499 (setq doc (nth 2 sexp))))))) 499 (read (current-buffer))
500 (if (custom-theme-enabled-p theme) 500 (end-of-file nil)))))
501 (princ "It is loaded and enabled.") 501 (and sexp (listp sexp)
502 (princ "It is loaded but disabled.")) 502 (eq (car sexp) 'deftheme)
503 (setq doc (get theme 'theme-documentation))) 503 (setq doc (nth 2 sexp)))))))
504
505 (princ "\n\nDocumentation:\n") 504 (princ "\n\nDocumentation:\n")
506 (princ (if (stringp doc) 505 (princ (if (stringp doc)
507 doc 506 doc
@@ -605,26 +604,56 @@ Theme files are named *-theme.el in `"))
605 (widget-create 'checkbox 604 (widget-create 'checkbox
606 :value custom-theme-allow-multiple-selections 605 :value custom-theme-allow-multiple-selections
607 :action 'custom-theme-selections-toggle) 606 :action 'custom-theme-selections-toggle)
608 (widget-insert (propertize " Allow more than one theme at a time" 607 (widget-insert (propertize " Select more than one theme at a time"
609 'face '(variable-pitch (:height 0.9)))) 608 'face '(variable-pitch (:height 0.9))))
610 609
611 (widget-insert "\n\nAvailable Custom Themes:\n") 610 (widget-insert "\n\nAvailable Custom Themes:\n")
612 (let (widget) 611 (let ((help-echo "mouse-2: Enable this theme for this session")
612 widget)
613 (dolist (theme (custom-available-themes)) 613 (dolist (theme (custom-available-themes))
614 (setq widget (widget-create 'checkbox 614 (setq widget (widget-create 'checkbox
615 :value (custom-theme-enabled-p theme) 615 :value (custom-theme-enabled-p theme)
616 :theme-name theme 616 :theme-name theme
617 :help-echo help-echo
617 :action 'custom-theme-checkbox-toggle)) 618 :action 'custom-theme-checkbox-toggle))
618 (push (cons theme widget) custom--listed-themes) 619 (push (cons theme widget) custom--listed-themes)
619 (widget-create-child-and-convert widget 'push-button 620 (widget-create-child-and-convert widget 'push-button
620 :button-face-get 'ignore 621 :button-face-get 'ignore
621 :mouse-face-get 'ignore 622 :mouse-face-get 'ignore
622 :value (format " %s" theme) 623 :value (format " %s" theme)
623 :action 'widget-parent-action) 624 :action 'widget-parent-action
624 (widget-insert ?\n))) 625 :help-echo help-echo)
626 (widget-insert " -- "
627 (propertize (custom-theme-summary theme)
628 'face 'shadow)
629 ?\n)))
625 (goto-char (point-min)) 630 (goto-char (point-min))
626 (widget-setup)) 631 (widget-setup))
627 632
633(defun custom-theme-summary (theme)
634 "Return the summary line of THEME."
635 (let (doc)
636 (if (custom-theme-p theme)
637 (setq doc (get theme 'theme-documentation))
638 (let ((fn (locate-file (concat (symbol-name theme) "-theme.el")
639 (custom-theme--load-path)
640 '("" "c"))))
641 (when fn
642 (with-temp-buffer
643 (insert-file-contents fn)
644 (let ((sexp (let ((read-circle nil))
645 (condition-case nil
646 (read (current-buffer))
647 (end-of-file nil)))))
648 (and sexp (listp sexp)
649 (eq (car sexp) 'deftheme)
650 (setq doc (nth 2 sexp))))))))
651 (cond ((null doc)
652 "(no documentation available)")
653 ((string-match ".*" doc)
654 (match-string 0 doc))
655 (t doc))))
656
628(defun custom-theme-checkbox-toggle (widget &optional event) 657(defun custom-theme-checkbox-toggle (widget &optional event)
629 (let ((this-theme (widget-get widget :theme-name))) 658 (let ((this-theme (widget-get widget :theme-name)))
630 (if (widget-value widget) 659 (if (widget-value widget)