From 4125cb8b6550521126fb5023734abde62c7aef16 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 25 Mar 2012 22:05:51 +0800 Subject: [PATCH] Fix interaction of load-theme with cust-theme.el. * lisp/custom.el (load-theme): Even if NO-ENABLE arg is t, reenable the theme if it was previously enabled before (Bug#11031). * lisp/cus-theme.el (customize-create-theme, custom-theme-revert): Doc fixes. --- lisp/ChangeLog | 4 ++++ lisp/cus-theme.el | 6 +++++- lisp/custom.el | 9 +++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 639d3f6d572..a6220b11be7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,12 @@ 2012-03-25 Chong Yidong + * custom.el (load-theme): Even if NO-ENABLE arg is t, reenable the + theme if it was previously enabled before (Bug#11031). + * cus-theme.el (custom-theme-write-faces): Retrieve current face spec with custom-face-get-current-spec if its :shown-value is not determined yet (Bug#9337). + (customize-create-theme, custom-theme-revert): Doc fixes. * button.el (button-at): Minor addition to docstring. diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index ba2fa969fc4..606033f915c 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -81,7 +81,9 @@ Do not call this mode function yourself. It is meant for internal use." (defun customize-create-theme (&optional theme buffer) "Create or edit a custom theme. THEME, if non-nil, should be an existing theme to edit. If THEME -is `user', provide an option to remove these as custom settings. +is `user', the resulting *Custom Theme* buffer also contains a +checkbox for removing the theme settings specified in the buffer +from the Custom save file. BUFFER, if non-nil, should be a buffer to use; the default is named *Custom Theme*." (interactive) @@ -209,6 +211,8 @@ remove them from your saved Custom file.\n\n")) (message ""))) (defun custom-theme-revert (_ignore-auto noconfirm) + "Revert the current *Custom Theme* buffer. +This is the `revert-buffer-function' for `custom-new-theme-mode'." (when (or noconfirm (y-or-n-p "Discard current changes? ")) (customize-create-theme custom-theme--save-name (current-buffer)))) diff --git a/lisp/custom.el b/lisp/custom.el index 2f17ad36da0..bffd30bff21 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1143,8 +1143,9 @@ prompt the user for confirmation before loading it. But if optional arg NO-CONFIRM is non-nil, load the theme without prompting. -Normally, this function also enables THEME; if optional arg -NO-ENABLE is non-nil, load the theme but don't enable it. +Normally, this function also enables THEME. If optional arg +NO-ENABLE is non-nil, load the theme but don't enable it, unless +the theme was already enabled. This function is normally called through Customize when setting `custom-enabled-themes'. If used directly in your init file, it @@ -1160,6 +1161,10 @@ Return t if THEME was successfully loaded, nil otherwise." nil nil)) (unless (custom-theme-name-valid-p theme) (error "Invalid theme name `%s'" theme)) + ;; If THEME is already enabled, re-enable it after loading, even if + ;; NO-ENABLE is t. + (if no-enable + (setq no-enable (not (custom-theme-enabled-p theme)))) ;; If reloading, clear out the old theme settings. (when (custom-theme-p theme) (disable-theme theme) -- 2.11.4.GIT