aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-10-01 14:27:21 -0400
committerChong Yidong2011-10-01 14:27:21 -0400
commit04c52e2f5bffa157bcec3a9b1d0a57c4df36bfea (patch)
tree39c55d25f041e43211dad4be40e7cffb7005a1e1
parent79adf8c87e37f206c2381eb5e0dc0025215c1b61 (diff)
downloademacs-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/ChangeLog5
-rw-r--r--lisp/custom.el24
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 @@
12011-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
12011-10-01 Julien Danjou <julien@danjou.info> 62011-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.
1108Each list element should be the `sha1' hash of a theme file, or 1108If the value is a list, each element should be either the `sha1'
1109the symbol `default', which stands for any theme in the built-in 1109hash of a safe theme file, or the symbol `default', which stands
1110Emacs theme directory (a directory named \"themes\" in 1110for any theme in the built-in Emacs theme directory (a directory
1111`data-directory')." 1111named \"themes\" in `data-directory').
1112 :type '(repeat 1112
1113 (choice string (const :tag "Built-in themes" default))) 1113If 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
1120The theme file is named THEME-theme.el, in one of the directories 1124The theme file is named THEME-theme.el, in one of the directories
1121specified by `custom-theme-load-path'. 1125specified by `custom-theme-load-path'.
1122 1126
1123If THEME is not in `custom-safe-themes', prompt the user for 1127If optional arg NO-CONFIRM is non-nil, and THEME is not
1124confirmation, unless optional arg NO-CONFIRM is non-nil. 1128considered safe according to `custom-safe-themes', prompt the
1129user for confirmation.
1125 1130
1126Normally, this function also enables THEME; if optional arg 1131Normally, this function also enables THEME; if optional arg
1127NO-ENABLE is non-nil, load the theme but don't enable it. 1132NO-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)))