Index: lisp/wid-edit.el =================================================================== RCS file: /cvsroot/emacs//emacs/lisp/wid-edit.el,v retrieving revision 1.112 diff -c -r1.112 wid-edit.el *** lisp/wid-edit.el 23 Jul 2002 19:20:53 -0000 1.112 --- lisp/wid-edit.el 2 Oct 2002 09:04:42 -0000 *************** *** 688,694 **** (defun widget-create-child (parent type) "Create widget of TYPE." ! (let ((widget (copy-sequence type))) (widget-put widget :parent parent) (unless (widget-get widget :indent) (widget-put widget :indent (+ (or (widget-get parent :indent) 0) --- 688,694 ---- (defun widget-create-child (parent type) "Create widget of 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) *************** *** 699,705 **** (defun widget-create-child-value (parent type value) "Create widget of TYPE with value VALUE." ! (let ((widget (copy-sequence type))) (widget-put widget :value (widget-apply widget :value-to-internal value)) (widget-put widget :parent parent) (unless (widget-get widget :indent) --- 699,705 ---- (defun widget-create-child-value (parent type value) "Create widget of TYPE with value VALUE." ! (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) *************** *** 714,719 **** --- 714,723 ---- "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." *************** *** 1271,1276 **** --- 1275,1285 ---- 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." *************** *** 1308,1313 **** --- 1317,1323 ---- :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 *************** *** 1853,1858 **** --- 1863,1869 ---- (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" *************** *** 2091,2096 **** --- 2102,2108 ---- (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" *************** *** 2268,2273 **** --- 2280,2286 ---- (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" *************** *** 2456,2461 **** --- 2469,2475 ---- (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 *************** *** 2631,2636 **** --- 2645,2651 ---- (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 Index: man/widget.texi =================================================================== RCS file: /cvsroot/emacs//emacs/man/widget.texi,v retrieving revision 1.14 diff -c -r1.14 widget.texi *** man/widget.texi 23 Jul 2002 19:10:02 -0000 1.14 --- man/widget.texi 2 Oct 2002 09:04:44 -0000 *************** *** 4,10 **** @setfilename ../info/widget @settitle The Emacs Widget Library @ifnottex ! Copyright @copyright{} 2000 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or --- 4,10 ---- @setfilename ../info/widget @settitle The Emacs Widget Library @ifnottex ! Copyright @copyright{} 2000, 2002 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or *************** *** 1536,1541 **** --- 1536,1554 ---- @defun widget-value-convert-widget widget Initialize @code{:value} from @code{:args} in @var{widget}. + @end defun + + @vindex copy@r{ keyword} + @item :copy + Function to deep copy a widget type. It takes a shallow copy of the + widget type as an argument (made by @code{copy-sequence}), and returns a + deep copy. The purpose of this is to avoid having different instances + of combined widgets share nested attributes. + + The following predefined functions can be used here: + + @defun widget-types-copy widget + Copy @code{:args} as widget types in @var{widget}. @end defun @vindex value-to-internal@r{ keyword}