Mercurial > hg > xemacs-beta
comparison lisp/cus-edit.el @ 480:e07227fed94e
[xemacs-hg @ 2001-04-23 16:18:04 by didierv]
Options saving: simple change, big gain
author | didierv |
---|---|
date | Mon, 23 Apr 2001 16:18:04 +0000 |
parents | 6a8b2ec80a19 |
children | 93749ba3e629 |
comparison
equal
deleted
inserted
replaced
479:52626a2f02ef | 480:e07227fed94e |
---|---|
560 (when (eq (widget-get child :custom-state) 'modified) | 560 (when (eq (widget-get child :custom-state) 'modified) |
561 (widget-apply child :custom-set))) | 561 (widget-apply child :custom-set))) |
562 children))) | 562 children))) |
563 | 563 |
564 (defun Custom-save () | 564 (defun Custom-save () |
565 "Set all modified group members and save them." | 565 "Set all modified options and save them." |
566 (interactive) | 566 (interactive) |
567 (let ((children custom-options)) | 567 (let ((all-children custom-options) |
568 children) | |
568 (mapc (lambda (child) | 569 (mapc (lambda (child) |
569 (when (memq (widget-get child :custom-state) '(modified set)) | 570 (when (memq (widget-get child :custom-state) '(modified set)) |
570 (widget-apply child :custom-save))) | 571 (push child children))) |
571 children)) | 572 all-children) |
572 (custom-save-all)) | 573 (let ((the-children children) |
574 child) | |
575 (while (setq child (pop the-children)) | |
576 (widget-apply child :custom-pre-save))) | |
577 (custom-save-all) | |
578 (let ((the-children children) | |
579 child) | |
580 (while (setq child (pop the-children)) | |
581 (widget-apply child :custom-post-save))) | |
582 )) | |
573 | 583 |
574 (defvar custom-reset-menu | 584 (defvar custom-reset-menu |
575 '(("Current" . Custom-reset-current) | 585 '(("Current" . Custom-reset-current) |
576 ("Saved" . Custom-reset-saved) | 586 ("Saved" . Custom-reset-saved) |
577 ("Standard Settings" . Custom-reset-standard)) | 587 ("Standard Settings" . Custom-reset-standard)) |
608 children))) | 618 children))) |
609 | 619 |
610 (defun Custom-reset-standard (&rest ignore) | 620 (defun Custom-reset-standard (&rest ignore) |
611 "Reset all modified, set, or saved group members to their standard settings." | 621 "Reset all modified, set, or saved group members to their standard settings." |
612 (interactive) | 622 (interactive) |
613 (let ((children custom-options)) | 623 (let ((all-children custom-options) |
624 children must-save) | |
614 (mapc (lambda (child) | 625 (mapc (lambda (child) |
615 (when (memq (widget-get child :custom-state) '(modified set saved)) | 626 (when (memq (widget-get child :custom-state) '(modified set saved)) |
616 (widget-apply child :custom-reset-standard))) | 627 (push child children))) |
617 children))) | 628 all-children) |
629 (let ((the-children children) | |
630 child) | |
631 (while (setq child (pop the-children)) | |
632 (and (widget-apply child :custom-pre-reset-standard) | |
633 (setq must-save t)))) | |
634 (and must-save (custom-save-all)) | |
635 (let ((the-children children) | |
636 child) | |
637 (while (setq child (pop the-children)) | |
638 (widget-apply child :custom-post-reset-standard))) | |
639 )) | |
618 | 640 |
619 | 641 |
620 ;;; The Customize Commands | 642 ;;; The Customize Commands |
621 | 643 |
622 (defun custom-prompt-variable (prompt-var prompt-val &optional comment) | 644 (defun custom-prompt-variable (prompt-var prompt-val &optional comment) |
1846 :custom-menu 'custom-variable-menu-create | 1868 :custom-menu 'custom-variable-menu-create |
1847 :custom-form nil ; defaults to value of `custom-variable-default-form' | 1869 :custom-form nil ; defaults to value of `custom-variable-default-form' |
1848 :value-create 'custom-variable-value-create | 1870 :value-create 'custom-variable-value-create |
1849 :action 'custom-variable-action | 1871 :action 'custom-variable-action |
1850 :custom-set 'custom-variable-set | 1872 :custom-set 'custom-variable-set |
1873 :custom-pre-save 'custom-variable-pre-save | |
1851 :custom-save 'custom-variable-save | 1874 :custom-save 'custom-variable-save |
1875 :custom-post-save 'custom-variable-post-save | |
1852 :custom-reset-current 'custom-redraw | 1876 :custom-reset-current 'custom-redraw |
1853 :custom-reset-saved 'custom-variable-reset-saved | 1877 :custom-reset-saved 'custom-variable-reset-saved |
1854 :custom-reset-standard 'custom-variable-reset-standard) | 1878 :custom-pre-reset-standard 'custom-variable-pre-reset-standard |
1879 :custom-reset-standard 'custom-variable-reset-standard | |
1880 :custom-post-reset-standard 'custom-variable-post-reset-standard) | |
1855 | 1881 |
1856 (defun custom-variable-type (symbol) | 1882 (defun custom-variable-type (symbol) |
1857 "Return a widget suitable for editing the value of SYMBOL. | 1883 "Return a widget suitable for editing the value of SYMBOL. |
1858 If SYMBOL has a `custom-type' property, use that. | 1884 If SYMBOL has a `custom-type' property, use that. |
1859 Otherwise, look up symbol in `custom-guess-type-alist'." | 1885 Otherwise, look up symbol in `custom-guess-type-alist'." |
2173 (put symbol 'variable-comment comment) | 2199 (put symbol 'variable-comment comment) |
2174 (put symbol 'customized-variable-comment comment))) | 2200 (put symbol 'customized-variable-comment comment))) |
2175 (custom-variable-state-set widget) | 2201 (custom-variable-state-set widget) |
2176 (custom-redraw-magic widget))) | 2202 (custom-redraw-magic widget))) |
2177 | 2203 |
2178 (defun custom-variable-save (widget) | 2204 (defun custom-variable-pre-save (widget) |
2179 "Set and save the value for the variable being edited by WIDGET." | 2205 "Prepare for saving the value for the variable being edited by WIDGET." |
2180 (let* ((form (widget-get widget :custom-form)) | 2206 (let* ((form (widget-get widget :custom-form)) |
2181 (state (widget-get widget :custom-state)) | 2207 (state (widget-get widget :custom-state)) |
2182 (child (car (widget-get widget :children))) | 2208 (child (car (widget-get widget :children))) |
2183 (symbol (widget-value widget)) | 2209 (symbol (widget-value widget)) |
2184 (set (or (get symbol 'custom-set) 'set-default)) | 2210 (set (or (get symbol 'custom-set) 'set-default)) |
2211 (put symbol | 2237 (put symbol |
2212 'saved-value (list (custom-quote (widget-value | 2238 'saved-value (list (custom-quote (widget-value |
2213 child)))) | 2239 child)))) |
2214 (custom-push-theme 'theme-value symbol 'user | 2240 (custom-push-theme 'theme-value symbol 'user |
2215 'set (list (custom-quote (widget-value | 2241 'set (list (custom-quote (widget-value |
2216 child)))) | 2242 child)))) |
2217 (funcall set symbol (widget-value child)) | 2243 (funcall set symbol (widget-value child)) |
2218 (put symbol 'variable-comment comment) | 2244 (put symbol 'variable-comment comment) |
2219 (put symbol 'saved-variable-comment comment))) | 2245 (put symbol 'saved-variable-comment comment))) |
2220 (put symbol 'customized-value nil) | 2246 (put symbol 'customized-value nil) |
2221 (put symbol 'customized-variable-comment nil) | 2247 (put symbol 'customized-variable-comment nil) |
2222 (custom-save-all) | 2248 )) |
2223 (custom-variable-state-set widget) | 2249 |
2224 (custom-redraw-magic widget))) | 2250 (defun custom-variable-post-save (widget) |
2251 "Finish saving the variable being edited by WIDGET." | |
2252 (custom-variable-state-set widget) | |
2253 (custom-redraw-magic widget)) | |
2254 | |
2255 (defun custom-variable-save (widget) | |
2256 "Set and save the value for the variable being edited by WIDGET." | |
2257 (custom-variable-pre-save widget) | |
2258 (custom-save-all) | |
2259 (custom-variable-post-save widget)) | |
2225 | 2260 |
2226 (defun custom-variable-reset-saved (widget) | 2261 (defun custom-variable-reset-saved (widget) |
2227 "Restore the saved value for the variable being edited by WIDGET." | 2262 "Restore the saved value for the variable being edited by WIDGET." |
2228 (let* ((symbol (widget-value widget)) | 2263 (let* ((symbol (widget-value widget)) |
2229 (set (or (get symbol 'custom-set) 'set-default)) | 2264 (set (or (get symbol 'custom-set) 'set-default)) |
2240 (put symbol 'customized-variable-comment nil) | 2275 (put symbol 'customized-variable-comment nil) |
2241 (widget-put widget :custom-state 'unknown) | 2276 (widget-put widget :custom-state 'unknown) |
2242 ;; This call will possibly make the comment invisible | 2277 ;; This call will possibly make the comment invisible |
2243 (custom-redraw widget))) | 2278 (custom-redraw widget))) |
2244 | 2279 |
2245 (defun custom-variable-reset-standard (widget) | 2280 ;; This function returns non nil if we need to re-save the options --dv. |
2246 "Restore the standard setting for the variable being edited by WIDGET." | 2281 (defun custom-variable-pre-reset-standard (widget) |
2282 "Prepare for restoring the variable being edited by WIDGET to its | |
2283 standard setting." | |
2247 (let* ((symbol (widget-value widget)) | 2284 (let* ((symbol (widget-value widget)) |
2248 (set (or (get symbol 'custom-set) 'set-default))) | 2285 (set (or (get symbol 'custom-set) 'set-default))) |
2249 (if (get symbol 'standard-value) | 2286 (if (get symbol 'standard-value) |
2250 (funcall set symbol (eval (car (get symbol 'standard-value)))) | 2287 (funcall set symbol (eval (car (get symbol 'standard-value)))) |
2251 (signal 'error (list "No standard setting known for variable" symbol))) | 2288 (signal 'error (list "No standard setting known for variable" symbol))) |
2254 (put symbol 'customized-variable-comment nil) | 2291 (put symbol 'customized-variable-comment nil) |
2255 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) | 2292 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) |
2256 (put symbol 'saved-value nil) | 2293 (put symbol 'saved-value nil) |
2257 (custom-push-theme 'theme-value symbol 'user 'reset 'standard) | 2294 (custom-push-theme 'theme-value symbol 'user 'reset 'standard) |
2258 ;; As a special optimizations we do not (explictly) | 2295 ;; As a special optimizations we do not (explictly) |
2259 ;; save resets to standard when no theme set the value. | 2296 ;; save resets to standard when no theme sets the value. |
2260 (if (null (cdr (get symbol 'theme-value))) | 2297 (if (null (cdr (get symbol 'theme-value))) |
2261 (put symbol 'theme-value nil)) | 2298 (put symbol 'theme-value nil)) |
2262 (put symbol 'saved-variable-comment nil) | 2299 (put symbol 'saved-variable-comment nil) |
2263 (custom-save-all)) | 2300 widget) |
2264 (widget-put widget :custom-state 'unknown) | 2301 )) |
2265 ;; This call will possibly make the comment invisible | 2302 |
2266 (custom-redraw widget))) | 2303 (defun custom-variable-post-reset-standard (widget) |
2304 "Finish resetting the variable being edited by WIDGET to its standard | |
2305 value." | |
2306 (widget-put widget :custom-state 'unknown) | |
2307 ;; This call will possibly make the comment invisible | |
2308 (custom-redraw widget)) | |
2309 | |
2310 (defun custom-variable-reset-standard (widget) | |
2311 "Restore the standard setting for the variable being edited by WIDGET." | |
2312 (when (custom-variable-pre-reset-standard widget) | |
2313 (custom-save-all)) | |
2314 (custom-variable-post-reset-standard widget)) | |
2315 | |
2267 | 2316 |
2268 ;;; The `custom-face-edit' Widget. | 2317 ;;; The `custom-face-edit' Widget. |
2269 | 2318 |
2270 (define-widget 'custom-face-edit 'checklist | 2319 (define-widget 'custom-face-edit 'checklist |
2271 "Edit face attributes." | 2320 "Edit face attributes." |
2388 :value-create 'custom-face-value-create | 2437 :value-create 'custom-face-value-create |
2389 :action 'custom-face-action | 2438 :action 'custom-face-action |
2390 :custom-category 'face | 2439 :custom-category 'face |
2391 :custom-form nil ; defaults to value of `custom-face-default-form' | 2440 :custom-form nil ; defaults to value of `custom-face-default-form' |
2392 :custom-set 'custom-face-set | 2441 :custom-set 'custom-face-set |
2442 :custom-pre-save 'custom-face-pre-save | |
2393 :custom-save 'custom-face-save | 2443 :custom-save 'custom-face-save |
2444 :custom-post-save 'custom-face-post-save | |
2394 :custom-reset-current 'custom-redraw | 2445 :custom-reset-current 'custom-redraw |
2395 :custom-reset-saved 'custom-face-reset-saved | 2446 :custom-reset-saved 'custom-face-reset-saved |
2447 :custom-pre-reset-standard 'custom-face-pre-reset-standard | |
2396 :custom-reset-standard 'custom-face-reset-standard | 2448 :custom-reset-standard 'custom-face-reset-standard |
2449 :custom-post-reset-standard 'custom-face-post-reset-standard | |
2397 :custom-menu 'custom-face-menu-create) | 2450 :custom-menu 'custom-face-menu-create) |
2398 | 2451 |
2399 (define-widget 'custom-face-all 'editable-list | 2452 (define-widget 'custom-face-all 'editable-list |
2400 "An editable list of display specifications and attributes." | 2453 "An editable list of display specifications and attributes." |
2401 :entry-format "%i %d %v" | 2454 :entry-format "%i %d %v" |
2634 (put symbol 'customized-face-comment comment) | 2687 (put symbol 'customized-face-comment comment) |
2635 (put symbol 'face-comment comment) | 2688 (put symbol 'face-comment comment) |
2636 (custom-face-state-set widget) | 2689 (custom-face-state-set widget) |
2637 (custom-redraw-magic widget))) | 2690 (custom-redraw-magic widget))) |
2638 | 2691 |
2639 (defun custom-face-save (widget) | 2692 (defun custom-face-pre-save (widget) |
2640 "Make the face attributes in WIDGET default." | 2693 "Prepare for saving the face being edited by WIDGET." |
2641 (let* ((symbol (widget-value widget)) | 2694 (let* ((symbol (widget-value widget)) |
2642 (child (car (widget-get widget :children))) | 2695 (child (car (widget-get widget :children))) |
2643 (value (widget-value child)) | 2696 (value (widget-value child)) |
2644 (comment-widget (widget-get widget :comment-widget)) | 2697 (comment-widget (widget-get widget :comment-widget)) |
2645 (comment (widget-value comment-widget))) | 2698 (comment (widget-value comment-widget))) |
2653 (custom-push-theme 'theme-face symbol 'user 'set value) | 2706 (custom-push-theme 'theme-face symbol 'user 'set value) |
2654 (put symbol 'customized-face nil) | 2707 (put symbol 'customized-face nil) |
2655 (put symbol 'face-comment comment) | 2708 (put symbol 'face-comment comment) |
2656 (put symbol 'customized-face-comment nil) | 2709 (put symbol 'customized-face-comment nil) |
2657 (put symbol 'saved-face-comment comment) | 2710 (put symbol 'saved-face-comment comment) |
2658 (custom-save-all) | 2711 )) |
2659 (custom-face-state-set widget) | 2712 |
2660 (custom-redraw-magic widget))) | 2713 (defun custom-face-post-save (widget) |
2714 "Finish saving the face being edited by WIDGET." | |
2715 (custom-face-state-set widget) | |
2716 (custom-redraw-magic widget)) | |
2717 | |
2718 (defun custom-face-save (widget) | |
2719 "Save the face being edited by WIDGET." | |
2720 (custom-face-pre-save widget) | |
2721 (custom-save-all) | |
2722 (custom-face-post-save widget)) | |
2661 | 2723 |
2662 (defun custom-face-reset-saved (widget) | 2724 (defun custom-face-reset-saved (widget) |
2663 "Restore WIDGET to the face's default attributes." | 2725 "Reset the face being edited by WIDGET to its saved value." |
2664 (let* ((symbol (widget-value widget)) | 2726 (let* ((symbol (widget-value widget)) |
2665 (child (car (widget-get widget :children))) | 2727 (child (car (widget-get widget :children))) |
2666 (value (get symbol 'saved-face)) | 2728 (value (get symbol 'saved-face)) |
2667 (comment (get symbol 'saved-face-comment)) | 2729 (comment (get symbol 'saved-face-comment)) |
2668 (comment-widget (widget-get widget :comment-widget))) | 2730 (comment-widget (widget-get widget :comment-widget))) |
2676 ;; This call manages the comment visibility | 2738 ;; This call manages the comment visibility |
2677 (widget-value-set comment-widget (or comment "")) | 2739 (widget-value-set comment-widget (or comment "")) |
2678 (custom-face-state-set widget) | 2740 (custom-face-state-set widget) |
2679 (custom-redraw-magic widget))) | 2741 (custom-redraw-magic widget))) |
2680 | 2742 |
2681 (defun custom-face-reset-standard (widget) | 2743 ;; This function returns non nil if we need to re-save the options --dv. |
2682 "Restore WIDGET to the face's standard settings." | 2744 (defun custom-face-pre-reset-standard (widget) |
2745 "Prepare for restoring the face edited by WIDGET to its standard | |
2746 settings." | |
2683 (let* ((symbol (widget-value widget)) | 2747 (let* ((symbol (widget-value widget)) |
2684 (child (car (widget-get widget :children))) | 2748 (value (get symbol 'face-defface-spec))) |
2685 (value (get symbol 'face-defface-spec)) | |
2686 (comment-widget (widget-get widget :comment-widget))) | |
2687 (unless value | 2749 (unless value |
2688 (signal 'error (list "No standard setting for this face" symbol))) | 2750 (signal 'error (list "No standard setting for this face" symbol))) |
2689 (put symbol 'customized-face nil) | 2751 (put symbol 'customized-face nil) |
2690 (put symbol 'customized-face-comment nil) | 2752 (put symbol 'customized-face-comment nil) |
2691 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) | 2753 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) |
2693 (custom-push-theme 'theme-face symbol 'user 'reset 'standard) | 2755 (custom-push-theme 'theme-face symbol 'user 'reset 'standard) |
2694 ;; Do not explictly save resets to standards without themes. | 2756 ;; Do not explictly save resets to standards without themes. |
2695 (if (null (cdr (get symbol 'theme-face))) | 2757 (if (null (cdr (get symbol 'theme-face))) |
2696 (put symbol 'theme-face nil)) | 2758 (put symbol 'theme-face nil)) |
2697 (put symbol 'saved-face-comment nil) | 2759 (put symbol 'saved-face-comment nil) |
2698 (custom-save-all)) | 2760 widget) |
2761 )) | |
2762 | |
2763 (defun custom-face-post-reset-standard (widget) | |
2764 "Finish restoring the face edited by WIDGET to its standard settings." | |
2765 (let* ((symbol (widget-value widget)) | |
2766 (child (car (widget-get widget :children))) | |
2767 (value (get symbol 'face-defface-spec)) | |
2768 (comment-widget (widget-get widget :comment-widget))) | |
2699 (face-spec-set symbol value nil '(custom)) | 2769 (face-spec-set symbol value nil '(custom)) |
2700 (put symbol 'face-comment nil) | 2770 (put symbol 'face-comment nil) |
2701 (widget-value-set child value) | 2771 (widget-value-set child value) |
2702 ;; This call manages the comment visibility | 2772 ;; This call manages the comment visibility |
2703 (widget-value-set comment-widget "") | 2773 (widget-value-set comment-widget "") |
2704 (custom-face-state-set widget) | 2774 (custom-face-state-set widget) |
2705 (custom-redraw-magic widget))) | 2775 (custom-redraw-magic widget) |
2776 )) | |
2777 | |
2778 (defun custom-face-reset-standard (widget) | |
2779 "Restore the face edited by WIDGET to its standard settings." | |
2780 (when (custom-face-pre-reset-standard widget) | |
2781 (custom-save-all)) | |
2782 (custom-face-post-reset-standard widget)) | |
2783 | |
2706 | 2784 |
2707 ;;; The `face' Widget. | 2785 ;;; The `face' Widget. |
2708 | 2786 |
2709 (define-widget 'face 'default | 2787 (define-widget 'face 'default |
2710 "Select and customize a face." | 2788 "Select and customize a face." |
2873 :help-echo "Set or reset all members of this group" | 2951 :help-echo "Set or reset all members of this group" |
2874 :value-create 'custom-group-value-create | 2952 :value-create 'custom-group-value-create |
2875 :action 'custom-group-action | 2953 :action 'custom-group-action |
2876 :custom-category 'group | 2954 :custom-category 'group |
2877 :custom-set 'custom-group-set | 2955 :custom-set 'custom-group-set |
2956 :custom-pre-save 'custom-group-pre-save | |
2878 :custom-save 'custom-group-save | 2957 :custom-save 'custom-group-save |
2958 :custom-post-save 'custom-group-post-save | |
2879 :custom-reset-current 'custom-group-reset-current | 2959 :custom-reset-current 'custom-group-reset-current |
2880 :custom-reset-saved 'custom-group-reset-saved | 2960 :custom-reset-saved 'custom-group-reset-saved |
2961 :custom-pre-reset-standard 'custom-group-pre-reset-standard | |
2881 :custom-reset-standard 'custom-group-reset-standard | 2962 :custom-reset-standard 'custom-group-reset-standard |
2963 :custom-post-reset-standard 'custom-group-post-reset-standard | |
2882 :custom-menu 'custom-group-menu-create) | 2964 :custom-menu 'custom-group-menu-create) |
2883 | 2965 |
2884 (defun custom-group-sample-face-get (widget) | 2966 (defun custom-group-sample-face-get (widget) |
2885 ;; Use :sample-face. | 2967 ;; Use :sample-face. |
2886 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces) | 2968 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces) |
3185 (mapc (lambda (child) | 3267 (mapc (lambda (child) |
3186 (when (eq (widget-get child :custom-state) 'modified) | 3268 (when (eq (widget-get child :custom-state) 'modified) |
3187 (widget-apply child :custom-set))) | 3269 (widget-apply child :custom-set))) |
3188 children))) | 3270 children))) |
3189 | 3271 |
3190 (defun custom-group-save (widget) | 3272 (defun custom-group-pre-save (widget) |
3273 "Prepare for saving all modified group members." | |
3274 (let ((children (widget-get widget :children))) | |
3275 (mapc (lambda (child) | |
3276 (when (memq (widget-get child :custom-state) '(modified set)) | |
3277 (widget-apply child :custom-pre-save))) | |
3278 children))) | |
3279 | |
3280 (defun custom-group-post-save (widget) | |
3191 "Save all modified group members." | 3281 "Save all modified group members." |
3192 (let ((children (widget-get widget :children))) | 3282 (let ((children (widget-get widget :children))) |
3193 (mapc (lambda (child) | 3283 (mapc (lambda (child) |
3194 (when (memq (widget-get child :custom-state) '(modified set)) | 3284 (when (memq (widget-get child :custom-state) '(modified set)) |
3195 (widget-apply child :custom-save))) | 3285 (widget-apply child :custom-post-save))) |
3196 children))) | 3286 children))) |
3287 | |
3288 (defun custom-group-save (widget) | |
3289 "Save all modified group members." | |
3290 (custom-group-pre-save widget) | |
3291 (custom-save-all) | |
3292 (custom-group-post-save widget)) | |
3197 | 3293 |
3198 (defun custom-group-reset-current (widget) | 3294 (defun custom-group-reset-current (widget) |
3199 "Reset all modified group members." | 3295 "Reset all modified group members." |
3200 (let ((children (widget-get widget :children))) | 3296 (let ((children (widget-get widget :children))) |
3201 (mapc (lambda (child) | 3297 (mapc (lambda (child) |
3209 (mapc (lambda (child) | 3305 (mapc (lambda (child) |
3210 (when (memq (widget-get child :custom-state) '(modified set)) | 3306 (when (memq (widget-get child :custom-state) '(modified set)) |
3211 (widget-apply child :custom-reset-saved))) | 3307 (widget-apply child :custom-reset-saved))) |
3212 children))) | 3308 children))) |
3213 | 3309 |
3214 (defun custom-group-reset-standard (widget) | 3310 ;; This function returns non nil when we need to re-save the options --dv. |
3215 "Reset all modified, set, or saved group members." | 3311 (defun custom-group-pre-reset-standard (widget) |
3312 "Prepare for resetting all modified, set, or saved group members." | |
3313 (let ((children (widget-get widget :children)) | |
3314 must-save) | |
3315 (mapc (lambda (child) | |
3316 (when (memq (widget-get child :custom-state) | |
3317 '(modified set saved)) | |
3318 (and (widget-apply child :custom-pre-reset-standard) | |
3319 (setq must-save t)))) | |
3320 children) | |
3321 must-save | |
3322 )) | |
3323 | |
3324 (defun custom-group-post-reset-standard (widget) | |
3325 "Finish resetting all modified, set, or saved group members." | |
3216 (let ((children (widget-get widget :children))) | 3326 (let ((children (widget-get widget :children))) |
3217 (mapc (lambda (child) | 3327 (mapc (lambda (child) |
3218 (when (memq (widget-get child :custom-state) | 3328 (when (memq (widget-get child :custom-state) |
3219 '(modified set saved)) | 3329 '(modified set saved)) |
3220 (widget-apply child :custom-reset-standard))) | 3330 (widget-apply child :custom-post-reset-standard))) |
3221 children))) | 3331 children))) |
3332 | |
3333 (defun custom-group-reset-standard (widget) | |
3334 "Reset all modified, set, or saved group members." | |
3335 (when (custom-group-pre-reset-standard widget) | |
3336 (custom-save-all)) | |
3337 (custom-group-post-reset-standard widget)) | |
3222 | 3338 |
3223 (defun custom-group-state-update (widget) | 3339 (defun custom-group-state-update (widget) |
3224 "Update magic." | 3340 "Update magic." |
3225 (unless (eq (widget-get widget :custom-state) 'hidden) | 3341 (unless (eq (widget-get widget :custom-state) 'hidden) |
3226 (let* ((children (widget-get widget :children)) | 3342 (let* ((children (widget-get widget :children)) |