From 0448233577f904d83506626769878cd576120a6e Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Thu, 5 Jan 2012 19:12:11 +0800 Subject: [PATCH] Tweak handling of custom-enabled-themes and custom-safe-themes. * lisp/cus-theme.el (custom-theme-merge-theme): Ignore custom-enabled-themes and custom-safe-themes. * lisp/custom.el (enable-theme): Don't set custom-safe-themes. --- lisp/ChangeLog | 9 ++++++++- lisp/cus-theme.el | 15 ++++++++++----- lisp/custom.el | 8 +++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d03ec37bf11..58e81f6a87e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,9 +1,16 @@ +2012-01-05 Chong Yidong + + * custom.el (enable-theme): Don't set custom-safe-themes. + + * cus-theme.el (custom-theme-merge-theme): Ignore + custom-enabled-themes and custom-safe-themes. + 2012-01-05 Michael R. Mauger * progmodes/sql.el (sql-login-hook): Add hook to respond to the first prompt in `sql-interacive-mode'. (sql-mode-oracle-font-lock-keywords): Add CONNECT_BY_* builtin - keywords. + keywords. (sql-mode-mysql-font-lock-keywords): Add ELSEIF keyword. (sql-product-interactive): Bug fix: Set `sql-buffer' in context of original buffer. Invoke `sql-login-hook'. diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index e662d8c84c7..6bddb02add6 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -329,11 +329,16 @@ SPEC, if non-nil, should be a face spec to which to set the widget." (load-theme theme nil t)) (let ((settings (reverse (get theme 'theme-settings)))) (dolist (setting settings) - (funcall (if (eq (car setting) 'theme-value) - 'custom-theme-add-variable - 'custom-theme-add-face) - (nth 1 setting) - (nth 3 setting)))) + (let ((option (eq (car setting) 'theme-value)) + (name (nth 1 setting)) + (value (nth 3 setting))) + (unless (and option + (memq name '(custom-enabled-themes + custom-safe-themes))) + (funcall (if option + 'custom-theme-add-variable + 'custom-theme-add-face) + name value))))) theme) ;; From cus-edit.el diff --git a/lisp/custom.el b/lisp/custom.el index b41a86dd5ee..d3752789e28 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1110,7 +1110,9 @@ 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." +If the value is t, Emacs treats all themes as safe. + +This variable cannot be set in a Custom theme." :type '(choice (repeat :tag "List of safe themes" (choice string (const :tag "Built-in themes" default))) @@ -1285,8 +1287,8 @@ precedence (after `user')." ((eq prop 'theme-face) (custom-theme-recalc-face symbol)) ((eq prop 'theme-value) - ;; Don't change `custom-enabled-themes'; that's special. - (unless (eq symbol 'custom-enabled-themes) + ;; Ignore `custom-enabled-themes' and `custom-safe-themes'. + (unless (memq symbol '(custom-enabled-themes custom-safe-themes)) (custom-theme-recalc-variable symbol))))))) (unless (eq theme 'user) (setq custom-enabled-themes -- 2.39.2