Commit 4125cb8b authored by Chong Yidong's avatar Chong Yidong
Browse files

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.
parent e0fe1d55
2012-03-25 Chong Yidong <cyd@gnu.org>
* 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.
......
......@@ -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))))
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment