summaryrefslogtreecommitdiff
path: root/lisp/cus-theme.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-10-12 16:06:20 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-10-12 16:06:20 -0400
commit2919746c6494cc29bda375c5737b1c86b7e888d1 (patch)
tree1795060e37b9cea755efdd451a76d3e96ab8ee2c /lisp/cus-theme.el
parentaba1381b226ba72adbb775a5415f31719b13b664 (diff)
downloademacs-2919746c6494cc29bda375c5737b1c86b7e888d1.tar.gz
Add some default custom themes.
* cus-theme.el (custom-theme--listed-faces): Add cursor face. (describe-theme-1): Extract doc from unloaded themes. * custom.el (custom-theme-name-valid-p): Don't list color-themes. * themes/tango-theme.el: * themes/tango-dark-theme.el: * themes/wheatgrass-theme.el: New files.
Diffstat (limited to 'lisp/cus-theme.el')
-rw-r--r--lisp/cus-theme.el38
1 files changed, 27 insertions, 11 deletions
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 3c1295ea923..197d9787d9a 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -56,7 +56,7 @@ Do not call this mode function yourself. It is meant for internal use."
(defvar custom-theme-insert-variable-marker nil)
(defvar custom-theme-insert-face-marker nil)
-(defvar custom-theme--listed-faces '(default fixed-pitch
+(defvar custom-theme--listed-faces '(default cursor fixed-pitch
variable-pitch escape-glyph minibuffer-prompt highlight region
shadow secondary-selection trailing-whitespace
font-lock-builtin-face font-lock-comment-delimiter-face
@@ -478,21 +478,37 @@ It includes all faces in list FACES."
(princ " is a custom theme")
(let ((fn (locate-file (concat (symbol-name theme) "-theme.el")
(cons custom-theme-directory load-path)
- '("" "c"))))
+ '("" "c")))
+ doc)
(when fn
(princ " in `")
(help-insert-xref-button (file-name-nondirectory fn)
'help-theme-def fn)
(princ "'"))
- (princ ".\n"))
- (if (not (memq theme custom-known-themes))
- (princ "It is not loaded.")
- (if (custom-theme-enabled-p theme)
- (princ "It is loaded and enabled.\n")
- (princ "It is loaded but disabled.\n"))
- (princ "\nDocumentation:\n")
- (princ (or (get theme 'theme-documentation)
- "No documentation available.")))
+ (princ ".\n")
+ (if (not (memq theme custom-known-themes))
+ (progn
+ (princ "It is not loaded.")
+ ;; Attempt to grab the theme documentation
+ (when fn
+ (with-temp-buffer
+ (insert-file-contents fn)
+ (let ((sexp (let ((read-circle nil))
+ (condition-case nil
+ (read (current-buffer))
+ (end-of-file nil)))))
+ (and sexp (listp sexp)
+ (eq (car sexp) 'deftheme)
+ (setq doc (nth 2 sexp)))))))
+ (if (custom-theme-enabled-p theme)
+ (princ "It is loaded and enabled.")
+ (princ "It is loaded but disabled."))
+ (setq doc (get theme 'theme-documentation)))
+
+ (princ "\n\nDocumentation:\n")
+ (princ (if (stringp doc)
+ doc
+ "No documentation available.")))
(princ "\n\nYou can ")
(help-insert-xref-button "customize" 'help-theme-edit theme)
(princ " this theme."))