comparison lisp/cus-edit.el @ 67792:1c774eee2980

* cus-edit.el (custom-variable-set, custom-variable-set) (custom-variable-reset-saved, custom-variable-reset-backup) (custom-face-set, custom-face-reset-saved): Update `user' theme. (custom-variable-save): Fix typos. (custom-variable-state-set, custom-face-state-set): Check theme-value. (custom-variable-reset-standard, custom-face-reset-standard): Perform custom theme recalc unconditionally.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 24 Dec 2005 06:45:16 +0000
parents 32dce3f26e21
children 49724377f337
comparison
equal deleted inserted replaced
67791:32dce3f26e21 67792:1c774eee2980
2543 (and (equal value (eval (car tmp))) 2543 (and (equal value (eval (car tmp)))
2544 (equal comment temp)) 2544 (equal comment temp))
2545 (error nil)) 2545 (error nil))
2546 'set 2546 'set
2547 'changed)) 2547 'changed))
2548 ((progn (setq tmp (get symbol 'saved-value)) 2548 ((progn (setq tmp (get symbol 'theme-value))
2549 (setq temp (get symbol 'saved-variable-comment)) 2549 (setq temp (get symbol 'saved-variable-comment))
2550 (or tmp temp)) 2550 (or tmp temp))
2551 (if (condition-case nil 2551 (if (condition-case nil
2552 (and (equal value (eval (car tmp))) 2552 (and (equal comment temp)
2553 (equal comment temp)) 2553 (equal value
2554 (eval (car
2555 (custom-theme-value
2556 (caar tmp) tmp)))))
2554 (error nil)) 2557 (error nil))
2555 (cond 2558 (cond
2556 ((eq 'user (caar (get symbol 'theme-value))) 2559 ((eq 'user (caar (get symbol 'theme-value)))
2557 'saved) 2560 'saved)
2558 ((eq 'standard (caar (get symbol 'theme-value))) 2561 ((eq 'standard (caar (get symbol 'theme-value)))
2664 (when (equal comment "") 2667 (when (equal comment "")
2665 (setq comment nil) 2668 (setq comment nil)
2666 ;; Make the comment invisible by hand if it's empty 2669 ;; Make the comment invisible by hand if it's empty
2667 (custom-comment-hide comment-widget)) 2670 (custom-comment-hide comment-widget))
2668 (custom-variable-backup-value widget) 2671 (custom-variable-backup-value widget)
2672 (custom-push-theme 'theme-value symbol 'user
2673 'set (widget-value child))
2669 (funcall set symbol (eval (setq val (widget-value child)))) 2674 (funcall set symbol (eval (setq val (widget-value child))))
2670 (put symbol 'customized-value (list val)) 2675 (put symbol 'customized-value (list val))
2671 (put symbol 'variable-comment comment) 2676 (put symbol 'variable-comment comment)
2672 (put symbol 'customized-variable-comment comment)) 2677 (put symbol 'customized-variable-comment comment))
2673 (t 2678 (t
2674 (when (equal comment "") 2679 (when (equal comment "")
2675 (setq comment nil) 2680 (setq comment nil)
2676 ;; Make the comment invisible by hand if it's empty 2681 ;; Make the comment invisible by hand if it's empty
2677 (custom-comment-hide comment-widget)) 2682 (custom-comment-hide comment-widget))
2678 (custom-variable-backup-value widget) 2683 (custom-variable-backup-value widget)
2684 (custom-push-theme 'theme-value symbol 'user
2685 'set (widget-value child))
2679 (funcall set symbol (setq val (widget-value child))) 2686 (funcall set symbol (setq val (widget-value child)))
2680 (put symbol 'customized-value (list (custom-quote val))) 2687 (put symbol 'customized-value (list (custom-quote val)))
2681 (put symbol 'variable-comment comment) 2688 (put symbol 'variable-comment comment)
2682 (put symbol 'customized-variable-comment comment))) 2689 (put symbol 'customized-variable-comment comment)))
2683 (custom-variable-state-set widget) 2690 (custom-variable-state-set widget)
2703 (setq comment nil) 2710 (setq comment nil)
2704 ;; Make the comment invisible by hand if it's empty 2711 ;; Make the comment invisible by hand if it's empty
2705 (custom-comment-hide comment-widget)) 2712 (custom-comment-hide comment-widget))
2706 (put symbol 'saved-value (list (widget-value child))) 2713 (put symbol 'saved-value (list (widget-value child)))
2707 (custom-push-theme 'theme-value symbol 'user 2714 (custom-push-theme 'theme-value symbol 'user
2708 'set (list (widget-value child))) 2715 'set (widget-value child))
2709 (funcall set symbol (eval (widget-value child))) 2716 (funcall set symbol (eval (widget-value child)))
2710 (put symbol 'variable-comment comment) 2717 (put symbol 'variable-comment comment)
2711 (put symbol 'saved-variable-comment comment)) 2718 (put symbol 'saved-variable-comment comment))
2712 (t 2719 (t
2713 (when (equal comment "") 2720 (when (equal comment "")
2715 ;; Make the comment invisible by hand if it's empty 2722 ;; Make the comment invisible by hand if it's empty
2716 (custom-comment-hide comment-widget)) 2723 (custom-comment-hide comment-widget))
2717 (put symbol 'saved-value 2724 (put symbol 'saved-value
2718 (list (custom-quote (widget-value child)))) 2725 (list (custom-quote (widget-value child))))
2719 (custom-push-theme 'theme-value symbol 'user 2726 (custom-push-theme 'theme-value symbol 'user
2720 'set (list (custom-quote (widget-value 2727 'set (custom-quote (widget-value
2721 child)))) 2728 child)))
2722 (funcall set symbol (widget-value child)) 2729 (funcall set symbol (widget-value child))
2723 (put symbol 'variable-comment comment) 2730 (put symbol 'variable-comment comment)
2724 (put symbol 'saved-variable-comment comment))) 2731 (put symbol 'saved-variable-comment comment)))
2725 (put symbol 'customized-value nil) 2732 (put symbol 'customized-value nil)
2726 (put symbol 'customized-variable-comment nil) 2733 (put symbol 'customized-variable-comment nil)
2737 (value (get symbol 'saved-value)) 2744 (value (get symbol 'saved-value))
2738 (comment (get symbol 'saved-variable-comment))) 2745 (comment (get symbol 'saved-variable-comment)))
2739 (cond ((or value comment) 2746 (cond ((or value comment)
2740 (put symbol 'variable-comment comment) 2747 (put symbol 'variable-comment comment)
2741 (custom-variable-backup-value widget) 2748 (custom-variable-backup-value widget)
2749 (custom-push-theme 'theme-value symbol 'user 'set value)
2742 (condition-case nil 2750 (condition-case nil
2743 (funcall set symbol (eval (car value))) 2751 (funcall set symbol (eval (car value)))
2744 (error nil))) 2752 (error nil)))
2745 (t 2753 (t
2746 (error "No saved value for %s" symbol))) 2754 (error "No saved value for %s" symbol)))
2757 The value that was current before this operation 2765 The value that was current before this operation
2758 becomes the backup value, so you can get it again." 2766 becomes the backup value, so you can get it again."
2759 (let* ((symbol (widget-value widget)) 2767 (let* ((symbol (widget-value widget))
2760 (set (or (get symbol 'custom-set) 'set-default))) 2768 (set (or (get symbol 'custom-set) 'set-default)))
2761 (if (get symbol 'standard-value) 2769 (if (get symbol 'standard-value)
2762 (progn 2770 (custom-variable-backup-value widget)
2763 (custom-variable-backup-value widget)
2764 (funcall set symbol (eval (car (get symbol 'standard-value)))))
2765 (error "No standard setting known for %S" symbol)) 2771 (error "No standard setting known for %S" symbol))
2766 (put symbol 'variable-comment nil) 2772 (put symbol 'variable-comment nil)
2767 (put symbol 'customized-value nil) 2773 (put symbol 'customized-value nil)
2768 (put symbol 'customized-variable-comment nil) 2774 (put symbol 'customized-variable-comment nil)
2775 (custom-push-theme 'theme-value symbol 'user 'reset nil)
2776 (custom-theme-recalc-variable symbol)
2769 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) 2777 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
2770 (put symbol 'saved-value nil) 2778 (put symbol 'saved-value nil)
2771 (custom-push-theme 'theme-value symbol 'user 'reset nil)
2772 (custom-theme-recalc-variable symbol)
2773 (put symbol 'saved-variable-comment nil) 2779 (put symbol 'saved-variable-comment nil)
2774 (custom-save-all)) 2780 (custom-save-all))
2775 (widget-put widget :custom-state 'unknown) 2781 (widget-put widget :custom-state 'unknown)
2776 ;; This call will possibly make the comment invisible 2782 ;; This call will possibly make the comment invisible
2777 (custom-redraw widget))) 2783 (custom-redraw widget)))
2799 (comment-widget (widget-get widget :comment-widget)) 2805 (comment-widget (widget-get widget :comment-widget))
2800 (comment (widget-value comment-widget))) 2806 (comment (widget-value comment-widget)))
2801 (if value 2807 (if value
2802 (progn 2808 (progn
2803 (custom-variable-backup-value widget) 2809 (custom-variable-backup-value widget)
2810 (custom-push-theme 'theme-value symbol 'user 'set value)
2804 (condition-case nil 2811 (condition-case nil
2805 (funcall set symbol (car value)) 2812 (funcall set symbol (car value))
2806 (error nil))) 2813 (error nil)))
2807 (error "No backup value for %s" symbol)) 2814 (error "No backup value for %s" symbol))
2808 (put symbol 'customized-value (list (car value))) 2815 (put symbol 'customized-value (list (car value)))
3359 (if (face-spec-choose value) 3366 (if (face-spec-choose value)
3360 (face-spec-set symbol value) 3367 (face-spec-set symbol value)
3361 ;; face-set-spec ignores empty attribute lists, so just give it 3368 ;; face-set-spec ignores empty attribute lists, so just give it
3362 ;; something harmless instead. 3369 ;; something harmless instead.
3363 (face-spec-set symbol '((t :foreground unspecified)))) 3370 (face-spec-set symbol '((t :foreground unspecified))))
3371 (custom-push-theme 'theme-face symbol 'user 'set value)
3364 (put symbol 'customized-face-comment comment) 3372 (put symbol 'customized-face-comment comment)
3365 (put symbol 'face-comment comment) 3373 (put symbol 'face-comment comment)
3366 (custom-face-state-set widget) 3374 (custom-face-state-set widget)
3367 (custom-redraw-magic widget))) 3375 (custom-redraw-magic widget)))
3368 3376
3407 (comment-widget (widget-get widget :comment-widget))) 3415 (comment-widget (widget-get widget :comment-widget)))
3408 (unless (or value comment) 3416 (unless (or value comment)
3409 (error "No saved value for this face")) 3417 (error "No saved value for this face"))
3410 (put symbol 'customized-face nil) 3418 (put symbol 'customized-face nil)
3411 (put symbol 'customized-face-comment nil) 3419 (put symbol 'customized-face-comment nil)
3420 (custom-push-theme 'theme-face symbol 'user 'set value)
3412 (face-spec-set symbol value) 3421 (face-spec-set symbol value)
3413 (put symbol 'face-comment comment) 3422 (put symbol 'face-comment comment)
3414 (widget-value-set child value) 3423 (widget-value-set child value)
3415 ;; This call manages the comment visibility 3424 ;; This call manages the comment visibility
3416 (widget-value-set comment-widget (or comment "")) 3425 (widget-value-set comment-widget (or comment ""))
3430 (comment-widget (widget-get widget :comment-widget))) 3439 (comment-widget (widget-get widget :comment-widget)))
3431 (unless value 3440 (unless value
3432 (error "No standard setting for this face")) 3441 (error "No standard setting for this face"))
3433 (put symbol 'customized-face nil) 3442 (put symbol 'customized-face nil)
3434 (put symbol 'customized-face-comment nil) 3443 (put symbol 'customized-face-comment nil)
3444 (custom-push-theme 'theme-face symbol 'user 'reset nil)
3445 (custom-theme-recalc-face symbol)
3435 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) 3446 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
3436 (put symbol 'saved-face nil) 3447 (put symbol 'saved-face nil)
3437 (custom-push-theme 'theme-face symbol 'user 'reset nil)
3438 (custom-theme-recalc-face symbol)
3439 ;; Do not explictly save resets to standards without themes.
3440 (if (null (cdr (get symbol 'theme-face)))
3441 (put symbol 'theme-face nil))
3442 (put symbol 'saved-face-comment nil) 3448 (put symbol 'saved-face-comment nil)
3443 (custom-save-all)) 3449 (custom-save-all))
3444 (face-spec-set symbol value)
3445 (put symbol 'face-comment nil) 3450 (put symbol 'face-comment nil)
3446 (widget-value-set child value) 3451 (widget-value-set child value)
3447 ;; This call manages the comment visibility 3452 ;; This call manages the comment visibility
3448 (widget-value-set comment-widget "") 3453 (widget-value-set comment-widget "")
3449 (custom-face-state-set widget) 3454 (custom-face-state-set widget)