1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 19:10:37 -08:00

Reset to the standard value when reverting session's customizations

* lisp/cus-edit.el (custom-variable-reset-saved): When there is no
previous saved value, reset to the standard value.  (Bug#15214)
This commit is contained in:
Mauro Aranda 2019-12-30 18:10:28 -03:00 committed by Eli Zaretskii
parent d6f9b09777
commit 8addfa91c8

View file

@ -3035,17 +3035,18 @@ Update the widget to show that value. The value that was current
before this operation becomes the backup value." before this operation becomes the backup value."
(let* ((symbol (widget-value widget)) (let* ((symbol (widget-value widget))
(saved-value (get symbol 'saved-value)) (saved-value (get symbol 'saved-value))
(comment (get symbol 'saved-variable-comment))) (comment (get symbol 'saved-variable-comment))
value)
(custom-variable-backup-value widget) (custom-variable-backup-value widget)
(if (not (or saved-value comment)) (if (not (or saved-value comment))
;; If there is no saved value, remove the setting. ;; If there is no saved value, remove the setting.
(custom-push-theme 'theme-value symbol 'user 'reset) (custom-push-theme 'theme-value symbol 'user 'reset)
;; Otherwise, apply the saved value. (setq value (car-safe saved-value))
(put symbol 'variable-comment comment) (custom-push-theme 'theme-value symbol 'user 'set value)
(custom-push-theme 'theme-value symbol 'user 'set (car-safe saved-value)) (put symbol 'variable-comment comment))
(ignore-errors (ignore-errors
(funcall (or (get symbol 'custom-set) 'set-default) (funcall (or (get symbol 'custom-set) #'set-default) symbol
symbol (eval (car saved-value))))) (eval (or value (car (get symbol 'standard-value))))))
(put symbol 'customized-value nil) (put symbol 'customized-value nil)
(put symbol 'customized-variable-comment nil) (put symbol 'customized-variable-comment nil)
(widget-put widget :custom-state 'unknown) (widget-put widget :custom-state 'unknown)