Mercurial > emacs
changeset 67970:ece93c7b34d4
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 02 Jan 2006 03:38:30 +0000 |
parents | 3ca8b2234237 |
children | 8920c7a39a29 |
files | lisp/cus-edit.el |
diffstat | 1 files changed, 53 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ \\<custom-mode-map>\ 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."