[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master aabaa9f: Apply non-user themes only when asked
From: |
Daniel Colascione |
Subject: |
[Emacs-diffs] master aabaa9f: Apply non-user themes only when asked |
Date: |
Sat, 16 Jun 2018 18:46:48 -0400 (EDT) |
branch: master
commit aabaa9f8c8b79df44887392fcaa199e17b016afd
Author: Daniel Colascione <address@hidden>
Commit: Daniel Colascione <address@hidden>
Apply non-user themes only when asked
Theme settings now generally aren't actually applied until a call to
`enable-theme-, either one made explicitly or implicitly through
`load-theme' with NO-ENABLE nil. This change has the effect of not
applying theme changes just because we load a lisp file containing a
theme specification. The previous behavior is preserved for the
special case of the `user' theme, which is frequently used for
ad-hoc customization.
* lisp/cus-face.el (custom-theme-set-faces): Call
`custom--should-apply-setting' to decide whether to apply
a setting.
* lisp/custom.el (custom--should-apply-setting): New function.
(custom--inhibit-theme-enable): Add `apply-only-user' option;
default to it.
(custom-push-theme, custom-theme-set-variables): Call
`custom--should-apply-setting' to decide whether to apply
a setting.
---
etc/NEWS | 9 +++++++++
lisp/cus-face.el | 2 +-
lisp/custom.el | 15 +++++++++++----
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index d59b4a7..39b8b5c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -518,6 +518,15 @@ names" in the Tramp manual for full documentation of these
facilities.
* Incompatible Lisp Changes in Emacs 27.1
++++
+** Theme settings generally aren't actually applied until a call to
+`enable-theme-, either one made explicitly or implicitly through
+`load-theme' with NO-ENABLE nil. This change has the effect of not
+applying theme changes just because we load a lisp file containing a
+theme specification. The previous behavior is preserved for the
+special case of the `user' theme, which is frequently used for
+ad-hoc customization.
+
** The 'repetitions' argument of 'benchmark-run' can now also be a variable.
** The FILENAME argument to 'file-name-base' is now mandatory and no
longer defaults to 'buffer-file-name'.
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index 2b352b3..039c1fa 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -342,7 +342,7 @@ argument list."
;; is aliased to.
(if (get face 'face-alias)
(setq face (get face 'face-alias)))
- (if custom--inhibit-theme-enable
+ (if (custom--should-apply-setting theme)
;; Just update theme settings.
(custom-push-theme 'theme-face face theme 'set spec)
;; Update theme settings and set the face spec.
diff --git a/lisp/custom.el b/lisp/custom.el
index 2a489c4..4a778a0 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -843,6 +843,11 @@ to the front of this list.")
(unless (custom-theme-p theme)
(error "Unknown theme `%s'" theme)))
+(defun custom--should-apply-setting (theme)
+ (or (null custom--inhibit-theme-enable)
+ (and (eq custom--inhibit-theme-enable 'apply-only-user)
+ (eq theme 'user))))
+
(defun custom-push-theme (prop symbol theme mode &optional value)
"Record VALUE for face or variable SYMBOL in custom theme THEME.
PROP is `theme-face' for a face, `theme-value' for a variable.
@@ -882,7 +887,7 @@ See `custom-known-themes' for a list of known themes."
(setcar (cdr setting) value)))
;; Add a new setting:
(t
- (unless custom--inhibit-theme-enable
+ (when (custom--should-apply-setting theme)
(unless old
;; If the user changed a variable outside of Customize, save
;; the value to a fake theme, `changed'. If the theme is
@@ -981,7 +986,7 @@ COMMENT is a comment string about SYMBOL."
(let* ((symbol (indirect-variable (nth 0 entry)))
(value (nth 1 entry)))
(custom-push-theme 'theme-value symbol theme 'set value)
- (unless custom--inhibit-theme-enable
+ (when (custom--should-apply-setting theme)
;; Now set the variable.
(let* ((now (nth 2 entry))
(requests (nth 3 entry))
@@ -1149,11 +1154,13 @@ This variable is designed for use in lisp code
(including
external packages). For manual user customizations, use
`custom-theme-directory' instead.")
-(defvar custom--inhibit-theme-enable nil
+(defvar custom--inhibit-theme-enable 'apply-only-user
"Whether the custom-theme-set-* functions act immediately.
If nil, `custom-theme-set-variables' and `custom-theme-set-faces'
change the current values of the given variable or face. If
-non-nil, they just make a record of the theme settings.")
+t, they just make a record of the theme settings. If the
+value is `apply-only-user', then apply setting to the
+`user' theme immediately and defer other updates.")
(defun provide-theme (theme)
"Indicate that this file provides THEME.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master aabaa9f: Apply non-user themes only when asked,
Daniel Colascione <=