diff options
| author | Martin Rudalics | 2008-01-16 16:22:29 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2008-01-16 16:22:29 +0000 |
| commit | 5ae87ed4147af1b70f5a1b2b8ab28a054d8d1048 (patch) | |
| tree | 5fd9749f03cfddcedf8830cce36a298064584252 | |
| parent | 656d4706ab9f836b5e24f7da29e420491a7976de (diff) | |
| download | emacs-5ae87ed4147af1b70f5a1b2b8ab28a054d8d1048.tar.gz emacs-5ae87ed4147af1b70f5a1b2b8ab28a054d8d1048.zip | |
(custom-reset-standard-variables-list)
(custom-reset-standard-faces-list): New variables.
(custom-reset-standard-save-and-update): New function.
(Custom-save): Apply custom-mark-to-save before and
custom-state-set-and-redraw after saving options.
(Custom-reset-standard): Apply custom-mark-to-reset-standard to
options and call custom-reset-standard-save-and-update.
(custom-variable, custom-face, custom-group): Provide new
entries for custom-mark-to-save, custom-mark-to-reset-standard,
and custom-state-set-and-redraw.
(custom-variable-mark-to-save)
(custom-variable-state-set-and-redraw)
(custom-variable-mark-to-reset-standard)
(custom-face-mark-to-save, custom-face-state-set-and-redraw)
(custom-face-mark-to-reset-standard)
(custom-group-mark-to-save, custom-group-state-set-and-redraw)
(custom-group-mark-to-reset-standard): New functions.
(custom-variable-save): Move save, state-set, and redraw
functionality to custom-variable-mark-to-save.
(custom-face-save): Move save, state-set, and redraw
functionality to custom-face-mark-to-save.
(custom-group-save): Move save, state-set, and redraw
functionality to custom-group-mark-to-save.
(custom-variable-reset-standard, custom-face-reset-standard)
(custom-group-reset-standard): Move save, state-set, and redraw
functionality to custom-reset-standard-save-and-update.
(custom-buffer-create-internal): Fix text in verbose help.
(custom-face-value-create): Indent doc-strings of faces like
those of variables.
| -rw-r--r-- | lisp/cus-edit.el | 265 |
1 files changed, 196 insertions, 69 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index c1071f3b3ef..7e014b4f7bd 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -826,16 +826,19 @@ and `yes-or-no-p' otherwise." | |||
| 826 | 826 | ||
| 827 | (defun Custom-save (&rest ignore) | 827 | (defun Custom-save (&rest ignore) |
| 828 | "Set all edited settings, then save all settings that have been set. | 828 | "Set all edited settings, then save all settings that have been set. |
| 829 | If a setting was edited and set before, this saves it. | 829 | If a setting was edited and set before, this saves it. If a |
| 830 | If a setting was merely edited before, this sets it then saves it." | 830 | setting was merely edited before, this sets it then saves it." |
| 831 | (interactive) | 831 | (interactive) |
| 832 | (if (custom-command-apply | 832 | (when (custom-command-apply |
| 833 | (lambda (child) | 833 | (lambda (child) |
| 834 | (when (memq (widget-get child :custom-state) | 834 | (when (memq (widget-get child :custom-state) |
| 835 | '(modified set changed rogue)) | 835 | '(modified set changed rogue)) |
| 836 | (widget-apply child :custom-save))) | 836 | (widget-apply child :custom-mark-to-save))) |
| 837 | "Save all settings in this buffer? " t) | 837 | "Save all settings in this buffer? " t) |
| 838 | (custom-save-all))) | 838 | ;; Save changes to buffer and redraw. |
| 839 | (custom-save-all) | ||
| 840 | (dolist (child custom-options) | ||
| 841 | (widget-apply child :custom-state-set-and-redraw)))) | ||
| 839 | 842 | ||
| 840 | (defun custom-reset (widget &optional event) | 843 | (defun custom-reset (widget &optional event) |
| 841 | "Select item from reset menu." | 844 | "Select item from reset menu." |
| @@ -865,20 +868,67 @@ This also shows the saved values in the buffer." | |||
| 865 | (widget-apply widget :custom-reset-saved))) | 868 | (widget-apply widget :custom-reset-saved))) |
| 866 | "Reset all settings (current values and buffer text) to saved values? ")) | 869 | "Reset all settings (current values and buffer text) to saved values? ")) |
| 867 | 870 | ||
| 871 | ;; The next two variables are bound to '(t) by `Custom-reset-standard' | ||
| 872 | ;; and `custom-group-reset-standard'. If these variables are nil, both | ||
| 873 | ;; `custom-variable-reset-standard' and `custom-face-reset-standard' | ||
| 874 | ;; save, reset and redraw the handled widget immediately. Otherwise, | ||
| 875 | ;; they add the widget to the corresponding list and leave it to | ||
| 876 | ;; `custom-reset-standard-save-and-update' to save, reset and redraw it. | ||
| 877 | (defvar custom-reset-standard-variables-list nil) | ||
| 878 | (defvar custom-reset-standard-faces-list nil) | ||
| 879 | |||
| 880 | ;; The next function was excerpted from `custom-variable-reset-standard' | ||
| 881 | ;; and `custom-face-reset-standard' and is used to avoid calling | ||
| 882 | ;; `custom-save-all' repeatedly (and thus saving settings to file one by | ||
| 883 | ;; one) when erasing all customizations. | ||
| 884 | (defun custom-reset-standard-save-and-update () | ||
| 885 | "Save settings and redraw after erasing customizations." | ||
| 886 | (when (or (and custom-reset-standard-variables-list | ||
| 887 | (not (eq custom-reset-standard-variables-list '(t)))) | ||
| 888 | (and custom-reset-standard-faces-list | ||
| 889 | (not (eq custom-reset-standard-faces-list '(t))))) | ||
| 890 | ;; Save settings to file. | ||
| 891 | (custom-save-all) | ||
| 892 | ;; Set state of and redraw variables. | ||
| 893 | (dolist (widget custom-reset-standard-variables-list) | ||
| 894 | (unless (eq widget t) | ||
| 895 | (widget-put widget :custom-state 'unknown) | ||
| 896 | (custom-redraw widget))) | ||
| 897 | ;; Set state of and redraw faces. | ||
| 898 | (dolist (widget custom-reset-standard-faces-list) | ||
| 899 | (unless (eq widget t) | ||
| 900 | (let* ((symbol (widget-value widget)) | ||
| 901 | (child (car (widget-get widget :children))) | ||
| 902 | (value (get symbol 'face-defface-spec)) | ||
| 903 | (comment-widget (widget-get widget :comment-widget))) | ||
| 904 | (put symbol 'face-comment nil) | ||
| 905 | (widget-value-set child | ||
| 906 | (custom-pre-filter-face-spec | ||
| 907 | (list (list t (custom-face-attributes-get | ||
| 908 | symbol nil))))) | ||
| 909 | ;; This call manages the comment visibility | ||
| 910 | (widget-value-set comment-widget "") | ||
| 911 | (custom-face-state-set widget) | ||
| 912 | (custom-redraw-magic widget)))))) | ||
| 913 | |||
| 868 | (defun Custom-reset-standard (&rest ignore) | 914 | (defun Custom-reset-standard (&rest ignore) |
| 869 | "Erase all customization (either current or saved) for the group members. | 915 | "Erase all customizations (either current or saved) in current buffer. |
| 870 | The immediate result is to restore them to their standard values. | 916 | The immediate result is to restore them to their standard values. |
| 871 | This operation eliminates any saved values for the group members, | 917 | This operation eliminates any saved values for the group members, |
| 872 | making them as if they had never been customized at all." | 918 | making them as if they had never been customized at all." |
| 873 | (interactive) | 919 | (interactive) |
| 874 | (custom-command-apply | 920 | ;; Bind these temporarily. |
| 875 | (lambda (widget) | 921 | (let ((custom-reset-standard-variables-list '(t)) |
| 876 | (and (or (null (widget-get widget :custom-standard-value)) | 922 | (custom-reset-standard-faces-list '(t))) |
| 877 | (widget-apply widget :custom-standard-value)) | 923 | (custom-command-apply |
| 878 | (memq (widget-get widget :custom-state) | 924 | (lambda (widget) |
| 879 | '(modified set changed saved rogue)) | 925 | (and (or (null (widget-get widget :custom-standard-value)) |
| 880 | (widget-apply widget :custom-reset-standard))) | 926 | (widget-apply widget :custom-standard-value)) |
| 881 | "Erase all customizations for settings in this buffer? " t)) | 927 | (memq (widget-get widget :custom-state) |
| 928 | '(modified set changed saved rogue)) | ||
| 929 | (widget-apply widget :custom-mark-to-reset-standard))) | ||
| 930 | "Erase all customizations for settings in this buffer? " t) | ||
| 931 | (custom-reset-standard-save-and-update))) | ||
| 882 | 932 | ||
| 883 | ;;; The Customize Commands | 933 | ;;; The Customize Commands |
| 884 | 934 | ||
| @@ -1535,7 +1585,7 @@ Otherwise use brackets." | |||
| 1535 | (widget-insert "Editing a setting changes only the text in this buffer." | 1585 | (widget-insert "Editing a setting changes only the text in this buffer." |
| 1536 | (if init-file | 1586 | (if init-file |
| 1537 | " | 1587 | " |
| 1538 | To set apply your changes, use the Save or Set buttons. | 1588 | To apply your changes, use the Save or Set buttons. |
| 1539 | Saving a change normally works by editing your init file." | 1589 | Saving a change normally works by editing your init file." |
| 1540 | " | 1590 | " |
| 1541 | Currently, these settings cannot be saved for future Emacs sessions, | 1591 | Currently, these settings cannot be saved for future Emacs sessions, |
| @@ -2441,11 +2491,13 @@ However, setting it through Custom sets the default value.") | |||
| 2441 | :value-create 'custom-variable-value-create | 2491 | :value-create 'custom-variable-value-create |
| 2442 | :action 'custom-variable-action | 2492 | :action 'custom-variable-action |
| 2443 | :custom-set 'custom-variable-set | 2493 | :custom-set 'custom-variable-set |
| 2444 | :custom-save 'custom-variable-save | 2494 | :custom-mark-to-save 'custom-variable-mark-to-save |
| 2445 | :custom-reset-current 'custom-redraw | 2495 | :custom-reset-current 'custom-redraw |
| 2446 | :custom-reset-saved 'custom-variable-reset-saved | 2496 | :custom-reset-saved 'custom-variable-reset-saved |
| 2447 | :custom-reset-standard 'custom-variable-reset-standard | 2497 | :custom-reset-standard 'custom-variable-reset-standard |
| 2448 | :custom-standard-value 'custom-variable-standard-value) | 2498 | :custom-mark-to-reset-standard 'custom-variable-mark-to-reset-standard |
| 2499 | :custom-standard-value 'custom-variable-standard-value | ||
| 2500 | :custom-state-set-and-redraw 'custom-variable-state-set-and-redraw) | ||
| 2449 | 2501 | ||
| 2450 | (defun custom-variable-type (symbol) | 2502 | (defun custom-variable-type (symbol) |
| 2451 | "Return a widget suitable for editing the value of SYMBOL. | 2503 | "Return a widget suitable for editing the value of SYMBOL. |
| @@ -2807,8 +2859,8 @@ Optional EVENT is the location for the menu." | |||
| 2807 | (custom-variable-state-set widget) | 2859 | (custom-variable-state-set widget) |
| 2808 | (custom-redraw-magic widget))) | 2860 | (custom-redraw-magic widget))) |
| 2809 | 2861 | ||
| 2810 | (defun custom-variable-save (widget) | 2862 | (defun custom-variable-mark-to-save (widget) |
| 2811 | "Set and save the value for the variable being edited by WIDGET." | 2863 | "Set value and mark for saving the variable edited by WIDGET." |
| 2812 | (let* ((form (widget-get widget :custom-form)) | 2864 | (let* ((form (widget-get widget :custom-form)) |
| 2813 | (state (widget-get widget :custom-state)) | 2865 | (state (widget-get widget :custom-state)) |
| 2814 | (child (car (widget-get widget :children))) | 2866 | (child (car (widget-get widget :children))) |
| @@ -2846,10 +2898,18 @@ Optional EVENT is the location for the menu." | |||
| 2846 | (put symbol 'variable-comment comment) | 2898 | (put symbol 'variable-comment comment) |
| 2847 | (put symbol 'saved-variable-comment comment))) | 2899 | (put symbol 'saved-variable-comment comment))) |
| 2848 | (put symbol 'customized-value nil) | 2900 | (put symbol 'customized-value nil) |
| 2849 | (put symbol 'customized-variable-comment nil) | 2901 | (put symbol 'customized-variable-comment nil))) |
| 2850 | (custom-save-all) | 2902 | |
| 2851 | (custom-variable-state-set widget) | 2903 | (defsubst custom-variable-state-set-and-redraw (widget) |
| 2852 | (custom-redraw-magic widget))) | 2904 | "Set state of variable widget WIDGET and redraw with current settings." |
| 2905 | (custom-variable-state-set widget) | ||
| 2906 | (custom-redraw-magic widget)) | ||
| 2907 | |||
| 2908 | (defun custom-variable-save (widget) | ||
| 2909 | "Save value of variable edited by widget WIDGET." | ||
| 2910 | (custom-variable-mark-to-save widget) | ||
| 2911 | (custom-save-all) | ||
| 2912 | (custom-variable-state-set-and-redraw widget)) | ||
| 2853 | 2913 | ||
| 2854 | (defun custom-variable-reset-saved (widget) | 2914 | (defun custom-variable-reset-saved (widget) |
| 2855 | "Restore the saved value for the variable being edited by WIDGET. | 2915 | "Restore the saved value for the variable being edited by WIDGET. |
| @@ -2875,12 +2935,10 @@ becomes the backup value, so you can get it again." | |||
| 2875 | ;; This call will possibly make the comment invisible | 2935 | ;; This call will possibly make the comment invisible |
| 2876 | (custom-redraw widget))) | 2936 | (custom-redraw widget))) |
| 2877 | 2937 | ||
| 2878 | (defun custom-variable-reset-standard (widget) | 2938 | (defun custom-variable-mark-to-reset-standard (widget) |
| 2879 | "Restore the standard setting for the variable being edited by WIDGET. | 2939 | "Mark to restore standard setting for the variable edited by widget WIDGET. |
| 2880 | This operation eliminates any saved setting for the variable, | 2940 | If `custom-reset-standard-variables-list' is nil, save, reset and |
| 2881 | restoring it to the state of a variable that has never been customized. | 2941 | redraw the widget immediately." |
| 2882 | The value that was current before this operation | ||
| 2883 | becomes the backup value, so you can get it again." | ||
| 2884 | (let* ((symbol (widget-value widget))) | 2942 | (let* ((symbol (widget-value widget))) |
| 2885 | (if (get symbol 'standard-value) | 2943 | (if (get symbol 'standard-value) |
| 2886 | (custom-variable-backup-value widget) | 2944 | (custom-variable-backup-value widget) |
| @@ -2890,13 +2948,32 @@ becomes the backup value, so you can get it again." | |||
| 2890 | (put symbol 'customized-variable-comment nil) | 2948 | (put symbol 'customized-variable-comment nil) |
| 2891 | (custom-push-theme 'theme-value symbol 'user 'reset) | 2949 | (custom-push-theme 'theme-value symbol 'user 'reset) |
| 2892 | (custom-theme-recalc-variable symbol) | 2950 | (custom-theme-recalc-variable symbol) |
| 2893 | (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) | 2951 | (if (and custom-reset-standard-variables-list |
| 2894 | (put symbol 'saved-value nil) | 2952 | (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))) |
| 2895 | (put symbol 'saved-variable-comment nil) | 2953 | (progn |
| 2896 | (custom-save-all)) | 2954 | (put symbol 'saved-value nil) |
| 2897 | (widget-put widget :custom-state 'unknown) | 2955 | (put symbol 'saved-variable-comment nil) |
| 2898 | ;; This call will possibly make the comment invisible | 2956 | ;; Append this to `custom-reset-standard-variables-list' to |
| 2899 | (custom-redraw widget))) | 2957 | ;; have `custom-reset-standard-save-and-update' save setting |
| 2958 | ;; to the file, update the widget's state, and redraw it. | ||
| 2959 | (setq custom-reset-standard-variables-list | ||
| 2960 | (cons widget custom-reset-standard-variables-list))) | ||
| 2961 | (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) | ||
| 2962 | (put symbol 'saved-value nil) | ||
| 2963 | (put symbol 'saved-variable-comment nil) | ||
| 2964 | (custom-save-all)) | ||
| 2965 | (widget-put widget :custom-state 'unknown) | ||
| 2966 | ;; This call will possibly make the comment invisible | ||
| 2967 | (custom-redraw widget)))) | ||
| 2968 | |||
| 2969 | (defun custom-variable-reset-standard (widget) | ||
| 2970 | "Restore standard setting for the variable edited by WIDGET. | ||
| 2971 | This operation eliminates any saved setting for the variable, | ||
| 2972 | restoring it to the state of a variable that has never been customized. | ||
| 2973 | The value that was current before this operation | ||
| 2974 | becomes the backup value, so you can get it again." | ||
| 2975 | (let (custom-reset-standard-variables-list) | ||
| 2976 | (custom-variable-mark-to-reset-standard widget))) | ||
| 2900 | 2977 | ||
| 2901 | (defun custom-variable-backup-value (widget) | 2978 | (defun custom-variable-backup-value (widget) |
| 2902 | "Back up the current value for WIDGET's variable. | 2979 | "Back up the current value for WIDGET's variable. |
| @@ -3172,11 +3249,13 @@ Only match frames that support the specified face attributes.") | |||
| 3172 | :custom-category 'face | 3249 | :custom-category 'face |
| 3173 | :custom-form nil ; defaults to value of `custom-face-default-form' | 3250 | :custom-form nil ; defaults to value of `custom-face-default-form' |
| 3174 | :custom-set 'custom-face-set | 3251 | :custom-set 'custom-face-set |
| 3175 | :custom-save 'custom-face-save | 3252 | :custom-mark-to-save 'custom-face-mark-to-save |
| 3176 | :custom-reset-current 'custom-redraw | 3253 | :custom-reset-current 'custom-redraw |
| 3177 | :custom-reset-saved 'custom-face-reset-saved | 3254 | :custom-reset-saved 'custom-face-reset-saved |
| 3178 | :custom-reset-standard 'custom-face-reset-standard | 3255 | :custom-reset-standard 'custom-face-reset-standard |
| 3256 | :custom-mark-to-reset-standard 'custom-face-mark-to-reset-standard | ||
| 3179 | :custom-standard-value 'custom-face-standard-value | 3257 | :custom-standard-value 'custom-face-standard-value |
| 3258 | :custom-state-set-and-redraw 'custom-face-state-set-and-redraw | ||
| 3180 | :custom-menu 'custom-face-menu-create) | 3259 | :custom-menu 'custom-face-menu-create) |
| 3181 | 3260 | ||
| 3182 | (define-widget 'custom-face-all 'editable-list | 3261 | (define-widget 'custom-face-all 'editable-list |
| @@ -3321,6 +3400,7 @@ SPEC must be a full face spec." | |||
| 3321 | ;; Update buttons. | 3400 | ;; Update buttons. |
| 3322 | (widget-put widget :buttons buttons) | 3401 | (widget-put widget :buttons buttons) |
| 3323 | ;; Insert documentation. | 3402 | ;; Insert documentation. |
| 3403 | (widget-put widget :documentation-indent 3) | ||
| 3324 | (widget-add-documentation-string-button | 3404 | (widget-add-documentation-string-button |
| 3325 | widget :visibility-widget 'custom-visibility) | 3405 | widget :visibility-widget 'custom-visibility) |
| 3326 | 3406 | ||
| @@ -3510,8 +3590,8 @@ Optional EVENT is the location for the menu." | |||
| 3510 | (custom-face-state-set widget) | 3590 | (custom-face-state-set widget) |
| 3511 | (custom-redraw-magic widget))) | 3591 | (custom-redraw-magic widget))) |
| 3512 | 3592 | ||
| 3513 | (defun custom-face-save (widget) | 3593 | (defun custom-face-mark-to-save (widget) |
| 3514 | "Save in `.emacs' the face attributes in WIDGET." | 3594 | "Mark for saving the face edited by WIDGET." |
| 3515 | (let* ((symbol (widget-value widget)) | 3595 | (let* ((symbol (widget-value widget)) |
| 3516 | (child (car (widget-get widget :children))) | 3596 | (child (car (widget-get widget :children))) |
| 3517 | (value (custom-post-filter-face-spec (widget-value child))) | 3597 | (value (custom-post-filter-face-spec (widget-value child))) |
| @@ -3532,10 +3612,18 @@ Optional EVENT is the location for the menu." | |||
| 3532 | (put symbol 'customized-face nil) | 3612 | (put symbol 'customized-face nil) |
| 3533 | (put symbol 'face-comment comment) | 3613 | (put symbol 'face-comment comment) |
| 3534 | (put symbol 'customized-face-comment nil) | 3614 | (put symbol 'customized-face-comment nil) |
| 3535 | (put symbol 'saved-face-comment comment) | 3615 | (put symbol 'saved-face-comment comment))) |
| 3536 | (custom-save-all) | 3616 | |
| 3537 | (custom-face-state-set widget) | 3617 | (defsubst custom-face-state-set-and-redraw (widget) |
| 3538 | (custom-redraw-magic widget))) | 3618 | "Set state of face widget WIDGET and redraw with current settings." |
| 3619 | (custom-face-state-set widget) | ||
| 3620 | (custom-redraw-magic widget)) | ||
| 3621 | |||
| 3622 | (defun custom-face-save (widget) | ||
| 3623 | "Save the face edited by WIDGET." | ||
| 3624 | (custom-face-mark-to-save widget) | ||
| 3625 | (custom-save-all) | ||
| 3626 | (custom-face-state-set-and-redraw widget)) | ||
| 3539 | 3627 | ||
| 3540 | ;; For backward compatibility. | 3628 | ;; For backward compatibility. |
| 3541 | (define-obsolete-function-alias 'custom-face-save-command 'custom-face-save | 3629 | (define-obsolete-function-alias 'custom-face-save-command 'custom-face-save |
| @@ -3564,10 +3652,10 @@ Optional EVENT is the location for the menu." | |||
| 3564 | (defun custom-face-standard-value (widget) | 3652 | (defun custom-face-standard-value (widget) |
| 3565 | (get (widget-value widget) 'face-defface-spec)) | 3653 | (get (widget-value widget) 'face-defface-spec)) |
| 3566 | 3654 | ||
| 3567 | (defun custom-face-reset-standard (widget) | 3655 | (defun custom-face-mark-to-reset-standard (widget) |
| 3568 | "Restore WIDGET to the face's standard attribute values. | 3656 | "Restore widget WIDGET to the face's standard attribute values. |
| 3569 | This operation eliminates any saved attributes for the face, | 3657 | If `custom-reset-standard-faces-list' is nil, save, reset and |
| 3570 | restoring it to the state of a face that has never been customized." | 3658 | redraw the widget immediately." |
| 3571 | (let* ((symbol (widget-value widget)) | 3659 | (let* ((symbol (widget-value widget)) |
| 3572 | (child (car (widget-get widget :children))) | 3660 | (child (car (widget-get widget :children))) |
| 3573 | (value (get symbol 'face-defface-spec)) | 3661 | (value (get symbol 'face-defface-spec)) |
| @@ -3579,19 +3667,37 @@ restoring it to the state of a face that has never been customized." | |||
| 3579 | (custom-push-theme 'theme-face symbol 'user 'reset) | 3667 | (custom-push-theme 'theme-face symbol 'user 'reset) |
| 3580 | (face-spec-set symbol value t) | 3668 | (face-spec-set symbol value t) |
| 3581 | (custom-theme-recalc-face symbol) | 3669 | (custom-theme-recalc-face symbol) |
| 3582 | (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) | 3670 | (if (and custom-reset-standard-faces-list |
| 3583 | (put symbol 'saved-face nil) | 3671 | (or (get symbol 'saved-face) (get symbol 'saved-face-comment))) |
| 3584 | (put symbol 'saved-face-comment nil) | 3672 | ;; Do this later. |
| 3585 | (custom-save-all)) | 3673 | (progn |
| 3586 | (put symbol 'face-comment nil) | 3674 | (put symbol 'saved-face nil) |
| 3587 | (widget-value-set child | 3675 | (put symbol 'saved-face-comment nil) |
| 3588 | (custom-pre-filter-face-spec | 3676 | ;; Append this to `custom-reset-standard-faces-list' and have |
| 3589 | (list (list t (custom-face-attributes-get | 3677 | ;; `custom-reset-standard-save-and-update' save setting to the |
| 3590 | symbol nil))))) | 3678 | ;; file, update the widget's state, and redraw it. |
| 3591 | ;; This call manages the comment visibility | 3679 | (setq custom-reset-standard-faces-list |
| 3592 | (widget-value-set comment-widget "") | 3680 | (cons widget custom-reset-standard-faces-list))) |
| 3593 | (custom-face-state-set widget) | 3681 | (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) |
| 3594 | (custom-redraw-magic widget))) | 3682 | (put symbol 'saved-face nil) |
| 3683 | (put symbol 'saved-face-comment nil) | ||
| 3684 | (custom-save-all)) | ||
| 3685 | (put symbol 'face-comment nil) | ||
| 3686 | (widget-value-set child | ||
| 3687 | (custom-pre-filter-face-spec | ||
| 3688 | (list (list t (custom-face-attributes-get | ||
| 3689 | symbol nil))))) | ||
| 3690 | ;; This call manages the comment visibility | ||
| 3691 | (widget-value-set comment-widget "") | ||
| 3692 | (custom-face-state-set widget) | ||
| 3693 | (custom-redraw-magic widget)))) | ||
| 3694 | |||
| 3695 | (defun custom-face-reset-standard (widget) | ||
| 3696 | "Restore WIDGET to the face's standard attribute values. | ||
| 3697 | This operation eliminates any saved attributes for the face, | ||
| 3698 | restoring it to the state of a face that has never been customized." | ||
| 3699 | (let (custom-reset-standard-faces-list) | ||
| 3700 | (custom-face-mark-to-reset-standard widget))) | ||
| 3595 | 3701 | ||
| 3596 | ;;; The `face' Widget. | 3702 | ;;; The `face' Widget. |
| 3597 | 3703 | ||
| @@ -3736,10 +3842,12 @@ and so forth. The remaining group tags are shown with `custom-group-tag'." | |||
| 3736 | :action 'custom-group-action | 3842 | :action 'custom-group-action |
| 3737 | :custom-category 'group | 3843 | :custom-category 'group |
| 3738 | :custom-set 'custom-group-set | 3844 | :custom-set 'custom-group-set |
| 3739 | :custom-save 'custom-group-save | 3845 | :custom-mark-to-save 'custom-group-mark-to-save |
| 3740 | :custom-reset-current 'custom-group-reset-current | 3846 | :custom-reset-current 'custom-group-reset-current |
| 3741 | :custom-reset-saved 'custom-group-reset-saved | 3847 | :custom-reset-saved 'custom-group-reset-saved |
| 3742 | :custom-reset-standard 'custom-group-reset-standard | 3848 | :custom-reset-standard 'custom-group-reset-standard |
| 3849 | :custom-mark-to-reset-standard 'custom-group-mark-to-reset-standard | ||
| 3850 | :custom-state-set-and-redraw 'custom-group-state-set-and-redraw | ||
| 3743 | :custom-menu 'custom-group-menu-create) | 3851 | :custom-menu 'custom-group-menu-create) |
| 3744 | 3852 | ||
| 3745 | (defun custom-group-sample-face-get (widget) | 3853 | (defun custom-group-sample-face-get (widget) |
| @@ -4034,11 +4142,23 @@ Optional EVENT is the location for the menu." | |||
| 4034 | (when (eq (widget-get child :custom-state) 'modified) | 4142 | (when (eq (widget-get child :custom-state) 'modified) |
| 4035 | (widget-apply child :custom-set)))) | 4143 | (widget-apply child :custom-set)))) |
| 4036 | 4144 | ||
| 4037 | (defun custom-group-save (widget) | 4145 | (defun custom-group-mark-to-save (widget) |
| 4038 | "Save all modified group members." | 4146 | "Mark all modified group members for saving." |
| 4039 | (dolist (child (widget-get widget :children)) | 4147 | (dolist (child (widget-get widget :children)) |
| 4040 | (when (memq (widget-get child :custom-state) '(modified set)) | 4148 | (when (memq (widget-get child :custom-state) '(modified set)) |
| 4041 | (widget-apply child :custom-save)))) | 4149 | (widget-apply child :custom-mark-to-save)))) |
| 4150 | |||
| 4151 | (defsubst custom-group-state-set-and-redraw (widget) | ||
| 4152 | "Set state of group widget WIDGET and redraw with current settings." | ||
| 4153 | (dolist (child (widget-get widget :children)) | ||
| 4154 | (when (memq (widget-get child :custom-state) '(modified set)) | ||
| 4155 | (widget-apply child :custom-state-set-and-redraw)))) | ||
| 4156 | |||
| 4157 | (defun custom-group-save (widget) | ||
| 4158 | "Save all modified group members." | ||
| 4159 | (custom-group-mark-to-save widget) | ||
| 4160 | (custom-save-all) | ||
| 4161 | (custom-group-state-set-and-redraw widget)) | ||
| 4042 | 4162 | ||
| 4043 | (defun custom-group-reset-current (widget) | 4163 | (defun custom-group-reset-current (widget) |
| 4044 | "Reset all modified group members." | 4164 | "Reset all modified group members." |
| @@ -4054,10 +4174,17 @@ Optional EVENT is the location for the menu." | |||
| 4054 | 4174 | ||
| 4055 | (defun custom-group-reset-standard (widget) | 4175 | (defun custom-group-reset-standard (widget) |
| 4056 | "Reset all modified, set, or saved group members." | 4176 | "Reset all modified, set, or saved group members." |
| 4177 | (let ((custom-reset-standard-variables-list '(t)) | ||
| 4178 | (custom-reset-standard-faces-list '(t))) | ||
| 4179 | (custom-group-mark-to-reset-standard widget) | ||
| 4180 | (custom-reset-standard-save-and-update))) | ||
| 4181 | |||
| 4182 | (defun custom-group-mark-to-reset-standard (widget) | ||
| 4183 | "Mark to reset all modified, set, or saved group members." | ||
| 4057 | (dolist (child (widget-get widget :children)) | 4184 | (dolist (child (widget-get widget :children)) |
| 4058 | (when (memq (widget-get child :custom-state) | 4185 | (when (memq (widget-get child :custom-state) |
| 4059 | '(modified set saved)) | 4186 | '(modified set saved)) |
| 4060 | (widget-apply child :custom-reset-standard)))) | 4187 | (widget-apply child :custom-mark-to-reset-standard)))) |
| 4061 | 4188 | ||
| 4062 | (defun custom-group-state-update (widget) | 4189 | (defun custom-group-state-update (widget) |
| 4063 | "Update magic." | 4190 | "Update magic." |