From: Chong Yidong Date: Sat, 1 Oct 2011 18:27:21 +0000 (-0400) Subject: Allow overriding of theme confirmation via custom-safe-themes. X-Git-Tag: emacs-pretest-24.0.91~232 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=04c52e2f5bffa157bcec3a9b1d0a57c4df36bfea;p=emacs.git 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f6eb49beb62..c17ee5b12d5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-10-01 Chong Yidong + + * custom.el (custom-safe-themes, load-theme): Treat value of t for + custom-safe-themes as special. + 2011-10-01 Julien Danjou * 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 (provide (get theme 'theme-feature))) (defcustom custom-safe-themes '(default) - "List of themes that are considered safe to load. -Each list element should be the `sha1' hash of a theme file, or -the symbol `default', which stands for any theme in the built-in -Emacs theme directory (a directory named \"themes\" in -`data-directory')." - :type '(repeat - (choice string (const :tag "Built-in themes" default))) + "Themes that are considered safe to load. +If the value is a list, each element should be either the `sha1' +hash of a safe theme file, or the symbol `default', which stands +for any theme in the built-in Emacs theme directory (a directory +named \"themes\" in `data-directory'). + +If the value is t, Emacs treats all themes as safe." + :type '(choice (repeat :tag "List of safe themes" + (choice string + (const :tag "Built-in themes" default))) + (const :tag "All themes" t)) :group 'customize :risky t :version "24.1") @@ -1120,8 +1124,9 @@ Emacs theme directory (a directory named \"themes\" in The theme file is named THEME-theme.el, in one of the directories specified by `custom-theme-load-path'. -If THEME is not in `custom-safe-themes', prompt the user for -confirmation, unless optional arg NO-CONFIRM is non-nil. +If optional arg NO-CONFIRM is non-nil, and THEME is not +considered safe according to `custom-safe-themes', prompt the +user for confirmation. Normally, this function also enables THEME; if optional arg 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." ;; Check file safety with `custom-safe-themes', prompting the ;; user if necessary. (when (or no-confirm + (eq custom-safe-themes t) (and (memq 'default custom-safe-themes) (equal (file-name-directory fn) (expand-file-name "themes/" data-directory)))