diff options
| author | Chong Yidong | 2010-10-16 14:27:08 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-10-16 14:27:08 -0400 |
| commit | 782b5e8d92668cc6d434c836d076e26db1cab7c1 (patch) | |
| tree | 4fc21b10d9bdc82198da99618a48112d98cadecf | |
| parent | 99f65cface3bf5f8a8af7b9bd8a7159b5c77fad9 (diff) | |
| download | emacs-782b5e8d92668cc6d434c836d076e26db1cab7c1.tar.gz emacs-782b5e8d92668cc6d434c836d076e26db1cab7c1.zip | |
Move built-in theme directory to etc/.
* 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.
| -rw-r--r-- | etc/ChangeLog | 4 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -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/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/cus-theme.el | 21 | ||||
| -rw-r--r-- | lisp/custom.el | 70 |
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 @@ | |||
| 1 | 2010-10-16 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * themes: New directory for custom theme files, moved from lisp/. | ||
| 4 | |||
| 1 | 2010-10-14 Juanma Barranquero <lekktu@gmail.com> | 5 | 2010-10-14 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 6 | ||
| 3 | * tutorials/TUTORIAL.es: Fix typos. | 7 | * tutorials/TUTORIAL.es: Fix typos. |
| @@ -199,6 +199,11 @@ loaded, customize `package-load-list'. | |||
| 199 | 199 | ||
| 200 | *** `M-x customize-themes' lists Custom themes which can be enabled. | 200 | *** `M-x customize-themes' lists Custom themes which can be enabled. |
| 201 | 201 | ||
| 202 | *** New option `custom-theme-load-path' is the load path for themes. | ||
| 203 | Emacs no longer looks for custom themes in `load-path'. The default | ||
| 204 | is to search in `custom-theme-directory', followed by a built-in theme | ||
| 205 | directory named "themes/" in `data-directory'. | ||
| 206 | |||
| 202 | ** The user option `remote-file-name-inhibit-cache' controls whether | 207 | ** The user option `remote-file-name-inhibit-cache' controls whether |
| 203 | the remote file-name cache is used for read access. | 208 | the remote file-name cache is used for read access. |
| 204 | 209 | ||
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 @@ | |||
| 1 | 2010-10-16 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * custom.el: Custom themes no longer use load-path. | ||
| 4 | (custom-theme-load-path): New option. Change built-in theme | ||
| 5 | directory to etc/. | ||
| 6 | (custom-enabled-themes): Add custom-theme-load-path dependency. | ||
| 7 | (custom-theme--load-path): New function. | ||
| 8 | (load-theme, custom-available-themes): Use it. | ||
| 9 | |||
| 10 | * cus-theme.el (describe-theme-1): Use custom-theme--load-path. | ||
| 11 | (customize-themes): Link to custom-theme-load-path variable. | ||
| 12 | |||
| 13 | * themes/*.el: Moved to etc/. | ||
| 14 | |||
| 1 | 2010-10-16 Ralf Angeli <angeli@caeruleus.net> | 15 | 2010-10-16 Ralf Angeli <angeli@caeruleus.net> |
| 2 | 16 | ||
| 3 | * textmodes/reftex-cite.el | 17 | * 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." | |||
| 316 | 316 | ||
| 317 | (with-temp-buffer | 317 | (with-temp-buffer |
| 318 | (emacs-lisp-mode) | 318 | (emacs-lisp-mode) |
| 319 | (unless (file-exists-p custom-theme-directory) | 319 | (unless (file-directory-p custom-theme-directory) |
| 320 | (make-directory (file-name-as-directory custom-theme-directory) t)) | 320 | (make-directory (file-name-as-directory custom-theme-directory) t)) |
| 321 | (setq buffer-file-name filename) | 321 | (setq buffer-file-name filename) |
| 322 | (erase-buffer) | 322 | (erase-buffer) |
| @@ -419,7 +419,7 @@ It includes all faces in list FACES." | |||
| 419 | (prin1 theme) | 419 | (prin1 theme) |
| 420 | (princ " is a custom theme") | 420 | (princ " is a custom theme") |
| 421 | (let ((fn (locate-file (concat (symbol-name theme) "-theme.el") | 421 | (let ((fn (locate-file (concat (symbol-name theme) "-theme.el") |
| 422 | (cons custom-theme-directory load-path) | 422 | (custom-theme--load-path) |
| 423 | '("" "c"))) | 423 | '("" "c"))) |
| 424 | doc) | 424 | doc) |
| 425 | (when fn | 425 | (when fn |
| @@ -508,26 +508,15 @@ omitted, a buffer named *Custom Themes* is used." | |||
| 508 | "Type RET or click to enable/disable listed custom themes. | 508 | "Type RET or click to enable/disable listed custom themes. |
| 509 | Type \\[custom-describe-theme] to describe the theme at point. | 509 | Type \\[custom-describe-theme] to describe the theme at point. |
| 510 | Theme files are named *-theme.el in `")) | 510 | Theme files are named *-theme.el in `")) |
| 511 | (when (stringp custom-theme-directory) | 511 | (widget-create 'link :value "custom-theme-load-path" |
| 512 | (widget-create 'link :value custom-theme-directory | ||
| 513 | :button-face 'custom-link | ||
| 514 | :mouse-face 'highlight | ||
| 515 | :pressed-face 'highlight | ||
| 516 | :help-echo "Describe `custom-theme-directory'." | ||
| 517 | :keymap custom-mode-link-map | ||
| 518 | :follow-link 'mouse-face | ||
| 519 | :action (lambda (widget &rest ignore) | ||
| 520 | (describe-variable 'custom-theme-directory))) | ||
| 521 | (widget-insert "' or `")) | ||
| 522 | (widget-create 'link :value "load-path" | ||
| 523 | :button-face 'custom-link | 512 | :button-face 'custom-link |
| 524 | :mouse-face 'highlight | 513 | :mouse-face 'highlight |
| 525 | :pressed-face 'highlight | 514 | :pressed-face 'highlight |
| 526 | :help-echo "Describe `load-path'." | 515 | :help-echo "Describe `custom-theme-load-path'." |
| 527 | :keymap custom-mode-link-map | 516 | :keymap custom-mode-link-map |
| 528 | :follow-link 'mouse-face | 517 | :follow-link 'mouse-face |
| 529 | :action (lambda (widget &rest ignore) | 518 | :action (lambda (widget &rest ignore) |
| 530 | (describe-variable 'load-path))) | 519 | (describe-variable 'custom-theme-load-path))) |
| 531 | (widget-insert "'.\n\n") | 520 | (widget-insert "'.\n\n") |
| 532 | 521 | ||
| 533 | ;; If the user has made customizations, display a warning and | 522 | ;; 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')." | |||
| 996 | 996 | ||
| 997 | ;;; Defining themes. | 997 | ;;; Defining themes. |
| 998 | 998 | ||
| 999 | ;; A theme file should be named `THEME-theme.el' (where THEME is the theme | 999 | ;; A theme file is named `THEME-theme.el' (where THEME is the theme |
| 1000 | ;; name), and found in either `custom-theme-directory' or the load path. | 1000 | ;; name) found in `custom-theme-load-path'. It has this format: |
| 1001 | ;; It has the following format: | ||
| 1002 | ;; | 1001 | ;; |
| 1003 | ;; (deftheme THEME | 1002 | ;; (deftheme THEME |
| 1004 | ;; DOCSTRING) | 1003 | ;; DOCSTRING) |
| @@ -1053,16 +1052,31 @@ Every theme X has a property `provide-theme' whose value is \"X-theme\". | |||
| 1053 | 1052 | ||
| 1054 | ;;; Loading themes. | 1053 | ;;; Loading themes. |
| 1055 | 1054 | ||
| 1056 | (defcustom custom-theme-directory | 1055 | (defcustom custom-theme-directory user-emacs-directory |
| 1057 | user-emacs-directory | 1056 | "Default user directory for storing custom theme files. |
| 1058 | "Directory in which Custom theme files should be written. | 1057 | The command `customize-create-theme' writes theme files into this |
| 1059 | `load-theme' searches this directory in addition to load-path. | 1058 | directory. By default, Emacs searches for custom themes in this |
| 1060 | The command `customize-create-theme' writes the files it produces | 1059 | directory first---see `custom-theme-load-path'." |
| 1061 | into this directory." | ||
| 1062 | :type 'string | 1060 | :type 'string |
| 1063 | :group 'customize | 1061 | :group 'customize |
| 1064 | :version "22.1") | 1062 | :version "22.1") |
| 1065 | 1063 | ||
| 1064 | (defcustom custom-theme-load-path (list 'custom-theme-directory t) | ||
| 1065 | "List of directories to search for custom theme files. | ||
| 1066 | Emacs commands for loading custom themes (e.g. `customize-themes' | ||
| 1067 | and `load-theme') search for custom theme files in the specified | ||
| 1068 | order. Each element in the list should be one of the following: | ||
| 1069 | \(i) the symbol `custom-theme-directory', which means the value | ||
| 1070 | of that variable; (ii) the symbol t (the built-in Emacs theme | ||
| 1071 | directory, named \"themes\" in `data-directory'); or \(iii) a | ||
| 1072 | directory name (a string)." | ||
| 1073 | :type '(repeat (choice (const :tag "custom-theme-directory" | ||
| 1074 | custom-theme-directory) | ||
| 1075 | (const :tag "Built-in theme directory" t) | ||
| 1076 | directory)) | ||
| 1077 | :group 'customize | ||
| 1078 | :version "24.1") | ||
| 1079 | |||
| 1066 | (defvar custom--inhibit-theme-enable nil | 1080 | (defvar custom--inhibit-theme-enable nil |
| 1067 | "If non-nil, loading a theme does not enable it. | 1081 | "If non-nil, loading a theme does not enable it. |
| 1068 | This internal variable is set by `load-theme' when its NO-ENABLE | 1082 | This internal variable is set by `load-theme' when its NO-ENABLE |
| @@ -1108,7 +1122,7 @@ the theme." | |||
| 1108 | (put theme 'theme-feature nil) | 1122 | (put theme 'theme-feature nil) |
| 1109 | (put theme 'theme-documentation nil)) | 1123 | (put theme 'theme-documentation nil)) |
| 1110 | (let ((fn (locate-file (concat (symbol-name theme) "-theme.el") | 1124 | (let ((fn (locate-file (concat (symbol-name theme) "-theme.el") |
| 1111 | (cons custom-theme-directory load-path) | 1125 | (custom-theme--load-path) |
| 1112 | '("" "c")))) | 1126 | '("" "c")))) |
| 1113 | (unless fn | 1127 | (unless fn |
| 1114 | (error "Unable to find theme file for `%s'." theme)) | 1128 | (error "Unable to find theme file for `%s'." theme)) |
| @@ -1158,19 +1172,29 @@ NAME should be a symbol." | |||
| 1158 | 1172 | ||
| 1159 | (defun custom-available-themes () | 1173 | (defun custom-available-themes () |
| 1160 | "Return a list of available Custom themes (symbols)." | 1174 | "Return a list of available Custom themes (symbols)." |
| 1161 | (let* ((load-path (if (file-directory-p custom-theme-directory) | 1175 | (let* (sym themes) |
| 1162 | (cons custom-theme-directory load-path) | 1176 | (dolist (dir (custom-theme--load-path)) |
| 1163 | load-path)) | 1177 | (when (file-directory-p dir) |
| 1164 | sym themes) | 1178 | (dolist (file (file-expand-wildcards |
| 1165 | (dolist (dir load-path) | 1179 | (expand-file-name "*-theme.el" dir) t)) |
| 1166 | (dolist (file (file-expand-wildcards | 1180 | (setq file (file-name-nondirectory file)) |
| 1167 | (expand-file-name "*-theme.el" dir) t)) | 1181 | (and (string-match "\\`\\(.+\\)-theme.el\\'" file) |
| 1168 | (setq file (file-name-nondirectory file)) | 1182 | (setq sym (intern (match-string 1 file))) |
| 1169 | (and (string-match "\\`\\(.+\\)-theme.el\\'" file) | 1183 | (custom-theme-name-valid-p sym) |
| 1170 | (setq sym (intern (match-string 1 file))) | 1184 | (push sym themes))))) |
| 1171 | (custom-theme-name-valid-p sym) | ||
| 1172 | (push sym themes)))) | ||
| 1173 | (delete-dups themes))) | 1185 | (delete-dups themes))) |
| 1186 | |||
| 1187 | (defun custom-theme--load-path () | ||
| 1188 | (let (lpath) | ||
| 1189 | (dolist (f custom-theme-load-path) | ||
| 1190 | (cond ((eq f 'custom-theme-directory) | ||
| 1191 | (setq f custom-theme-directory)) | ||
| 1192 | ((eq f t) | ||
| 1193 | (setq f (expand-file-name "themes" data-directory)))) | ||
| 1194 | (if (file-directory-p f) | ||
| 1195 | (push f lpath))) | ||
| 1196 | (nreverse lpath))) | ||
| 1197 | |||
| 1174 | 1198 | ||
| 1175 | ;;; Enabling and disabling loaded themes. | 1199 | ;;; Enabling and disabling loaded themes. |
| 1176 | 1200 | ||
| @@ -1212,7 +1236,7 @@ This does not include the `user' theme, which is set by Customize, | |||
| 1212 | and always takes precedence over other Custom Themes." | 1236 | and always takes precedence over other Custom Themes." |
| 1213 | :group 'customize | 1237 | :group 'customize |
| 1214 | :type '(repeat symbol) | 1238 | :type '(repeat symbol) |
| 1215 | :set-after '(custom-theme-directory) ; so we can find the themes | 1239 | :set-after '(custom-theme-directory custom-theme-load-path) |
| 1216 | :set (lambda (symbol themes) | 1240 | :set (lambda (symbol themes) |
| 1217 | ;; Avoid an infinite loop when custom-enabled-themes is | 1241 | ;; Avoid an infinite loop when custom-enabled-themes is |
| 1218 | ;; defined in a theme (e.g. `user'). Enabling the theme sets | 1242 | ;; defined in a theme (e.g. `user'). Enabling the theme sets |