diff options
Diffstat (limited to 'lisp/custom.el')
-rw-r--r-- | lisp/custom.el | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/lisp/custom.el b/lisp/custom.el index 885c486c5e4..cc445fe765b 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -758,6 +758,9 @@ Return non-nil if the `customized-value' property actually changed." (progn (put symbol 'customized-value (list (custom-quote value))) (custom-push-theme 'theme-value symbol 'user 'set (custom-quote value))) + (custom-push-theme 'theme-value symbol 'user + (if (get symbol 'saved-value) 'set 'reset) + (custom-quote value)) (put symbol 'customized-value nil)) ;; Changed? (not (equal customized (get symbol 'customized-value))))) @@ -904,7 +907,15 @@ See `custom-known-themes' for a list of known themes." (boundp symbol)) (let ((sv (get symbol 'standard-value)) (val (symbol-value symbol))) - (unless (and sv (equal (eval (car sv)) val)) + (unless (or + ;; We only do this trick if the current value + ;; is different from the standard value. + (and sv (equal (eval (car sv)) val)) + ;; And we don't do it if we would end up recording + ;; the same value for the user theme. This way we avoid + ;; having ((user VALUE) (changed VALUE)). That would be + ;; useless, because we don't disable the user theme. + (and (eq theme 'user) (equal (custom-quote val) value))) (setq old `((changed ,(custom-quote val)))))))) (put symbol prop (cons (list theme value) old))) (put theme 'theme-settings @@ -1365,13 +1376,14 @@ function runs. To disable other themes, use `disable-theme'." obarray (lambda (sym) (get sym 'theme-settings)) t)))) (unless (custom-theme-p theme) (error "Undefined Custom theme %s" theme)) - (let ((settings (get theme 'theme-settings))) + (let ((settings (get theme 'theme-settings)) ; '(prop symbol theme value) + ;; We are enabling the theme, so don't inhibit enabling it. (Bug#34027) + (custom--inhibit-theme-enable nil)) ;; Loop through theme settings, recalculating vars/faces. (dolist (s settings) (let* ((prop (car s)) - (symbol (cadr s)) - (spec-list (get symbol prop))) - (put symbol prop (cons (cddr s) (assq-delete-all theme spec-list))) + (symbol (cadr s))) + (custom-push-theme prop symbol theme 'set (nth 3 s)) (cond ((eq prop 'theme-face) (custom-theme-recalc-face symbol)) @@ -1440,7 +1452,7 @@ See `custom-enabled-themes' for a list of enabled themes." (let* ((prop (car s)) (symbol (cadr s)) (val (assq-delete-all theme (get symbol prop)))) - (put symbol prop val) + (custom-push-theme prop symbol theme 'reset) (cond ((eq prop 'theme-value) (custom-theme-recalc-variable symbol)) @@ -1541,6 +1553,20 @@ Each of the arguments ARGS has this form: This means reset VARIABLE. (The argument IGNORED is ignored)." (apply #'custom-theme-reset-variables 'user args)) +(defun custom-add-choice (variable choice) + "Add CHOICE to the custom type of VARIABLE. +If a choice with the same tag already exists, no action is taken." + (let ((choices (get variable 'custom-type))) + (unless (eq (car choices) 'choice) + (error "Not a choice type: %s" choices)) + (unless (seq-find (lambda (elem) + (equal (caddr (member :tag elem)) + (caddr (member :tag choice)))) + (cdr choices)) + ;; Put the new choice at the end. + (put variable 'custom-type + (append choices (list choice)))))) + ;;; The End. (provide 'custom) |