diff options
| author | Luc Teirlinck | 2006-01-15 03:15:25 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2006-01-15 03:15:25 +0000 |
| commit | 025fddd4ed8413e1678a3e14935c462afd1eb668 (patch) | |
| tree | 6155a1630515f97751c2376eb8c8124c1152d00e | |
| parent | b41e2e73f41b44a8ea97579326b176e15bceb674 (diff) | |
| download | emacs-025fddd4ed8413e1678a3e14935c462afd1eb668.tar.gz emacs-025fddd4ed8413e1678a3e14935c462afd1eb668.zip | |
(Custom-set, Custom-save, Custom-reset-current, Custom-reset-saved):
Do not ask for confirmation in single option buffers.
| -rw-r--r-- | lisp/cus-edit.el | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 7b0563448a6..cf69ce61ac2 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -746,28 +746,35 @@ groups after non-groups, if nil do not order groups at all." | |||
| 746 | (defun Custom-set () | 746 | (defun Custom-set () |
| 747 | "Set the current value of all edited settings in the buffer." | 747 | "Set the current value of all edited settings in the buffer." |
| 748 | (interactive) | 748 | (interactive) |
| 749 | (if (y-or-n-p "Set all values according to this buffer? ") | 749 | (let ((children custom-options)) |
| 750 | (let ((children custom-options)) | 750 | (if (or (and (= 1 (length children)) |
| 751 | (memq (widget-type (car children)) | ||
| 752 | '(custom-variable custom-face))) | ||
| 753 | (y-or-n-p "Set all values according to this buffer? ")) | ||
| 751 | (mapc (lambda (child) | 754 | (mapc (lambda (child) |
| 752 | (when (eq (widget-get child :custom-state) 'modified) | 755 | (when (eq (widget-get child :custom-state) 'modified) |
| 753 | (widget-apply child :custom-set))) | 756 | (widget-apply child :custom-set))) |
| 754 | children)) | 757 | children) |
| 755 | (message "Aborted"))) | 758 | (message "Aborted")))) |
| 756 | 759 | ||
| 757 | (defun Custom-save () | 760 | (defun Custom-save () |
| 758 | "Set all edited settings, then save all settings that have been set. | 761 | "Set all edited settings, then save all settings that have been set. |
| 759 | If a setting was edited and set before, this saves it. | 762 | If a setting was edited and set before, this saves it. |
| 760 | If a setting was merely edited before, this sets it then saves it." | 763 | If a setting was merely edited before, this sets it then saves it." |
| 761 | (interactive) | 764 | (interactive) |
| 762 | (if (yes-or-no-p "Save all settings in this buffer? ") | 765 | (let ((children custom-options)) |
| 763 | (let ((children custom-options)) | 766 | (if (or (and (= 1 (length children)) |
| 764 | (mapc (lambda (child) | 767 | (memq (widget-type (car children)) |
| 765 | (when (memq (widget-get child :custom-state) | 768 | '(custom-variable custom-face))) |
| 766 | '(modified set changed rogue)) | 769 | (yes-or-no-p "Save all settings in this buffer? ")) |
| 767 | (widget-apply child :custom-save))) | 770 | (progn |
| 768 | children) | 771 | (mapc (lambda (child) |
| 769 | (custom-save-all)) | 772 | (when (memq (widget-get child :custom-state) |
| 770 | (message "Aborted"))) | 773 | '(modified set changed rogue)) |
| 774 | (widget-apply child :custom-save))) | ||
| 775 | children) | ||
| 776 | (custom-save-all)) | ||
| 777 | (message "Aborted")))) | ||
| 771 | 778 | ||
| 772 | (defvar custom-reset-menu | 779 | (defvar custom-reset-menu |
| 773 | '(("Undo Edits" . Custom-reset-current) | 780 | '(("Undo Edits" . Custom-reset-current) |
| @@ -790,27 +797,33 @@ when the action is chosen.") | |||
| 790 | (defun Custom-reset-current (&rest ignore) | 797 | (defun Custom-reset-current (&rest ignore) |
| 791 | "Reset all edited settings in the buffer to show their current values." | 798 | "Reset all edited settings in the buffer to show their current values." |
| 792 | (interactive) | 799 | (interactive) |
| 793 | (if (y-or-n-p "Reset all settings' buffer text to show current values? ") | 800 | (let ((children custom-options)) |
| 794 | (let ((children custom-options)) | 801 | (if (or (and (= 1 (length children)) |
| 802 | (memq (widget-type (car children)) | ||
| 803 | '(custom-variable custom-face))) | ||
| 804 | (y-or-n-p "Reset all settings' buffer text to show current values? ")) | ||
| 795 | (mapc (lambda (widget) | 805 | (mapc (lambda (widget) |
| 796 | (if (memq (widget-get widget :custom-state) | 806 | (if (memq (widget-get widget :custom-state) |
| 797 | '(modified changed)) | 807 | '(modified changed)) |
| 798 | (widget-apply widget :custom-reset-current))) | 808 | (widget-apply widget :custom-reset-current))) |
| 799 | children)) | 809 | children) |
| 800 | (message "Aborted"))) | 810 | (message "Aborted")))) |
| 801 | 811 | ||
| 802 | (defun Custom-reset-saved (&rest ignore) | 812 | (defun Custom-reset-saved (&rest ignore) |
| 803 | "Reset all edited or set settings in the buffer to their saved value. | 813 | "Reset all edited or set settings in the buffer to their saved value. |
| 804 | This also shows the saved values in the buffer." | 814 | This also shows the saved values in the buffer." |
| 805 | (interactive) | 815 | (interactive) |
| 806 | (if (y-or-n-p "Reset all settings (current values and buffer text) to saved values? ") | 816 | (let ((children custom-options)) |
| 807 | (let ((children custom-options)) | 817 | (if (or (and (= 1 (length children)) |
| 818 | (memq (widget-type (car children)) | ||
| 819 | '(custom-variable custom-face))) | ||
| 820 | (y-or-n-p "Reset all settings (current values and buffer text) to saved values? ")) | ||
| 808 | (mapc (lambda (widget) | 821 | (mapc (lambda (widget) |
| 809 | (if (memq (widget-get widget :custom-state) | 822 | (if (memq (widget-get widget :custom-state) |
| 810 | '(modified set changed rogue)) | 823 | '(modified set changed rogue)) |
| 811 | (widget-apply widget :custom-reset-saved))) | 824 | (widget-apply widget :custom-reset-saved))) |
| 812 | children)) | 825 | children) |
| 813 | (message "Aborted"))) | 826 | (message "Aborted")))) |
| 814 | 827 | ||
| 815 | (defun Custom-reset-standard (&rest ignore) | 828 | (defun Custom-reset-standard (&rest ignore) |
| 816 | "Erase all customization (either current or saved) for the group members. | 829 | "Erase all customization (either current or saved) for the group members. |