summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/NEWS5
-rw-r--r--etc/themes/tango-dark-theme.el (renamed from lisp/themes/tango-dark-theme.el)0
-rw-r--r--etc/themes/tango-theme.el (renamed from lisp/themes/tango-theme.el)0
-rw-r--r--etc/themes/wheatgrass-theme.el (renamed from lisp/themes/wheatgrass-theme.el)0
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/cus-theme.el21
-rw-r--r--lisp/custom.el70
8 files changed, 75 insertions, 39 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog
index c084d4ff76b..3e5a6e79894 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-16 Chong Yidong <cyd@stupidchicken.com>
+
+ * themes: New directory for custom theme files, moved from lisp/.
+
2010-10-14 Juanma Barranquero <lekktu@gmail.com>
* tutorials/TUTORIAL.es: Fix typos.
diff --git a/etc/NEWS b/etc/NEWS
index 1c437777254..8429edc0e70 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -199,6 +199,11 @@ loaded, customize `package-load-list'.
*** `M-x customize-themes' lists Custom themes which can be enabled.
+*** New option `custom-theme-load-path' is the load path for themes.
+Emacs no longer looks for custom themes in `load-path'. The default
+is to search in `custom-theme-directory', followed by a built-in theme
+directory named "themes/" in `data-directory'.
+
** The user option `remote-file-name-inhibit-cache' controls whether
the remote file-name cache is used for read access.
diff --git a/lisp/themes/tango-dark-theme.el b/etc/themes/tango-dark-theme.el
index f63440b4ea7..f63440b4ea7 100644
--- a/lisp/themes/tango-dark-theme.el
+++ b/etc/themes/tango-dark-theme.el
diff --git a/lisp/themes/tango-theme.el b/etc/themes/tango-theme.el
index f0492c048af..f0492c048af 100644
--- a/lisp/themes/tango-theme.el
+++ b/etc/themes/tango-theme.el
diff --git a/lisp/themes/wheatgrass-theme.el b/etc/themes/wheatgrass-theme.el
index 848e5e95073..848e5e95073 100644
--- a/lisp/themes/wheatgrass-theme.el
+++ b/etc/themes/wheatgrass-theme.el
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 109b4d99f95..9c47091a7aa 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-16 Chong Yidong <cyd@stupidchicken.com>
+
+ * custom.el: Custom themes no longer use load-path.
+ (custom-theme-load-path): New option. Change built-in theme
+ directory to etc/.
+ (custom-enabled-themes): Add custom-theme-load-path dependency.
+ (custom-theme--load-path): New function.
+ (load-theme, custom-available-themes): Use it.
+
+ * cus-theme.el (describe-theme-1): Use custom-theme--load-path.
+ (customize-themes): Link to custom-theme-load-path variable.
+
+ * themes/*.el: Moved to etc/.
+
2010-10-16 Ralf Angeli <angeli@caeruleus.net>
* textmodes/reftex-cite.el
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 241dd6cc069..34a03539719 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -316,7 +316,7 @@ SPEC, if non-nil, should be a face spec to which to set the widget."
(with-temp-buffer
(emacs-lisp-mode)
- (unless (file-exists-p custom-theme-directory)
+ (unless (file-directory-p custom-theme-directory)
(make-directory (file-name-as-directory custom-theme-directory) t))
(setq buffer-file-name filename)
(erase-buffer)
@@ -419,7 +419,7 @@ It includes all faces in list FACES."
(prin1 theme)
(princ " is a custom theme")
(let ((fn (locate-file (concat (symbol-name theme) "-theme.el")
- (cons custom-theme-directory load-path)
+ (custom-theme--load-path)
'("" "c")))
doc)
(when fn
@@ -508,26 +508,15 @@ omitted, a buffer named *Custom Themes* is used."
"Type RET or click to enable/disable listed custom themes.
Type \\[custom-describe-theme] to describe the theme at point.
Theme files are named *-theme.el in `"))
- (when (stringp custom-theme-directory)
- (widget-create 'link :value custom-theme-directory
- :button-face 'custom-link
- :mouse-face 'highlight
- :pressed-face 'highlight
- :help-echo "Describe `custom-theme-directory'."
- :keymap custom-mode-link-map
- :follow-link 'mouse-face
- :action (lambda (widget &rest ignore)
- (describe-variable 'custom-theme-directory)))
- (widget-insert "' or `"))
- (widget-create 'link :value "load-path"
+ (widget-create 'link :value "custom-theme-load-path"
:button-face 'custom-link
:mouse-face 'highlight
:pressed-face 'highlight
- :help-echo "Describe `load-path'."
+ :help-echo "Describe `custom-theme-load-path'."
:keymap custom-mode-link-map
:follow-link 'mouse-face
:action (lambda (widget &rest ignore)
- (describe-variable 'load-path)))
+ (describe-variable 'custom-theme-load-path)))
(widget-insert "'.\n\n")
;; If the user has made customizations, display a warning and
diff --git a/lisp/custom.el b/lisp/custom.el
index c5ebe64da3c..8ece438065f 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -996,9 +996,8 @@ in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
;;; Defining themes.
-;; A theme file should be named `THEME-theme.el' (where THEME is the theme
-;; name), and found in either `custom-theme-directory' or the load path.
-;; It has the following format:
+;; A theme file is named `THEME-theme.el' (where THEME is the theme
+;; name) found in `custom-theme-load-path'. It has this format:
;;
;; (deftheme THEME
;; DOCSTRING)
@@ -1053,16 +1052,31 @@ Every theme X has a property `provide-theme' whose value is \"X-theme\".
;;; Loading themes.
-(defcustom custom-theme-directory
- user-emacs-directory
- "Directory in which Custom theme files should be written.
-`load-theme' searches this directory in addition to load-path.
-The command `customize-create-theme' writes the files it produces
-into this directory."
+(defcustom custom-theme-directory user-emacs-directory
+ "Default user directory for storing custom theme files.
+The command `customize-create-theme' writes theme files into this
+directory. By default, Emacs searches for custom themes in this
+directory first---see `custom-theme-load-path'."
:type 'string
:group 'customize
:version "22.1")
+(defcustom custom-theme-load-path (list 'custom-theme-directory t)
+ "List of directories to search for custom theme files.
+Emacs commands for loading custom themes (e.g. `customize-themes'
+and `load-theme') search for custom theme files in the specified
+order. Each element in the list should be one of the following:
+\(i) the symbol `custom-theme-directory', which means the value
+of that variable; (ii) the symbol t (the built-in Emacs theme
+directory, named \"themes\" in `data-directory'); or \(iii) a
+directory name (a string)."
+ :type '(repeat (choice (const :tag "custom-theme-directory"
+ custom-theme-directory)
+ (const :tag "Built-in theme directory" t)
+ directory))
+ :group 'customize
+ :version "24.1")
+
(defvar custom--inhibit-theme-enable nil
"If non-nil, loading a theme does not enable it.
This internal variable is set by `load-theme' when its NO-ENABLE
@@ -1108,7 +1122,7 @@ the theme."
(put theme 'theme-feature nil)
(put theme 'theme-documentation nil))
(let ((fn (locate-file (concat (symbol-name theme) "-theme.el")
- (cons custom-theme-directory load-path)
+ (custom-theme--load-path)
'("" "c"))))
(unless fn
(error "Unable to find theme file for `%s'." theme))
@@ -1158,19 +1172,29 @@ NAME should be a symbol."
(defun custom-available-themes ()
"Return a list of available Custom themes (symbols)."
- (let* ((load-path (if (file-directory-p custom-theme-directory)
- (cons custom-theme-directory load-path)
- load-path))
- sym themes)
- (dolist (dir load-path)
- (dolist (file (file-expand-wildcards
- (expand-file-name "*-theme.el" dir) t))
- (setq file (file-name-nondirectory file))
- (and (string-match "\\`\\(.+\\)-theme.el\\'" file)
- (setq sym (intern (match-string 1 file)))
- (custom-theme-name-valid-p sym)
- (push sym themes))))
+ (let* (sym themes)
+ (dolist (dir (custom-theme--load-path))
+ (when (file-directory-p dir)
+ (dolist (file (file-expand-wildcards
+ (expand-file-name "*-theme.el" dir) t))
+ (setq file (file-name-nondirectory file))
+ (and (string-match "\\`\\(.+\\)-theme.el\\'" file)
+ (setq sym (intern (match-string 1 file)))
+ (custom-theme-name-valid-p sym)
+ (push sym themes)))))
(delete-dups themes)))
+
+(defun custom-theme--load-path ()
+ (let (lpath)
+ (dolist (f custom-theme-load-path)
+ (cond ((eq f 'custom-theme-directory)
+ (setq f custom-theme-directory))
+ ((eq f t)
+ (setq f (expand-file-name "themes" data-directory))))
+ (if (file-directory-p f)
+ (push f lpath)))
+ (nreverse lpath)))
+
;;; Enabling and disabling loaded themes.
@@ -1212,7 +1236,7 @@ This does not include the `user' theme, which is set by Customize,
and always takes precedence over other Custom Themes."
:group 'customize
:type '(repeat symbol)
- :set-after '(custom-theme-directory) ; so we can find the themes
+ :set-after '(custom-theme-directory custom-theme-load-path)
:set (lambda (symbol themes)
;; Avoid an infinite loop when custom-enabled-themes is
;; defined in a theme (e.g. `user'). Enabling the theme sets