diff options
| author | Richard M. Stallman | 2002-07-16 13:37:21 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-07-16 13:37:21 +0000 |
| commit | 4f9850435d97c347d44236146664f35039714bb8 (patch) | |
| tree | c411d833e9f220347af22a7ecaf628a57ebdbe98 | |
| parent | cb4e817652fe9456d57c4c3d1ba9825e8cf9ab34 (diff) | |
| download | emacs-4f9850435d97c347d44236146664f35039714bb8.tar.gz emacs-4f9850435d97c347d44236146664f35039714bb8.zip | |
New operation :custom-standard-value.
(Custom-reset-standard): Use it.
(custom-variable, custom-face): Define it.
(custom-variable-standard-value, custom-face-standard-value): New fns.
(custom-face-save): Don't save a face whose value is standard.
(custom-save-faces): Use SYMBOL, not 'default, to set NOW and COMMENT.
(custom-face-edit-fix-value): If VALUE is not a list, pass it thru.
| -rw-r--r-- | lisp/cus-edit.el | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index d6d82f34c2e..be319cf727f 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -698,7 +698,7 @@ making them as if they had never been customized at all." | |||
| 698 | (interactive) | 698 | (interactive) |
| 699 | (let ((children custom-options)) | 699 | (let ((children custom-options)) |
| 700 | (mapc (lambda (widget) | 700 | (mapc (lambda (widget) |
| 701 | (and (get (widget-value widget) 'standard-value) | 701 | (and (widget-apply widget :custom-standard-value) |
| 702 | (if (memq (widget-get widget :custom-state) | 702 | (if (memq (widget-get widget :custom-state) |
| 703 | '(modified set changed saved rogue)) | 703 | '(modified set changed saved rogue)) |
| 704 | (widget-apply widget :custom-reset-standard)))) | 704 | (widget-apply widget :custom-reset-standard)))) |
| @@ -2051,7 +2051,8 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"." | |||
| 2051 | :custom-save 'custom-variable-save | 2051 | :custom-save 'custom-variable-save |
| 2052 | :custom-reset-current 'custom-redraw | 2052 | :custom-reset-current 'custom-redraw |
| 2053 | :custom-reset-saved 'custom-variable-reset-saved | 2053 | :custom-reset-saved 'custom-variable-reset-saved |
| 2054 | :custom-reset-standard 'custom-variable-reset-standard) | 2054 | :custom-reset-standard 'custom-variable-reset-standard |
| 2055 | :custom-standard-value 'custom-variable-standard-value) | ||
| 2055 | 2056 | ||
| 2056 | (defun custom-variable-type (symbol) | 2057 | (defun custom-variable-type (symbol) |
| 2057 | "Return a widget suitable for editing the value of SYMBOL. | 2058 | "Return a widget suitable for editing the value of SYMBOL. |
| @@ -2269,6 +2270,9 @@ Otherwise, look up symbol in `custom-guess-type-alist'." | |||
| 2269 | (t 'rogue)))) | 2270 | (t 'rogue)))) |
| 2270 | (widget-put widget :custom-state state))) | 2271 | (widget-put widget :custom-state state))) |
| 2271 | 2272 | ||
| 2273 | (defun custom-variable-standard-value (widget) | ||
| 2274 | (get (widget-value widget) 'standard-value)) | ||
| 2275 | |||
| 2272 | (defvar custom-variable-menu | 2276 | (defvar custom-variable-menu |
| 2273 | '(("Set for Current Session" custom-variable-set | 2277 | '(("Set for Current Session" custom-variable-set |
| 2274 | (lambda (widget) | 2278 | (lambda (widget) |
| @@ -2475,22 +2479,24 @@ restoring it to the state of a variable that has never been customized." | |||
| 2475 | 2479 | ||
| 2476 | (defun custom-face-edit-fix-value (widget value) | 2480 | (defun custom-face-edit-fix-value (widget value) |
| 2477 | "Ignoring WIDGET, convert :bold and :italic in VALUE to new form." | 2481 | "Ignoring WIDGET, convert :bold and :italic in VALUE to new form." |
| 2478 | (let (result) | 2482 | (if (listp value) |
| 2479 | (while value | 2483 | (let (result) |
| 2480 | (let ((key (car value)) | 2484 | (while value |
| 2481 | (val (car (cdr value)))) | 2485 | (let ((key (car value)) |
| 2482 | (cond ((eq key :italic) | 2486 | (val (car (cdr value)))) |
| 2483 | (push :slant result) | 2487 | (cond ((eq key :italic) |
| 2484 | (push (if val 'italic 'normal) result)) | 2488 | (push :slant result) |
| 2485 | ((eq key :bold) | 2489 | (push (if val 'italic 'normal) result)) |
| 2486 | (push :weight result) | 2490 | ((eq key :bold) |
| 2487 | (push (if val 'bold 'normal) result)) | 2491 | (push :weight result) |
| 2488 | (t | 2492 | (push (if val 'bold 'normal) result)) |
| 2489 | (push key result) | 2493 | (t |
| 2490 | (push val result)))) | 2494 | (push key result) |
| 2491 | (setq value (cdr (cdr value)))) | 2495 | (push val result)))) |
| 2492 | (setq result (nreverse result)) | 2496 | (setq value (cdr (cdr value)))) |
| 2493 | result)) | 2497 | (setq result (nreverse result)) |
| 2498 | result) | ||
| 2499 | value)) | ||
| 2494 | 2500 | ||
| 2495 | (defun custom-face-edit-convert-widget (widget) | 2501 | (defun custom-face-edit-convert-widget (widget) |
| 2496 | "Convert :args as widget types in WIDGET." | 2502 | "Convert :args as widget types in WIDGET." |
| @@ -2662,6 +2668,7 @@ Only match frames that support the specified face attributes.") | |||
| 2662 | :custom-reset-current 'custom-redraw | 2668 | :custom-reset-current 'custom-redraw |
| 2663 | :custom-reset-saved 'custom-face-reset-saved | 2669 | :custom-reset-saved 'custom-face-reset-saved |
| 2664 | :custom-reset-standard 'custom-face-reset-standard | 2670 | :custom-reset-standard 'custom-face-reset-standard |
| 2671 | :custom-standard-value 'custom-face-standard-value | ||
| 2665 | :custom-menu 'custom-face-menu-create) | 2672 | :custom-menu 'custom-face-menu-create) |
| 2666 | 2673 | ||
| 2667 | (define-widget 'custom-face-all 'editable-list | 2674 | (define-widget 'custom-face-all 'editable-list |
| @@ -2979,7 +2986,8 @@ Optional EVENT is the location for the menu." | |||
| 2979 | ;; face-set-spec ignores empty attribute lists, so just give it | 2986 | ;; face-set-spec ignores empty attribute lists, so just give it |
| 2980 | ;; something harmless instead. | 2987 | ;; something harmless instead. |
| 2981 | (face-spec-set symbol '((t :foreground unspecified)))) | 2988 | (face-spec-set symbol '((t :foreground unspecified)))) |
| 2982 | (put symbol 'saved-face value) | 2989 | (unless (eq (widget-get widget :custom-state) 'standard) |
| 2990 | (put symbol 'saved-face value)) | ||
| 2983 | (put symbol 'customized-face nil) | 2991 | (put symbol 'customized-face nil) |
| 2984 | (put symbol 'face-comment comment) | 2992 | (put symbol 'face-comment comment) |
| 2985 | (put symbol 'customized-face-comment nil) | 2993 | (put symbol 'customized-face-comment nil) |
| @@ -3007,6 +3015,9 @@ Optional EVENT is the location for the menu." | |||
| 3007 | (custom-face-state-set widget) | 3015 | (custom-face-state-set widget) |
| 3008 | (custom-redraw-magic widget))) | 3016 | (custom-redraw-magic widget))) |
| 3009 | 3017 | ||
| 3018 | (defun custom-face-standard-value (widget) | ||
| 3019 | (get (widget-value widget) 'face-defface-spec)) | ||
| 3020 | |||
| 3010 | (defun custom-face-reset-standard (widget) | 3021 | (defun custom-face-reset-standard (widget) |
| 3011 | "Restore WIDGET to the face's standard settings. | 3022 | "Restore WIDGET to the face's standard settings. |
| 3012 | This operation eliminates any saved setting for the face, | 3023 | This operation eliminates any saved setting for the face, |
| @@ -3681,11 +3692,10 @@ or (if there were none) at the end of the buffer." | |||
| 3681 | (mapcar | 3692 | (mapcar |
| 3682 | (lambda (symbol) | 3693 | (lambda (symbol) |
| 3683 | (let ((value (get symbol 'saved-face)) | 3694 | (let ((value (get symbol 'saved-face)) |
| 3684 | (now (not (or (get 'default 'face-defface-spec) | 3695 | (now (not (or (get symbol 'face-defface-spec) |
| 3685 | (and (not (custom-facep 'default)) | 3696 | (and (not (custom-facep symbol)) |
| 3686 | (not (get 'default 'force-face)))))) | 3697 | (not (get symbol 'force-face)))))) |
| 3687 | (comment (get 'default 'saved-face-comment))) | 3698 | (comment (get symbol 'saved-face-comment))) |
| 3688 | (unless (eq symbol 'default)) | ||
| 3689 | ;; Don't print default face here. | 3699 | ;; Don't print default face here. |
| 3690 | (unless (bolp) | 3700 | (unless (bolp) |
| 3691 | (princ "\n")) | 3701 | (princ "\n")) |