# HG changeset patch # User Richard M. Stallman # Date 1136173110 0 # Node ID ece93c7b34d41f8f4b6b94937b268750d9ef447a # Parent 3ca8b22342378ced6704f0a0f466faaf07683764 (Custom-set, Custom-save): Ask for confirmation. (Custom-reset-current, Custom-reset-saved): Likewise. (Custom-reset-standard): Likewise. (custom-mode): Doc fix, describing those commands. diff -r 3ca8b2234237 -r ece93c7b34d4 lisp/cus-edit.el --- a/lisp/cus-edit.el Sun Jan 01 18:51:18 2006 +0000 +++ b/lisp/cus-edit.el Mon Jan 02 03:38:30 2006 +0000 @@ -746,22 +746,26 @@ (defun Custom-set () "Set changes in all modified options." (interactive) - (let ((children custom-options)) - (mapc (lambda (child) - (when (eq (widget-get child :custom-state) 'modified) - (widget-apply child :custom-set))) - children))) + (if (y-or-n-p "Set all values according to this buffer? ") + (let ((children custom-options)) + (mapc (lambda (child) + (when (eq (widget-get child :custom-state) 'modified) + (widget-apply child :custom-set))) + children)) + (message "Aborted"))) (defun Custom-save () "Set all modified group members and save them." (interactive) - (let ((children custom-options)) - (mapc (lambda (child) - (when (memq (widget-get child :custom-state) - '(modified set changed rogue)) - (widget-apply child :custom-save))) - children)) - (custom-save-all)) + (if (yes-or-no-p "Save all settings in this buffer? ") + (let ((children custom-options)) + (mapc (lambda (child) + (when (memq (widget-get child :custom-state) + '(modified set changed rogue)) + (widget-apply child :custom-save))) + children) + (custom-save-all)) + (message "Aborted"))) (defvar custom-reset-menu '(("Current" . Custom-reset-current) @@ -784,22 +788,26 @@ (defun Custom-reset-current (&rest ignore) "Reset all modified group members to their current value." (interactive) - (let ((children custom-options)) - (mapc (lambda (widget) - (if (memq (widget-get widget :custom-state) - '(modified changed)) - (widget-apply widget :custom-reset-current))) - children))) + (if (y-or-n-p "Update buffer text to show all current settings? ") + (let ((children custom-options)) + (mapc (lambda (widget) + (if (memq (widget-get widget :custom-state) + '(modified changed)) + (widget-apply widget :custom-reset-current))) + children)) + (message "Aborted"))) (defun Custom-reset-saved (&rest ignore) "Reset all modified or set group members to their saved value." (interactive) - (let ((children custom-options)) - (mapc (lambda (widget) - (if (memq (widget-get widget :custom-state) - '(modified set changed rogue)) - (widget-apply widget :custom-reset-saved))) - children))) + (if (y-or-n-p "Update buffer text to show all saved settings? ") + (let ((children custom-options)) + (mapc (lambda (widget) + (if (memq (widget-get widget :custom-state) + '(modified set changed rogue)) + (widget-apply widget :custom-reset-saved))) + children)) + (message "Aborted"))) (defun Custom-reset-standard (&rest ignore) "Erase all customization (either current or saved) for the group members. @@ -807,19 +815,21 @@ This operation eliminates any saved values for the group members, making them as if they had never been customized at all." (interactive) - (let ((children custom-options)) - (when (or (and (= 1 (length children)) - (memq (widget-type (car children)) - '(custom-variable custom-face))) - (yes-or-no-p "Really erase all customizations in this buffer? ")) - (mapc (lambda (widget) - (and (if (widget-get widget :custom-standard-value) - (widget-apply widget :custom-standard-value) - t) - (memq (widget-get widget :custom-state) - '(modified set changed saved rogue)) - (widget-apply widget :custom-reset-standard))) - children)))) + (if (yes-or-no-p "Eliminate saved values for all settings in this buffer? ") + (let ((children custom-options)) + (when (or (and (= 1 (length children)) + (memq (widget-type (car children)) + '(custom-variable custom-face))) + (yes-or-no-p "Really erase all customizations in this buffer? ")) + (mapc (lambda (widget) + (and (if (widget-get widget :custom-standard-value) + (widget-apply widget :custom-standard-value) + t) + (memq (widget-get widget :custom-state) + '(modified set changed saved rogue)) + (widget-apply widget :custom-reset-standard))) + children))) + (message "Aborted"))) ;;; The Customize Commands @@ -4405,11 +4415,12 @@ \\\ Invoke button under the mouse pointer. \\[Custom-move-and-invoke] Invoke button under point. \\[widget-button-press] -Set all modifications. \\[Custom-set] -Make all modifications default. \\[Custom-save] -Reset all modified options. \\[Custom-reset-current] -Reset all modified or set options. \\[Custom-reset-saved] -Reset all options. \\[Custom-reset-standard] +Set all options from current text. \\[Custom-set] +Make values in current text permanent. \\[Custom-save] +Make text match actual option values. \\[Custom-reset-current] +Reset options to permanent settings. \\[Custom-reset-saved] +Erase customizations; set options + and buffer text to the standard values. \\[Custom-reset-standard] Entry to this mode calls the value of `custom-mode-hook' if that value is non-nil."