diff options
| author | Chong Yidong | 2011-10-01 14:27:21 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-10-01 14:27:21 -0400 |
| commit | 04c52e2f5bffa157bcec3a9b1d0a57c4df36bfea (patch) | |
| tree | 39c55d25f041e43211dad4be40e7cffb7005a1e1 | |
| parent | 79adf8c87e37f206c2381eb5e0dc0025215c1b61 (diff) | |
| download | emacs-04c52e2f5bffa157bcec3a9b1d0a57c4df36bfea.tar.gz emacs-04c52e2f5bffa157bcec3a9b1d0a57c4df36bfea.zip | |
Allow overriding of theme confirmation via custom-safe-themes.
See http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00121.html
* lisp/custom.el (custom-safe-themes, load-theme): Treat value of t for
custom-safe-themes as special.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/custom.el | 24 |
2 files changed, 20 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f6eb49beb62..c17ee5b12d5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-10-01 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * custom.el (custom-safe-themes, load-theme): Treat value of t for | ||
| 4 | custom-safe-themes as special. | ||
| 5 | |||
| 1 | 2011-10-01 Julien Danjou <julien@danjou.info> | 6 | 2011-10-01 Julien Danjou <julien@danjou.info> |
| 2 | 7 | ||
| 3 | * notifications.el (notifications-notify): Fix docstring. | 8 | * notifications.el (notifications-notify): Fix docstring. |
diff --git a/lisp/custom.el b/lisp/custom.el index 4f69c741468..a1d53720b7d 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -1104,13 +1104,17 @@ property `theme-feature' (which is usually a symbol created by | |||
| 1104 | (provide (get theme 'theme-feature))) | 1104 | (provide (get theme 'theme-feature))) |
| 1105 | 1105 | ||
| 1106 | (defcustom custom-safe-themes '(default) | 1106 | (defcustom custom-safe-themes '(default) |
| 1107 | "List of themes that are considered safe to load. | 1107 | "Themes that are considered safe to load. |
| 1108 | Each list element should be the `sha1' hash of a theme file, or | 1108 | If the value is a list, each element should be either the `sha1' |
| 1109 | the symbol `default', which stands for any theme in the built-in | 1109 | hash of a safe theme file, or the symbol `default', which stands |
| 1110 | Emacs theme directory (a directory named \"themes\" in | 1110 | for any theme in the built-in Emacs theme directory (a directory |
| 1111 | `data-directory')." | 1111 | named \"themes\" in `data-directory'). |
| 1112 | :type '(repeat | 1112 | |
| 1113 | (choice string (const :tag "Built-in themes" default))) | 1113 | If the value is t, Emacs treats all themes as safe." |
| 1114 | :type '(choice (repeat :tag "List of safe themes" | ||
| 1115 | (choice string | ||
| 1116 | (const :tag "Built-in themes" default))) | ||
| 1117 | (const :tag "All themes" t)) | ||
| 1114 | :group 'customize | 1118 | :group 'customize |
| 1115 | :risky t | 1119 | :risky t |
| 1116 | :version "24.1") | 1120 | :version "24.1") |
| @@ -1120,8 +1124,9 @@ Emacs theme directory (a directory named \"themes\" in | |||
| 1120 | The theme file is named THEME-theme.el, in one of the directories | 1124 | The theme file is named THEME-theme.el, in one of the directories |
| 1121 | specified by `custom-theme-load-path'. | 1125 | specified by `custom-theme-load-path'. |
| 1122 | 1126 | ||
| 1123 | If THEME is not in `custom-safe-themes', prompt the user for | 1127 | If optional arg NO-CONFIRM is non-nil, and THEME is not |
| 1124 | confirmation, unless optional arg NO-CONFIRM is non-nil. | 1128 | considered safe according to `custom-safe-themes', prompt the |
| 1129 | user for confirmation. | ||
| 1125 | 1130 | ||
| 1126 | Normally, this function also enables THEME; if optional arg | 1131 | Normally, this function also enables THEME; if optional arg |
| 1127 | NO-ENABLE is non-nil, load the theme but don't enable it. | 1132 | NO-ENABLE is non-nil, load the theme but don't enable it. |
| @@ -1158,6 +1163,7 @@ Return t if THEME was successfully loaded, nil otherwise." | |||
| 1158 | ;; Check file safety with `custom-safe-themes', prompting the | 1163 | ;; Check file safety with `custom-safe-themes', prompting the |
| 1159 | ;; user if necessary. | 1164 | ;; user if necessary. |
| 1160 | (when (or no-confirm | 1165 | (when (or no-confirm |
| 1166 | (eq custom-safe-themes t) | ||
| 1161 | (and (memq 'default custom-safe-themes) | 1167 | (and (memq 'default custom-safe-themes) |
| 1162 | (equal (file-name-directory fn) | 1168 | (equal (file-name-directory fn) |
| 1163 | (expand-file-name "themes/" data-directory))) | 1169 | (expand-file-name "themes/" data-directory))) |