* startup.el (normal-top-level): Reset standard-value property of
`user-full-name' here.
+2002-10-02 Per Abrahamsen <abraham@dina.kvl.dk>
+
+ * wid-edit.el (widget-default-get): Change to return external
+ value.
+ (widget-choice-action): Update caller.
+ (widget-editable-list-entry-create): Update caller.
+
+ * wid-edit.el (widget-types-copy): New function.
+ (default): Added :copy keyword.
+ (menu-choice): Ditto.
+ (checklist): Ditto.
+ (radio-button-choice): Ditto.
+ (editable-list): Ditto.
+ (group): Ditto.
+ (widget-copy): New function.
+ (widget-create-child): Use it.
+ (widget-create-child-value): Use it.
+
2002-10-01 Bill Wohler <wohler@newt.com>
* mail/mh-comp.el, mail/mh-e.el, mail/mh-funcs.el,
:value-to-internal value)))
(defun widget-default-get (widget)
- "Extract the default value of WIDGET."
- (or (widget-get widget :value)
- (widget-apply widget :default-get)))
+ "Extract the default external value of WIDGET."
+ (widget-apply widget :value-to-external
+ (or (widget-get widget :value)
+ (widget-apply widget :default-get))))
(defun widget-match-inline (widget vals)
"In WIDGET, match the start of VALS."
(defun widget-create-child (parent type)
"Create widget of TYPE."
- (let ((widget (copy-sequence type)))
+ (let ((widget (widget-copy type)))
(widget-put widget :parent parent)
(unless (widget-get widget :indent)
(widget-put widget :indent (+ (or (widget-get parent :indent) 0)
(defun widget-create-child-value (parent type value)
"Create widget of TYPE with value VALUE."
- (let ((widget (copy-sequence type)))
+ (let ((widget (widget-copy type)))
(widget-put widget :value (widget-apply widget :value-to-internal value))
(widget-put widget :parent parent)
(unless (widget-get widget :indent)
"Delete WIDGET."
(widget-apply widget :delete))
+(defun widget-copy (widget)
+ "Make a deep copy of WIDGET."
+ (widget-apply (copy-sequence widget) :copy))
+
(defun widget-convert (type &rest args)
"Convert TYPE to a widget without inserting it in the buffer.
The optional ARGS are additional keyword arguments."
found (widget-apply child :validate)))
found))
+(defun widget-types-copy (widget)
+ "Copy :args as widget types in WIDGET."
+ (widget-put widget :args (mapcar 'widget-copy (widget-get widget :args)))
+ widget)
+
;; Made defsubst to speed up face editor creation.
(defsubst widget-types-convert-widget (widget)
"Convert :args as widget types in WIDGET."
:button-face-get 'widget-default-button-face-get
:sample-face-get 'widget-default-sample-face-get
:delete 'widget-default-delete
+ :copy 'identity
:value-set 'widget-default-value-set
:value-inline 'widget-default-value-inline
:default-get 'widget-default-default-get
(define-widget 'menu-choice 'default
"A menu of options."
:convert-widget 'widget-types-convert-widget
+ :copy 'widget-types-copy
:format "%[%t%]: %v"
:case-fold t
:tag "choice"
(when this-explicit
(widget-put widget :explicit-choice current)
(widget-put widget :explicit-choice-value (widget-get widget :value)))
- (widget-value-set
- widget (widget-apply current
- :value-to-external (widget-default-get current)))
+ (widget-value-set widget (widget-default-get current))
(widget-setup)
(widget-apply widget :notify widget event)))
(run-hook-with-args 'widget-edit-functions widget))
(define-widget 'checklist 'default
"A multiple choice widget."
:convert-widget 'widget-types-convert-widget
+ :copy 'widget-types-copy
:format "%v"
:offset 4
:entry-format "%b %v"
(define-widget 'radio-button-choice 'default
"Select one of multiple options."
:convert-widget 'widget-types-convert-widget
+ :copy 'widget-types-copy
:offset 4
:format "%v"
:entry-format "%b %v"
(define-widget 'editable-list 'default
"A variable list of widgets of the same type."
:convert-widget 'widget-types-convert-widget
+ :copy 'widget-types-copy
:offset 12
:format "%v%i\n"
:format-handler 'widget-editable-list-format-handler
(setq child (widget-create-child-value
widget type value))
(setq child (widget-create-child-value
- widget type
- (widget-apply type :value-to-external
- (widget-default-get type))))))
+ widget type (widget-default-get type)))))
(t
(error "Unknown escape `%c'" escape)))))
(widget-put widget
(define-widget 'group 'default
"A widget which groups other widgets inside."
:convert-widget 'widget-types-convert-widget
+ :copy 'widget-types-copy
:format "%v"
:value-create 'widget-group-value-create
:value-delete 'widget-children-value-delete