(interactive)
(let ((children custom-options))
(mapc (lambda (widget)
- (and (get (widget-value widget) 'standard-value)
+ (and (widget-apply widget :custom-standard-value)
(if (memq (widget-get widget :custom-state)
'(modified set changed saved rogue))
(widget-apply widget :custom-reset-standard))))
:custom-save 'custom-variable-save
:custom-reset-current 'custom-redraw
:custom-reset-saved 'custom-variable-reset-saved
- :custom-reset-standard 'custom-variable-reset-standard)
+ :custom-reset-standard 'custom-variable-reset-standard
+ :custom-standard-value 'custom-variable-standard-value)
(defun custom-variable-type (symbol)
"Return a widget suitable for editing the value of SYMBOL.
(t 'rogue))))
(widget-put widget :custom-state state)))
+(defun custom-variable-standard-value (widget)
+ (get (widget-value widget) 'standard-value))
+
(defvar custom-variable-menu
'(("Set for Current Session" custom-variable-set
(lambda (widget)
(defun custom-face-edit-fix-value (widget value)
"Ignoring WIDGET, convert :bold and :italic in VALUE to new form."
- (let (result)
- (while value
- (let ((key (car value))
- (val (car (cdr value))))
- (cond ((eq key :italic)
- (push :slant result)
- (push (if val 'italic 'normal) result))
- ((eq key :bold)
- (push :weight result)
- (push (if val 'bold 'normal) result))
- (t
- (push key result)
- (push val result))))
- (setq value (cdr (cdr value))))
- (setq result (nreverse result))
- result))
+ (if (listp value)
+ (let (result)
+ (while value
+ (let ((key (car value))
+ (val (car (cdr value))))
+ (cond ((eq key :italic)
+ (push :slant result)
+ (push (if val 'italic 'normal) result))
+ ((eq key :bold)
+ (push :weight result)
+ (push (if val 'bold 'normal) result))
+ (t
+ (push key result)
+ (push val result))))
+ (setq value (cdr (cdr value))))
+ (setq result (nreverse result))
+ result)
+ value))
(defun custom-face-edit-convert-widget (widget)
"Convert :args as widget types in WIDGET."
:custom-reset-current 'custom-redraw
:custom-reset-saved 'custom-face-reset-saved
:custom-reset-standard 'custom-face-reset-standard
+ :custom-standard-value 'custom-face-standard-value
:custom-menu 'custom-face-menu-create)
(define-widget 'custom-face-all 'editable-list
;; face-set-spec ignores empty attribute lists, so just give it
;; something harmless instead.
(face-spec-set symbol '((t :foreground unspecified))))
- (put symbol 'saved-face value)
+ (unless (eq (widget-get widget :custom-state) 'standard)
+ (put symbol 'saved-face value))
(put symbol 'customized-face nil)
(put symbol 'face-comment comment)
(put symbol 'customized-face-comment nil)
(custom-face-state-set widget)
(custom-redraw-magic widget)))
+(defun custom-face-standard-value (widget)
+ (get (widget-value widget) 'face-defface-spec))
+
(defun custom-face-reset-standard (widget)
"Restore WIDGET to the face's standard settings.
This operation eliminates any saved setting for the face,
(mapcar
(lambda (symbol)
(let ((value (get symbol 'saved-face))
- (now (not (or (get 'default 'face-defface-spec)
- (and (not (custom-facep 'default))
- (not (get 'default 'force-face))))))
- (comment (get 'default 'saved-face-comment)))
- (unless (eq symbol 'default))
+ (now (not (or (get symbol 'face-defface-spec)
+ (and (not (custom-facep symbol))
+ (not (get symbol 'force-face))))))
+ (comment (get symbol 'saved-face-comment)))
;; Don't print default face here.
(unless (bolp)
(princ "\n"))