From: Mauro Aranda Date: Fri, 14 Aug 2020 14:40:40 +0000 (+0200) Subject: Make sure we only act on edited widgets in Custom-save X-Git-Tag: emacs-28.0.90~6584^2~32 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5c39f6f1165a33f5714eedd3a413f786dffbb5a2;p=emacs.git Make sure we only act on edited widgets in Custom-save * lisp/cus-edit.el (Custom-save): Only act on edited widgets in the buffer. If we attempt to redraw all widgets, we confuse custom-variable-modified-p, or we end up drawing State buttons for all options, including the hidden ones (bug#42801). --- diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 5ec5799f805..23ceb3a857a 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -801,16 +801,19 @@ has been executed, nil otherwise." If a setting was edited and set before, this saves it. If a setting was merely edited before, this sets it then saves it." (interactive) - (when (custom-command-apply - (lambda (child) - (when (memq (widget-get child :custom-state) - '(modified set changed rogue)) - (widget-apply child :custom-mark-to-save))) - "Save all settings in this buffer? " t) - ;; Save changes to buffer and redraw. - (custom-save-all) - (dolist (child custom-options) - (widget-apply child :custom-state-set-and-redraw)))) + (let (edited-widgets) + (when (custom-command-apply + (lambda (child) + (when (memq (widget-get child :custom-state) + '(modified set changed rogue)) + (push child edited-widgets) + (widget-apply child :custom-mark-to-save))) + "Save all settings in this buffer? " t) + ;; Save changes to buffer. + (custom-save-all) + ;; Redraw and recalculate the state when necessary. + (dolist (widget edited-widgets) + (widget-apply widget :custom-state-set-and-redraw))))) (defun custom-reset (_widget &optional event) "Select item from reset menu."