Tweak handling of custom-enabled-themes and custom-safe-themes.
authorChong Yidong <cyd@gnu.org>
Thu, 5 Jan 2012 11:12:11 +0000 (19:12 +0800)
committerChong Yidong <cyd@gnu.org>
Thu, 5 Jan 2012 11:12:11 +0000 (19:12 +0800)
* 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
lisp/cus-theme.el
lisp/custom.el

index d03ec37..58e81f6 100644 (file)
@@ -1,9 +1,16 @@
+2012-01-05  Chong Yidong  <cyd@gnu.org>
+
+       * 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  <mmaug@yahoo.com>
 
        * 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'.
index e662d8c..6bddb02 100644 (file)
@@ -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
index b41a86d..d375278 100644 (file)
@@ -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