aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2000-08-13 18:28:04 +0000
committerEli Zaretskii2000-08-13 18:28:04 +0000
commit6f7f063dee368ffcb0d39083a19adcbfb9411a4b (patch)
tree42a193f05f6c8f188b689400db95a70bf714e12e
parentfab7aa637ed9476885c8c47ac5ef2051dbdf6fe3 (diff)
downloademacs-6f7f063dee368ffcb0d39083a19adcbfb9411a4b.tar.gz
emacs-6f7f063dee368ffcb0d39083a19adcbfb9411a4b.zip
(Top): Add Index in the menu.
(many nodes): Add index entries. (Index): New node.
-rw-r--r--man/widget.texi366
1 files changed, 248 insertions, 118 deletions
diff --git a/man/widget.texi b/man/widget.texi
index 171087cd45c..7cd35ac1a38 100644
--- a/man/widget.texi
+++ b/man/widget.texi
@@ -9,6 +9,10 @@
9@end iftex 9@end iftex
10@c %**end of header 10@c %**end of header
11 11
12@syncodeindex fn cp
13@syncodeindex vr cp
14@syncodeindex ky cp
15
12@dircategory Emacs 16@dircategory Emacs
13@direntry 17@direntry
14* Widget: (widget). Documenting the "widget" package used by the 18* Widget: (widget). Documenting the "widget" package used by the
@@ -32,6 +36,7 @@
32* Widget Minor Mode:: 36* Widget Minor Mode::
33* Utilities:: 37* Utilities::
34* Widget Wishlist:: 38* Widget Wishlist::
39* Index::
35@end menu 40@end menu
36 41
37@node Introduction, User Interface, Top, Top 42@node Introduction, User Interface, Top, Top
@@ -41,11 +46,13 @@
41Most graphical user interface toolkits, such as Motif and XView, provide 46Most graphical user interface toolkits, such as Motif and XView, provide
42a number of standard user interface controls (sometimes known as 47a number of standard user interface controls (sometimes known as
43`widgets' or `gadgets'). Emacs doesn't really support anything like 48`widgets' or `gadgets'). Emacs doesn't really support anything like
44this, except for an incredible powerful text ``widget''. On the other 49this, except for an incredibly powerful text ``widget''. On the other
45hand, Emacs does provide the necessary primitives to implement many 50hand, Emacs does provide the necessary primitives to implement many
46other widgets within a text buffer. The @code{widget} package 51other widgets within a text buffer. The @code{widget} package
47simplifies this task. 52simplifies this task.
48 53
54@cindex basic widgets
55@cindex widgets, basic types
49The basic widgets are: 56The basic widgets are:
50 57
51@table @code 58@table @code
@@ -68,7 +75,7 @@ visible in the buffer.
68A simple constant widget intended to be used in the @code{menu-choice} and 75A simple constant widget intended to be used in the @code{menu-choice} and
69@code{radio-button-choice} widgets. 76@code{radio-button-choice} widgets.
70@item choice-item 77@item choice-item
71An button item only intended for use in choices. When invoked, the user 78A button item only intended for use in choices. When invoked, the user
72will be asked to select another option from the choice widget. 79will be asked to select another option from the choice widget.
73@item toggle 80@item toggle
74A simple @samp{on}/@samp{off} switch. 81A simple @samp{on}/@samp{off} switch.
@@ -79,7 +86,7 @@ Create an editable list. The user can insert or delete items in the
79list. Each list item is itself a widget. 86list. Each list item is itself a widget.
80@end table 87@end table
81 88
82Now of what possible use can support for widgets be in a text editor? 89Now, of what possible use can support for widgets be in a text editor?
83I'm glad you asked. The answer is that widgets are useful for 90I'm glad you asked. The answer is that widgets are useful for
84implementing forms. A @dfn{form} in Emacs is a buffer where the user is 91implementing forms. A @dfn{form} in Emacs is a buffer where the user is
85supposed to fill out a number of fields, each of which has a specific 92supposed to fill out a number of fields, each of which has a specific
@@ -88,34 +95,36 @@ between the fields. Examples of forms in Emacs are the @file{forms}
88package (of course), the customize buffers, the mail and news compose 95package (of course), the customize buffers, the mail and news compose
89modes, and the @sc{html} form support in the @file{w3} browser. 96modes, and the @sc{html} form support in the @file{w3} browser.
90 97
98@cindex widget library, why use it
91The advantages for a programmer of using the @code{widget} package to 99The advantages for a programmer of using the @code{widget} package to
92implement forms are: 100implement forms are:
93 101
94@enumerate 102@enumerate
95@item 103@item
96More complex field than just editable text are supported. 104More complex fields than just editable text are supported.
97@item 105@item
98You can give the user immediate feedback if he enters invalid data in a 106You can give the users immediate feedback if they enter invalid data in a
99text field, and sometimes prevent entering invalid data. 107text field, and sometimes prevent entering invalid data.
100@item 108@item
101You can have fixed sized fields, thus allowing multiple field to be 109You can have fixed sized fields, thus allowing multiple fields to be
102lined up in columns. 110lined up in columns.
103@item 111@item
104It is simple to query or set the value of a field. 112It is simple to query or set the value of a field.
105@item 113@item
106Editing happens in buffer, not in the mini-buffer. 114Editing happens in the buffer, not in the mini-buffer.
107@item 115@item
108Packages using the library get a uniform look, making them easier for 116Packages using the library get a uniform look, making them easier for
109the user to learn. 117the user to learn.
110@item 118@item
111As support for embedded graphics improve, the widget library will 119As support for embedded graphics improve, the widget library will be
112extended to support it. This means that your code using the widget 120extended to use the GUI features. This means that your code using the
113library will also use the new graphic features by automatic. 121widget library will also use the new graphic features automatically.
114@end enumerate 122@end enumerate
115 123
116In order to minimize the code that is loaded by users who does not 124In order to minimize the code that is loaded by users who does not
117create any widgets, the code has been split in two files: 125create any widgets, the code has been split in two files:
118 126
127@cindex widget library, files
119@table @file 128@table @file
120@item widget.el 129@item widget.el
121This will declare the user variables, define the function 130This will declare the user variables, define the function
@@ -130,10 +139,10 @@ it will be autoloaded when needed.
130@section User Interface 139@section User Interface
131 140
132A form consist of read only text for documentation and some fields, 141A form consist of read only text for documentation and some fields,
133where each the fields contain two parts, as tag and a value. The tags 142where each field contains two parts, a tag and a value. The tags are
134are used to identify the fields, so the documentation can refer to the 143used to identify the fields, so the documentation can refer to the
135foo field, meaning the field tagged with @samp{Foo}. Here is an example 144@samp{foo field}, meaning the field tagged with @samp{Foo}. Here is an
136form: 145example form:
137 146
138@example 147@example
139Here is some documentation. 148Here is some documentation.
@@ -169,9 +178,9 @@ Select one:
169The top level widgets in is example are tagged @samp{Name}, 178The top level widgets in is example are tagged @samp{Name},
170@samp{Choose}, @samp{Address}, @samp{_other work_}, @samp{Numbers}, 179@samp{Choose}, @samp{Address}, @samp{_other work_}, @samp{Numbers},
171@samp{Select multiple}, @samp{Select one}, @samp{[Apply Form]}, and 180@samp{Select multiple}, @samp{Select one}, @samp{[Apply Form]}, and
172@samp{[Reset Form]}. There are basically two thing the user can do within 181@samp{[Reset Form]}. There are basically two things the user can do
173a form, namely editing the editable text fields and activating the 182within a form, namely editing the editable text fields and activating
174buttons. 183the buttons.
175 184
176@subsection Editable Text Fields 185@subsection Editable Text Fields
177 186
@@ -194,6 +203,8 @@ Face used for other editing fields.
194 203
195@subsection Buttons 204@subsection Buttons
196 205
206@cindex widget buttons
207@cindex button widgets
197Some portions of the buffer have an associated @dfn{action}, which can 208Some portions of the buffer have an associated @dfn{action}, which can
198be @dfn{invoked} by a standard key or mouse command. These portions 209be @dfn{invoked} by a standard key or mouse command. These portions
199are called @dfn{buttons}. The default commands for activating a button 210are called @dfn{buttons}. The default commands for activating a button
@@ -207,6 +218,7 @@ If point is not located on a button, invoke the binding in
207@code{widget-global-map} (by default the global map). 218@code{widget-global-map} (by default the global map).
208@end deffn 219@end deffn
209 220
221@kindex mouse-2, on button widgets
210@item mouse-2 222@item mouse-2
211@deffn Command widget-button-click @var{event} 223@deffn Command widget-button-click @var{event}
212Invoke the button at the location of the mouse pointer. If the mouse 224Invoke the button at the location of the mouse pointer. If the mouse
@@ -219,32 +231,34 @@ There are several different kind of buttons, all of which are present in
219the example: 231the example:
220 232
221@table @emph 233@table @emph
222@item The Option Field Tags. 234@cindex option field tag
235@item The Option Field Tags
223When you invoke one of these buttons, you will be asked to choose 236When you invoke one of these buttons, you will be asked to choose
224between a number of different options. This is how you edit an option 237between a number of different options. This is how you edit an option
225field. Option fields are created by the @code{menu-choice} widget. In 238field. Option fields are created by the @code{menu-choice} widget. In
226the example, @samp{@b{Choose}} is an option field tag. 239the example, @samp{@b{Choose}} is an option field tag.
227@item The @samp{@b{[INS]}} and @samp{@b{[DEL]}} buttons. 240@item The @samp{@b{[INS]}} and @samp{@b{[DEL]}} buttons
228Activating these will insert or delete elements from a editable list. 241Activating these will insert or delete elements from an editable list.
229The list is created by the @code{editable-list} widget. 242The list is created by the @code{editable-list} widget.
230@item Embedded Buttons. 243@cindex embedded buttons
244@item Embedded Buttons
231The @samp{@b{_other work_}} is an example of an embedded 245The @samp{@b{_other work_}} is an example of an embedded
232button. Embedded buttons are not associated with a fields, but can serve 246button. Embedded buttons are not associated with a fields, but can serve
233any purpose, such as implementing hypertext references. They are 247any purpose, such as implementing hypertext references. They are
234usually created by the @code{link} widget. 248usually created by the @code{link} widget.
235@item The @samp{@b{[ ]}} and @samp{@b{[X]}} buttons. 249@item The @samp{@b{[ ]}} and @samp{@b{[X]}} buttons
236Activating one of these will convert it to the other. This is useful 250Activating one of these will convert it to the other. This is useful
237for implementing multiple-choice fields. You can create it wit 251for implementing multiple-choice fields. You can create it with the
238@item The @samp{@b{( )}} and @samp{@b{(*)}} buttons. 252@code{checkbox} widget.
253@item The @samp{@b{( )}} and @samp{@b{(*)}} buttons
239Only one radio button in a @code{radio-button-choice} widget can be 254Only one radio button in a @code{radio-button-choice} widget can be
240selected at any time. When you invoke one of the unselected radio 255selected at any time. When you invoke one of the unselected radio
241buttons, it will be selected and the previous selected radio button will 256buttons, it will be selected and the previous selected radio button will
242become unselected. 257become unselected.
243@item The @samp{@b{[Apply Form]}} @samp{@b{[Reset Form]}} buttons. 258@item The @samp{@b{[Apply Form]}} @samp{@b{[Reset Form]}} buttons
244These are explicit buttons made with the @code{push-button} widget. The main 259These are explicit buttons made with the @code{push-button} widget. The
245difference from the @code{link} widget is that the buttons are will be 260main difference from the @code{link} widget is that the buttons will be
246displayed as GUI buttons when possible. 261displayed as GUI buttons when possible.
247enough.
248@end table 262@end table
249 263
250To make them easier to locate, buttons are emphasized in the buffer. 264To make them easier to locate, buttons are emphasized in the buffer.
@@ -254,7 +268,8 @@ Face used for buttons.
254@end deffn 268@end deffn
255 269
256@defopt widget-mouse-face 270@defopt widget-mouse-face
257Face used for buttons when the mouse pointer is above it. 271Face used for highlighting a button when the mouse pointer moves across
272it.
258@end defopt 273@end defopt
259 274
260@subsection Navigation 275@subsection Navigation
@@ -277,6 +292,8 @@ Move point @var{count} buttons or editing fields backward.
277@comment node-name, next, previous, up 292@comment node-name, next, previous, up
278@section Programming Example 293@section Programming Example
279 294
295@cindex widgets, programming example
296@cindex example of using widgets
280Here is the code to implement the user interface example (@pxref{User 297Here is the code to implement the user interface example (@pxref{User
281Interface}). 298Interface}).
282 299
@@ -389,7 +406,7 @@ Delete @var{widget} and remove it from the buffer.
389@end defun 406@end defun
390 407
391@defun widget-setup 408@defun widget-setup
392Setup a buffer to support widgets. 409Set up a buffer to support widgets.
393 410
394This should be called after creating all the widgets and before allowing 411This should be called after creating all the widgets and before allowing
395the user to edit them. 412the user to edit them.
@@ -401,17 +418,19 @@ recommended way to do that is with @code{widget-insert}.
401 418
402@defun widget-insert 419@defun widget-insert
403Insert the arguments, either strings or characters, at point. 420Insert the arguments, either strings or characters, at point.
404The inserted text will be read only. 421The inserted text will be read-only.
405@end defun 422@end defun
406 423
407There is a standard widget keymap which you might find useful. 424There is a standard widget keymap which you might find useful.
408 425
426@findex widget-button-press
427@findex widget-button-click
409@defvr Const widget-keymap 428@defvr Const widget-keymap
410A keymap with the global keymap as its parent.@* 429A keymap with the global keymap as its parent.@*
411@key{TAB} and @kbd{C-@key{TAB}} are bound to @code{widget-forward} and 430@key{TAB} and @kbd{C-@key{TAB}} are bound to @code{widget-forward} and
412@code{widget-backward}, respectively. @kbd{@key{RET}} and @kbd{mouse-2} 431@code{widget-backward}, respectively. @kbd{@key{RET}} and @kbd{mouse-2}
413are bound to @code{widget-button-press} and 432are bound to @code{widget-button-press} and
414@code{widget-button-}.@refill 433@code{widget-button-click}.@refill
415@end defvr 434@end defvr
416 435
417@defvar widget-global-map 436@defvar widget-global-map
@@ -434,12 +453,15 @@ Where, @var{name} is a widget name, @var{keyword} is the name of a
434property, @var{argument} is the value of the property, and @var{args} 453property, @var{argument} is the value of the property, and @var{args}
435are interpreted in a widget specific way. 454are interpreted in a widget specific way.
436 455
437There following keyword arguments that apply to all widgets: 456@cindex keyword arguments
457The following keyword arguments that apply to all widgets:
438 458
439@table @code 459@table @code
460@vindex value@r{ keyword}
440@item :value 461@item :value
441The initial value for widgets of this type. 462The initial value for widgets of this type.
442 463
464@vindex format@r{ keyword}
443@item :format 465@item :format
444This string will be inserted in the buffer when you create a widget. 466This string will be inserted in the buffer when you create a widget.
445The following @samp{%} escapes are available: 467The following @samp{%} escapes are available:
@@ -489,12 +511,14 @@ representation of the value if there is no tag.
489Insert a literal @samp{%}. 511Insert a literal @samp{%}.
490@end table 512@end table
491 513
514@vindex button-face@r{ keyword}
492@item :button-face 515@item :button-face
493Face used to highlight text inside %[ %] in the format. 516Face used to highlight text inside %[ %] in the format.
494 517
518@vindex button-prefix@r{ keyword}
519@vindex button-suffix@r{ keyword}
495@item :button-prefix 520@item :button-prefix
496@itemx :button-suffix 521@itemx :button-suffix
497
498Text around %[ %] in the format. 522Text around %[ %] in the format.
499 523
500These can be 524These can be
@@ -509,34 +533,42 @@ The string is inserted literally.
509The value of the symbol is expanded according to this table. 533The value of the symbol is expanded according to this table.
510@end table 534@end table
511 535
536@vindex doc@r{ keyword}
512@item :doc 537@item :doc
513The string inserted by the @samp{%d} escape in the format 538The string inserted by the @samp{%d} escape in the format
514string. 539string.
515 540
541@vindex tag@r{ keyword}
516@item :tag 542@item :tag
517The string inserted by the @samp{%t} escape in the format 543The string inserted by the @samp{%t} escape in the format
518string. 544string.
519 545
546@vindex tag-glyph@r{ keyword}
520@item :tag-glyph 547@item :tag-glyph
521Name of image to use instead of the string specified by `:tag' on 548Name of image to use instead of the string specified by @code{:tag} on
522Emacsen that supports it. 549Emacsen that supports it.
523 550
551@vindex help-echo@r{ keyword}
524@item :help-echo 552@item :help-echo
525Message displayed whenever you move to the widget with either 553Message displayed whenever you move to the widget with either
526@code{widget-forward} or @code{widget-backward}. 554@code{widget-forward} or @code{widget-backward}.
527 555
556@vindex indent@r{ keyword}
528@item :indent 557@item :indent
529An integer indicating the absolute number of spaces to indent children 558An integer indicating the absolute number of spaces to indent children
530of this widget. 559of this widget.
531 560
561@vindex offset@r{ keyword}
532@item :offset 562@item :offset
533An integer indicating how many extra spaces to add to the widget's 563An integer indicating how many extra spaces to add to the widget's
534grandchildren compared to this widget. 564grandchildren compared to this widget.
535 565
566@vindex extra-offset@r{ keyword}
536@item :extra-offset 567@item :extra-offset
537An integer indicating how many extra spaces to add to the widget's 568An integer indicating how many extra spaces to add to the widget's
538children compared to this widget. 569children compared to this widget.
539 570
571@vindex notify@r{ keyword}
540@item :notify 572@item :notify
541A function called each time the widget or a nested widget is changed. 573A function called each time the widget or a nested widget is changed.
542The function is called with two or three arguments. The first argument 574The function is called with two or three arguments. The first argument
@@ -544,25 +576,29 @@ is the widget itself, the second argument is the widget that was
544changed, and the third argument is the event leading to the change, if 576changed, and the third argument is the event leading to the change, if
545any. 577any.
546 578
579@vindex menu-tag@r{ keyword}
547@item :menu-tag 580@item :menu-tag
548Tag used in the menu when the widget is used as an option in a 581Tag used in the menu when the widget is used as an option in a
549@code{menu-choice} widget. 582@code{menu-choice} widget.
550 583
584@vindex menu-tag-get@r{ keyword}
551@item :menu-tag-get 585@item :menu-tag-get
552Function used for finding the tag when the widget is used as an option 586Function used for finding the tag when the widget is used as an option
553in a @code{menu-choice} widget. By default, the tag used will be either the 587in a @code{menu-choice} widget. By default, the tag used will be either the
554@code{:menu-tag} or @code{:tag} property if present, or the @code{princ} 588@code{:menu-tag} or @code{:tag} property if present, or the @code{princ}
555representation of the @code{:value} property if not. 589representation of the @code{:value} property if not.
556 590
591@vindex match@r{ keyword}
557@item :match 592@item :match
558Should be a function called with two arguments, the widget and a value, 593Should be a function called with two arguments, the widget and a value,
559and returning non-nil if the widget can represent the specified value. 594and returning non-nil if the widget can represent the specified value.
560 595
596@vindex validate@r{ keyword}
561@item :validate 597@item :validate
562A function which takes a widget as an argument, and return nil if the 598A function which takes a widget as an argument, and returns @code{nil}
563widget's current value is valid for the widget. Otherwise it should 599if the widget's current value is valid for the widget. Otherwise it
564return the widget containing the invalid data, and set that widget's 600should return the widget containing the invalid data, and set that
565@code{:error} property to a string explaining the error. 601widget's @code{:error} property to a string explaining the error.
566 602
567The following predefined function can be used: 603The following predefined function can be used:
568 604
@@ -570,6 +606,7 @@ The following predefined function can be used:
570All the @code{:children} of @var{widget} must be valid. 606All the @code{:children} of @var{widget} must be valid.
571@end defun 607@end defun
572 608
609@vindex tab-order@r{ keyword}
573@item :tab-order 610@item :tab-order
574Specify the order in which widgets are traversed with 611Specify the order in which widgets are traversed with
575@code{widget-forward} or @code{widget-backward}. This is only partially 612@code{widget-forward} or @code{widget-backward}. This is only partially
@@ -589,10 +626,12 @@ When on a widget with no tabbing order specified, go to the next widget
589in the buffer with a positive tabbing order, or @code{nil} 626in the buffer with a positive tabbing order, or @code{nil}
590@end enumerate 627@end enumerate
591 628
629@vindex parent@r{ keyword}
592@item :parent 630@item :parent
593The parent of a nested widget (e.g. a @code{menu-choice} item or an 631The parent of a nested widget (e.g. a @code{menu-choice} item or an
594element of a @code{editable-list} widget). 632element of a @code{editable-list} widget).
595 633
634@vindex sibling-args@r{ keyword}
596@item :sibling-args 635@item :sibling-args
597This keyword is only used for members of a @code{radio-button-choice} or 636This keyword is only used for members of a @code{radio-button-choice} or
598@code{checklist}. The value should be a list of extra keyword 637@code{checklist}. The value should be a list of extra keyword
@@ -604,7 +643,7 @@ arguments, which will be used when creating the @code{radio-button} or
604@deffn {User Option} widget-glyph-directory 643@deffn {User Option} widget-glyph-directory
605Directory where glyphs are found. 644Directory where glyphs are found.
606Widget will look here for a file with the same name as specified for the 645Widget will look here for a file with the same name as specified for the
607image, with either a @samp{.xpm} (if supported) or @samp{.xbm} extension. 646image, with either a @file{.xpm} (if supported) or @file{.xbm} extension.
608@end deffn 647@end deffn
609 648
610@deffn{User Option} widget-glyph-enable 649@deffn{User Option} widget-glyph-enable
@@ -633,6 +672,7 @@ If non-nil, allow glyphs to appear on displays where they are supported.
633@node link, url-link, Basic Types, Basic Types 672@node link, url-link, Basic Types, Basic Types
634@comment node-name, next, previous, up 673@comment node-name, next, previous, up
635@subsection The @code{link} Widget 674@subsection The @code{link} Widget
675@findex link@r{ widget}
636 676
637Syntax: 677Syntax:
638 678
@@ -657,6 +697,7 @@ String to suffix links.
657@node url-link, info-link, link, Basic Types 697@node url-link, info-link, link, Basic Types
658@comment node-name, next, previous, up 698@comment node-name, next, previous, up
659@subsection The @code{url-link} Widget 699@subsection The @code{url-link} Widget
700@findex url-link@r{ widget}
660 701
661Syntax: 702Syntax:
662 703
@@ -664,12 +705,14 @@ Syntax:
664TYPE ::= (url-link [KEYWORD ARGUMENT]... URL) 705TYPE ::= (url-link [KEYWORD ARGUMENT]... URL)
665@end example 706@end example
666 707
708@findex browse-url-browser-function@r{, and @code{url-link} widget}
667When this link is invoked, the @sc{www} browser specified by 709When this link is invoked, the @sc{www} browser specified by
668@code{browse-url-browser-function} will be called with @var{url}. 710@code{browse-url-browser-function} will be called with @var{url}.
669 711
670@node info-link, push-button, url-link, Basic Types 712@node info-link, push-button, url-link, Basic Types
671@comment node-name, next, previous, up 713@comment node-name, next, previous, up
672@subsection The @code{info-link} Widget 714@subsection The @code{info-link} Widget
715@findex info-link@r{ widget}
673 716
674Syntax: 717Syntax:
675 718
@@ -677,12 +720,13 @@ Syntax:
677TYPE ::= (info-link [KEYWORD ARGUMENT]... ADDRESS) 720TYPE ::= (info-link [KEYWORD ARGUMENT]... ADDRESS)
678@end example 721@end example
679 722
680When this link is invoked, the built-in info browser is started on 723When this link is invoked, the built-in Info reader is started on
681@var{address}. 724@var{address}.
682 725
683@node push-button, editable-field, info-link, Basic Types 726@node push-button, editable-field, info-link, Basic Types
684@comment node-name, next, previous, up 727@comment node-name, next, previous, up
685@subsection The @code{push-button} Widget 728@subsection The @code{push-button} Widget
729@findex push-button@r{ widget}
686 730
687Syntax: 731Syntax:
688 732
@@ -691,7 +735,7 @@ TYPE ::= (push-button [KEYWORD ARGUMENT]... [ VALUE ])
691@end example 735@end example
692 736
693The @var{value}, if present, is used to initialize the @code{:value} 737The @var{value}, if present, is used to initialize the @code{:value}
694property. The value should be a string, which will be inserted in the 738property. The value should be a string, which will be inserted in the
695buffer. 739buffer.
696 740
697By default the tag will be shown in brackets. 741By default the tag will be shown in brackets.
@@ -707,6 +751,7 @@ String to suffix push buttons.
707@node editable-field, text, push-button, Basic Types 751@node editable-field, text, push-button, Basic Types
708@comment node-name, next, previous, up 752@comment node-name, next, previous, up
709@subsection The @code{editable-field} Widget 753@subsection The @code{editable-field} Widget
754@findex editable-field@r{ widget}
710 755
711Syntax: 756Syntax:
712 757
@@ -718,45 +763,55 @@ The @var{value}, if present, is used to initialize the @code{:value}
718property. The value should be a string, which will be inserted in 763property. The value should be a string, which will be inserted in
719field. This widget will match all string values. 764field. This widget will match all string values.
720 765
721The following extra properties are recognized. 766The following extra properties are recognized:
722 767
723@table @code 768@table @code
769@vindex size@r{ keyword}
724@item :size 770@item :size
725The width of the editable field.@* 771The width of the editable field.@*
726By default the field will reach to the end of the line. 772By default the field will reach to the end of the line.
727 773
774@vindex value-face@r{ keyword}
728@item :value-face 775@item :value-face
729Face used for highlighting the editable field. Default is 776Face used for highlighting the editable field. Default is
730@code{widget-field-face}. 777@code{widget-field-face}, see @ref{User Interface}.
731 778
779@vindex secret@r{ keyword}
732@item :secret 780@item :secret
733Character used to display the value. You can set this to e.g. @code{?*} 781Character used to display the value. You can set this to e.g. @code{?*}
734if the field contains a password or other secret information. By 782if the field contains a password or other secret information. By
735default, the value is not secret. 783default, this is nil, and the value is not secret.
736 784
785@vindex valid-regexp@r{ keyword}
737@item :valid-regexp 786@item :valid-regexp
738By default the @code{:validate} function will match the content of the 787By default the @code{:validate} function will match the content of the
739field with the value of this attribute. The default value is @code{""} 788field with the value of this attribute. The default value is @code{""}
740which matches everything. 789which matches everything.
741 790
791@vindex keymap@r{ keyword}
792@vindex widget-field-keymap
742@item :keymap 793@item :keymap
743Keymap used in the editable field. The default value is 794Keymap used in the editable field. The default value is
744@code{widget-field-keymap}, which allows you to use all the normal 795@code{widget-field-keymap}, which allows you to use all the normal
745editing commands, even if the buffers major mode suppress some of them. 796editing commands, even if the buffer's major mode suppresses some of
746Pressing return invokes the function specified by @code{:action}. 797them. Pressing @key{RET} invokes the function specified by
798@code{:action}.
747@end table 799@end table
748 800
749@node text, menu-choice, editable-field, Basic Types 801@node text, menu-choice, editable-field, Basic Types
750@comment node-name, next, previous, up 802@comment node-name, next, previous, up
751@subsection The @code{text} Widget 803@subsection The @code{text} Widget
804@findex text@r{ widget}
752 805
806@vindex widget-text-keymap
753This is just like @code{editable-field}, but intended for multiline text 807This is just like @code{editable-field}, but intended for multiline text
754fields. The default @code{:keymap} is @code{widget-text-keymap}, which 808fields. The default @code{:keymap} is @code{widget-text-keymap}, which
755does not rebind the return key. 809does not rebind the @key{RET} key.
756 810
757@node menu-choice, radio-button-choice, text, Basic Types 811@node menu-choice, radio-button-choice, text, Basic Types
758@comment node-name, next, previous, up 812@comment node-name, next, previous, up
759@subsection The @code{menu-choice} Widget 813@subsection The @code{menu-choice} Widget
814@findex menu-choice@r{ widget}
760 815
761Syntax: 816Syntax:
762 817
@@ -770,21 +825,26 @@ match any value matching at least one of the specified @var{type}
770arguments. 825arguments.
771 826
772@table @code 827@table @code
828@vindex void@r{ keyword}
773@item :void 829@item :void
774Widget type used as a fallback when the value does not match any of the 830Widget type used as a fallback when the value does not match any of the
775specified @var{type} arguments. 831specified @var{type} arguments.
776 832
833@vindex case-fold@r{ keyword}
777@item :case-fold 834@item :case-fold
778Set this to nil if you don't want to ignore case when prompting for a 835Set this to nil if you don't want to ignore case when prompting for a
779choice through the minibuffer. 836choice through the minibuffer.
780 837
838@vindex children@r{ keyword}
781@item :children 839@item :children
782A list whose car is the widget representing the currently chosen type in 840A list whose @code{car} is the widget representing the currently chosen
783the buffer. 841type in the buffer.
784 842
843@vindex choice@r{ keyword}
785@item :choice 844@item :choice
786The current chosen type 845The current chosen type.
787 846
847@vindex args@r{ keyword}
788@item :args 848@item :args
789The list of types. 849The list of types.
790@end table 850@end table
@@ -792,6 +852,7 @@ The list of types.
792@node radio-button-choice, item, menu-choice, Basic Types 852@node radio-button-choice, item, menu-choice, Basic Types
793@comment node-name, next, previous, up 853@comment node-name, next, previous, up
794@subsection The @code{radio-button-choice} Widget 854@subsection The @code{radio-button-choice} Widget
855@findex radio-button-choice@r{ widget}
795 856
796Syntax: 857Syntax:
797 858
@@ -807,31 +868,37 @@ arguments.
807The following extra properties are recognized. 868The following extra properties are recognized.
808 869
809@table @code 870@table @code
871@vindex entry-format@r{ keyword}
810@item :entry-format 872@item :entry-format
811This string will be inserted for each entry in the list. 873This string will be inserted for each entry in the list.
812The following @samp{%} escapes are available: 874The following @samp{%} escapes are available:
813@table @samp 875@table @samp
814@item %v 876@item %v
815Replaced with the buffer representation of the @var{type} widget. 877Replace with the buffer representation of the @var{type} widget.
816@item %b 878@item %b
817Replace with the radio button. 879Replace with the radio button.
818@item %% 880@item %%
819Insert a literal @samp{%}. 881Insert a literal @samp{%}.
820@end table 882@end table
821 883
822@item button-args 884@vindex button-args@r{ keyword}
885@item :button-args
823A list of keywords to pass to the radio buttons. Useful for setting 886A list of keywords to pass to the radio buttons. Useful for setting
824e.g. the @samp{:help-echo} for each button. 887e.g. the @samp{:help-echo} for each button.
825 888
889@vindex buttons@r{ keyword}
826@item :buttons 890@item :buttons
827The widgets representing the radio buttons. 891The widgets representing the radio buttons.
828 892
893@vindex children@r{ keyword}
829@item :children 894@item :children
830The widgets representing each type. 895The widgets representing each type.
831 896
897@vindex choice@r{ keyword}
832@item :choice 898@item :choice
833The current chosen type 899The current chosen type
834 900
901@vindex args@r{ keyword}
835@item :args 902@item :args
836The list of types. 903The list of types.
837@end table 904@end table
@@ -841,8 +908,8 @@ widget after it has been created with the function
841@code{widget-radio-add-item}. 908@code{widget-radio-add-item}.
842 909
843@defun widget-radio-add-item widget type 910@defun widget-radio-add-item widget type
844Add to @code{radio-button-choice} widget @var{widget} a new radio button item of type 911Add to @code{radio-button-choice} widget @var{widget} a new radio button
845@var{type}. 912item of type @var{type}.
846@end defun 913@end defun
847 914
848Please note that such items added after the @code{radio-button-choice} 915Please note that such items added after the @code{radio-button-choice}
@@ -852,6 +919,7 @@ you call @code{widget-delete}.
852@node item, choice-item, radio-button-choice, Basic Types 919@node item, choice-item, radio-button-choice, Basic Types
853@comment node-name, next, previous, up 920@comment node-name, next, previous, up
854@subsection The @code{item} Widget 921@subsection The @code{item} Widget
922@findex item@r{ widget}
855 923
856Syntax: 924Syntax:
857 925
@@ -866,6 +934,7 @@ buffer. This widget will only match the specified value.
866@node choice-item, toggle, item, Basic Types 934@node choice-item, toggle, item, Basic Types
867@comment node-name, next, previous, up 935@comment node-name, next, previous, up
868@subsection The @code{choice-item} Widget 936@subsection The @code{choice-item} Widget
937@findex choice-item@r{ widget}
869 938
870Syntax: 939Syntax:
871 940
@@ -882,6 +951,7 @@ the specified value.
882@node toggle, checkbox, choice-item, Basic Types 951@node toggle, checkbox, choice-item, Basic Types
883@comment node-name, next, previous, up 952@comment node-name, next, previous, up
884@subsection The @code{toggle} Widget 953@subsection The @code{toggle} Widget
954@findex toggle@r{ widget}
885 955
886Syntax: 956Syntax:
887 957
@@ -889,30 +959,35 @@ Syntax:
889TYPE ::= (toggle [KEYWORD ARGUMENT]...) 959TYPE ::= (toggle [KEYWORD ARGUMENT]...)
890@end example 960@end example
891 961
892The widget has two possible states, `on' and `off', which correspond to 962The widget has two possible states, @samp{on} and @samp{off}, which
893a @code{t} or @code{nil} value respectively. 963correspond to a @code{t} or @code{nil} value, respectively.
894 964
895The following extra properties are recognized. 965The following extra properties are recognized:
896 966
897@table @code 967@table @code
898@item :on 968@item :on
899String representing the `on' state. By default the string @samp{on}. 969A string representing the @samp{on} state. By default the string
970@samp{on}.
900@item :off 971@item :off
901String representing the `off' state. By default the string @samp{off}. 972A string representing the @samp{off} state. By default the string
973@samp{off}.
974@vindex on-glyph@r{ keyword}
902@item :on-glyph 975@item :on-glyph
903Name of a glyph to be used instead of the `:on' text string, on emacsen 976Name of a glyph to be used instead of the @samp{:on} text string, on
904that supports it. 977emacsen that supports this.
978@vindex off-glyph@r{ keyword}
905@item :off-glyph 979@item :off-glyph
906Name of a glyph to be used instead of the `:off' text string, on emacsen 980Name of a glyph to be used instead of the @samp{:off} text string, on
907that supports it. 981emacsen that supports this.
908@end table 982@end table
909 983
910@node checkbox, checklist, toggle, Basic Types 984@node checkbox, checklist, toggle, Basic Types
911@comment node-name, next, previous, up 985@comment node-name, next, previous, up
912@subsection The @code{checkbox} Widget 986@subsection The @code{checkbox} Widget
987@findex checkbox@r{ widget}
913 988
914The widget has two possible states, `selected' and `unselected', which 989This widget has two possible states, @samp{selected} and
915corresponds to a @code{t} or @code{nil} value. 990@samp{unselected}, which corresponds to a @code{t} or @code{nil} value.
916 991
917Syntax: 992Syntax:
918 993
@@ -923,6 +998,7 @@ TYPE ::= (checkbox [KEYWORD ARGUMENT]...)
923@node checklist, editable-list, checkbox, Basic Types 998@node checklist, editable-list, checkbox, Basic Types
924@comment node-name, next, previous, up 999@comment node-name, next, previous, up
925@subsection The @code{checklist} Widget 1000@subsection The @code{checklist} Widget
1001@findex checklist@r{ widget}
926 1002
927Syntax: 1003Syntax:
928 1004
@@ -930,14 +1006,15 @@ Syntax:
930TYPE ::= (checklist [KEYWORD ARGUMENT]... TYPE ... ) 1006TYPE ::= (checklist [KEYWORD ARGUMENT]... TYPE ... )
931@end example 1007@end example
932 1008
933The @var{type} arguments represents each checklist item. The widget's 1009The @var{type} arguments represent each checklist item. The widget's
934value will be a list containing the values of all ticked @var{type} 1010value will be a list containing the values of all checked @var{type}
935arguments. The checklist widget will match a list whose elements all 1011arguments. The checklist widget will match a list whose elements all
936match at least one of the specified @var{type} arguments. 1012match at least one of the specified @var{type} arguments.
937 1013
938The following extra properties are recognized. 1014The following extra properties are recognized:
939 1015
940@table @code 1016@table @code
1017@vindex entry-format@r{ keyword}
941@item :entry-format 1018@item :entry-format
942This string will be inserted for each entry in the list. 1019This string will be inserted for each entry in the list.
943The following @samp{%} escapes are available: 1020The following @samp{%} escapes are available:
@@ -950,6 +1027,7 @@ Replace with the checkbox.
950Insert a literal @samp{%}. 1027Insert a literal @samp{%}.
951@end table 1028@end table
952 1029
1030@vindex greedy@r{ keyword}
953@item :greedy 1031@item :greedy
954Usually a checklist will only match if the items are in the exact 1032Usually a checklist will only match if the items are in the exact
955sequence given in the specification. By setting @code{:greedy} to 1033sequence given in the specification. By setting @code{:greedy} to
@@ -957,16 +1035,20 @@ non-nil, it will allow the items to come in any sequence. However, if
957you extract the value they will be in the sequence given in the 1035you extract the value they will be in the sequence given in the
958checklist. I.e. the original sequence is forgotten. 1036checklist. I.e. the original sequence is forgotten.
959 1037
1038@vindex button-args@r{ keyword}
960@item button-args 1039@item button-args
961A list of keywords to pass to the checkboxes. Useful for setting 1040A list of keywords to pass to the checkboxes. Useful for setting
962e.g. the @samp{:help-echo} for each checkbox. 1041e.g. the @samp{:help-echo} for each checkbox.
963 1042
1043@vindex buttons@r{ keyword}
964@item :buttons 1044@item :buttons
965The widgets representing the checkboxes. 1045The widgets representing the checkboxes.
966 1046
1047@vindex children@r{ keyword}
967@item :children 1048@item :children
968The widgets representing each type. 1049The widgets representing each type.
969 1050
1051@vindex args@r{ keyword}
970@item :args 1052@item :args
971The list of types. 1053The list of types.
972@end table 1054@end table
@@ -974,6 +1056,7 @@ The list of types.
974@node editable-list, group, checklist, Basic Types 1056@node editable-list, group, checklist, Basic Types
975@comment node-name, next, previous, up 1057@comment node-name, next, previous, up
976@subsection The @code{editable-list} Widget 1058@subsection The @code{editable-list} Widget
1059@findex editable-list@r{ widget}
977 1060
978Syntax: 1061Syntax:
979 1062
@@ -984,9 +1067,10 @@ TYPE ::= (editable-list [KEYWORD ARGUMENT]... TYPE)
984The value is a list, where each member represents one widget of type 1067The value is a list, where each member represents one widget of type
985@var{type}. 1068@var{type}.
986 1069
987The following extra properties are recognized. 1070The following extra properties are recognized:
988 1071
989@table @code 1072@table @code
1073@vindex entry-format@r{ keyword}
990@item :entry-format 1074@item :entry-format
991This string will be inserted for each entry in the list. 1075This string will be inserted for each entry in the list.
992The following @samp{%} escapes are available: 1076The following @samp{%} escapes are available:
@@ -1002,32 +1086,37 @@ Insert the @b{[DEL]} button.
1002Insert a literal @samp{%}. 1086Insert a literal @samp{%}.
1003@end table 1087@end table
1004 1088
1089@vindex insert-button-args@r{ keyword}
1005@item :insert-button-args 1090@item :insert-button-args
1006A list of keyword arguments to pass to the insert buttons. 1091A list of keyword arguments to pass to the insert buttons.
1007 1092
1093@vindex delete-button-args@r{ keyword}
1008@item :delete-button-args 1094@item :delete-button-args
1009A list of keyword arguments to pass to the delete buttons. 1095A list of keyword arguments to pass to the delete buttons.
1010 1096
1097@vindex append-button-args@r{ keyword}
1011@item :append-button-args 1098@item :append-button-args
1012A list of keyword arguments to pass to the trailing insert button. 1099A list of keyword arguments to pass to the trailing insert button.
1013 1100
1014 1101@vindex buttons@r{ keyword}
1015@item :buttons 1102@item :buttons
1016The widgets representing the insert and delete buttons. 1103The widgets representing the insert and delete buttons.
1017 1104
1105@vindex children@r{ keyword}
1018@item :children 1106@item :children
1019The widgets representing the elements of the list. 1107The widgets representing the elements of the list.
1020 1108
1109@vindex args@r{ keyword}
1021@item :args 1110@item :args
1022List whose car is the type of the list elements. 1111List whose @code{car} is the type of the list elements.
1023
1024@end table 1112@end table
1025 1113
1026@node group, , editable-list, Basic Types 1114@node group, , editable-list, Basic Types
1027@comment node-name, next, previous, up 1115@comment node-name, next, previous, up
1028@subsection The @code{group} Widget 1116@subsection The @code{group} Widget
1117@findex group@r{ widget}
1029 1118
1030This widget simply group other widget together. 1119This widget simply group other widgets together.
1031 1120
1032Syntax: 1121Syntax:
1033 1122
@@ -1040,9 +1129,11 @@ The value is a list, with one member for each @var{type}.
1040@node Sexp Types, Widget Properties, Basic Types, Top 1129@node Sexp Types, Widget Properties, Basic Types, Top
1041@comment 1130@comment
1042@section Sexp Types 1131@section Sexp Types
1132@cindex sexp types
1043 1133
1044A number of widgets for editing s-expressions (lisp types) are also 1134A number of widgets for editing @dfn{s-expressions} (lisp types), sexp
1045available. These basically fall in the following categories. 1135for short, are also available. These basically fall in several
1136categories described in this section.
1046 1137
1047@menu 1138@menu
1048* constants:: 1139* constants::
@@ -1053,13 +1144,14 @@ available. These basically fall in the following categories.
1053 1144
1054@node constants, generic, Sexp Types, Sexp Types 1145@node constants, generic, Sexp Types, Sexp Types
1055@comment node-name, next, previous, up 1146@comment node-name, next, previous, up
1056@subsection The Constant Widgets. 1147@subsection The Constant Widgets
1148@cindex constant widgets
1057 1149
1058The @code{const} widget can contain any lisp expression, but the user is 1150The @code{const} widget can contain any lisp expression, but the user is
1059prohibited from editing edit it, which is mainly useful as a component 1151prohibited from editing it, which is mainly useful as a component of one
1060of one of the composite widgets. 1152of the composite widgets.
1061 1153
1062The syntax for the @code{const} widget is 1154The syntax for the @code{const} widget is:
1063 1155
1064@example 1156@example
1065TYPE ::= (const [KEYWORD ARGUMENT]... [ VALUE ]) 1157TYPE ::= (const [KEYWORD ARGUMENT]... [ VALUE ])
@@ -1089,12 +1181,13 @@ An immutable symbol that is bound as a function.
1089 1181
1090@node generic, atoms, constants, Sexp Types 1182@node generic, atoms, constants, Sexp Types
1091@comment node-name, next, previous, up 1183@comment node-name, next, previous, up
1092@subsection Generic Sexp Widget. 1184@subsection Generic Sexp Widget
1185@cindex generic sexp widget
1093 1186
1094The @code{sexp} widget can contain any lisp expression, and allows the 1187The @code{sexp} widget can contain any lisp expression, and allows the
1095user to edit it inline in the buffer. 1188user to edit it inline in the buffer.
1096 1189
1097The syntax for the @code{sexp} widget is 1190The syntax for the @code{sexp} widget is:
1098 1191
1099@example 1192@example
1100TYPE ::= (sexp [KEYWORD ARGUMENT]... [ VALUE ]) 1193TYPE ::= (sexp [KEYWORD ARGUMENT]... [ VALUE ])
@@ -1105,18 +1198,20 @@ This will allow you to edit any valid s-expression in an editable buffer
1105field. 1198field.
1106 1199
1107The @code{sexp} widget takes the same keyword arguments as the 1200The @code{sexp} widget takes the same keyword arguments as the
1108@code{editable-field} widget. 1201@code{editable-field} widget. @xref{editable-field}.
1109@end deffn 1202@end deffn
1110 1203
1111@node atoms, composite, generic, Sexp Types 1204@node atoms, composite, generic, Sexp Types
1112@comment node-name, next, previous, up 1205@comment node-name, next, previous, up
1113@subsection Atomic Sexp Widgets. 1206@subsection Atomic Sexp Widgets
1207@cindex atomic sexp widget
1114 1208
1115The atoms are s-expressions that does not consist of other 1209The atoms are s-expressions that do not consist of other s-expressions.
1116s-expressions. A string is an atom, while a list is a composite type. 1210For example, a string, a file name, or a symbol are atoms, while a list
1117You can edit the value of an atom with the following widgets. 1211is a composite type. You can edit the value of an atom with the
1212following widgets.
1118 1213
1119The syntax for all the atoms are 1214The syntax for all the atoms are:
1120 1215
1121@example 1216@example
1122TYPE ::= (NAME [KEYWORD ARGUMENT]... [ VALUE ]) 1217TYPE ::= (NAME [KEYWORD ARGUMENT]... [ VALUE ])
@@ -1124,10 +1219,10 @@ TYPE ::= (NAME [KEYWORD ARGUMENT]... [ VALUE ])
1124 1219
1125The @var{value}, if present, is used to initialize the @code{:value} 1220The @var{value}, if present, is used to initialize the @code{:value}
1126property and must be an expression of the same type as the widget. 1221property and must be an expression of the same type as the widget.
1127I.e. the string widget can only be initialized with a string. 1222That is, the string widget can only be initialized with a string.
1128 1223
1129All the atom widgets take the same keyword arguments as the 1224All the atom widgets take the same keyword arguments as the
1130@code{editable-field} widget. 1225@code{editable-field} widget. @xref{editable-field}.
1131 1226
1132@deffn Widget string 1227@deffn Widget string
1133Allows you to edit a string in an editable field. 1228Allows you to edit a string in an editable field.
@@ -1148,6 +1243,7 @@ completion.
1148 1243
1149Keywords: 1244Keywords:
1150@table @code 1245@table @code
1246@vindex must-match@r{ keyword}
1151@item :must-match 1247@item :must-match
1152If this is set to non-nil, only existing file names will be allowed in 1248If this is set to non-nil, only existing file names will be allowed in
1153the minibuffer. 1249the minibuffer.
@@ -1187,21 +1283,23 @@ either nil meaning false, or non-nil meaning true.
1187 1283
1188@node composite, , atoms, Sexp Types 1284@node composite, , atoms, Sexp Types
1189@comment node-name, next, previous, up 1285@comment node-name, next, previous, up
1190@subsection Composite Sexp Widgets. 1286@subsection Composite Sexp Widgets
1287@cindex composite sexp widgets
1191 1288
1192The syntax for the composite are 1289The syntax for the composite widget is:
1193 1290
1194@example 1291@example
1195TYPE ::= (NAME [KEYWORD ARGUMENT]... COMPONENT...) 1292TYPE ::= (NAME [KEYWORD ARGUMENT]... COMPONENT...)
1196@end example 1293@end example
1197 1294
1198Where each @var{component} must be a widget type. Each component widget 1295@noindent
1199will be displayed in the buffer, and be editable to the user. 1296where each @var{component} must be a widget type. Each component widget
1297will be displayed in the buffer, and will be editable by the user.
1200 1298
1201@deffn Widget cons 1299@deffn Widget cons
1202The value of a @code{cons} widget is a cons-cell where the car is the 1300The value of a @code{cons} widget is a cons-cell where the @code{car} is
1203value of the first component and the cdr is the value of the second 1301the value of the first component and the @code{cdr} is the value of the
1204component. There must be exactly two components. 1302second component. There must be exactly two components.
1205@end deffn 1303@end deffn
1206 1304
1207@deffn Widget list 1305@deffn Widget list
@@ -1216,7 +1314,7 @@ each of its component.
1216 1314
1217The above suffice for specifying fixed size lists and vectors. To get 1315The above suffice for specifying fixed size lists and vectors. To get
1218variable length lists and vectors, you can use a @code{choice}, 1316variable length lists and vectors, you can use a @code{choice},
1219@code{set} or @code{repeat} widgets together with the @code{:inline} 1317@code{set}, or @code{repeat} widgets together with the @code{:inline}
1220keywords. If any component of a composite widget has the @code{:inline} 1318keywords. If any component of a composite widget has the @code{:inline}
1221keyword set, its value must be a list which will then be spliced into 1319keyword set, its value must be a list which will then be spliced into
1222the composite. For example, to specify a list whose first element must 1320the composite. For example, to specify a list whose first element must
@@ -1233,10 +1331,10 @@ specification:
1233@end example 1331@end example
1234 1332
1235The value of a widget of this type will either have the form 1333The value of a widget of this type will either have the form
1236@samp{(file t)} or @code{(file string string)}. 1334@code{(file t)} or @code{(file string string)}.
1237 1335
1238This concept of inline is probably hard to understand. It was certainly 1336This concept of inline is probably hard to understand. It was certainly
1239hard to implement so instead of confusing you more by trying to explain 1337hard to implement, so instead of confusing you more by trying to explain
1240it here, I'll just suggest you meditate over it for a while. 1338it here, I'll just suggest you meditate over it for a while.
1241 1339
1242@deffn Widget choice 1340@deffn Widget choice
@@ -1247,20 +1345,22 @@ and has a similar syntax.
1247 1345
1248@deffn Widget set 1346@deffn Widget set
1249Allows you to specify a type which must be a list whose elements all 1347Allows you to specify a type which must be a list whose elements all
1250belong to given set. The elements of the list is not significant. This 1348belong to given set. The elements of the list are not significant.
1251is implemented on top of the @code{checklist} basic widget, and has a 1349This is implemented on top of the @code{checklist} basic widget, and has
1252similar syntax. 1350a similar syntax.
1253@end deffn 1351@end deffn
1254 1352
1255@deffn Widget repeat 1353@deffn Widget repeat
1256Allows you to specify a variable length list whose members are all of 1354Allows you to specify a variable length list whose members are all of
1257the same type. Implemented on top of the `editable-list' basic widget, 1355the same type. Implemented on top of the @code{editable-list} basic
1258and has a similar syntax. 1356widget, and has a similar syntax.
1259@end deffn 1357@end deffn
1260 1358
1261@node Widget Properties, Defining New Widgets, Sexp Types, Top 1359@node Widget Properties, Defining New Widgets, Sexp Types, Top
1262@comment node-name, next, previous, up 1360@comment node-name, next, previous, up
1263@section Properties 1361@section Properties
1362@cindex properties of widgets
1363@cindex widget properties
1264 1364
1265You can examine or set the value of a widget by using the widget object 1365You can examine or set the value of a widget by using the widget object
1266that was returned by @code{widget-create}. 1366that was returned by @code{widget-create}.
@@ -1309,6 +1409,10 @@ i.e. the name of the widget type you gave when the widget was created.
1309Return the name of @var{widget}, a symbol. 1409Return the name of @var{widget}, a symbol.
1310@end defun 1410@end defun
1311 1411
1412@cindex active widget
1413@cindex inactive widget
1414@cindex activate a widget
1415@cindex deactivate a widget
1312Widgets can be in two states: active, which means they are modifiable by 1416Widgets can be in two states: active, which means they are modifiable by
1313the user, or inactive, which means they cannot be modified by the user. 1417the user, or inactive, which means they cannot be modified by the user.
1314You can query or set the state with the following code: 1418You can query or set the state with the following code:
@@ -1349,8 +1453,10 @@ its ancestors have been deactivated. Do not attempt to set the
1349@node Defining New Widgets, Widget Browser, Widget Properties, Top 1453@node Defining New Widgets, Widget Browser, Widget Properties, Top
1350@comment node-name, next, previous, up 1454@comment node-name, next, previous, up
1351@section Defining New Widgets 1455@section Defining New Widgets
1456@cindex new widgets
1457@cindex defining new widgets
1352 1458
1353You can define specialized widgets with @code{define-widget}. It allows 1459You can define specialized widgets with @code{widget-define}. It allows
1354you to create a shorthand for more complex widgets, including specifying 1460you to create a shorthand for more complex widgets, including specifying
1355component widgets and new default values for the keyword 1461component widgets and new default values for the keyword
1356arguments. 1462arguments.
@@ -1384,12 +1490,13 @@ Using @code{widget-define} just stores the definition of the widget type
1384in the @code{widget-type} property of @var{name}, which is what 1490in the @code{widget-type} property of @var{name}, which is what
1385@code{widget-create} uses. 1491@code{widget-create} uses.
1386 1492
1387If you just want to specify defaults for keywords with no complex 1493If you only want to specify defaults for keywords with no complex
1388conversions, you can use @code{identity} as your conversion function. 1494conversions, you can use @code{identity} as your conversion function.
1389 1495
1390The following additional keyword arguments are useful when defining new 1496The following additional keyword arguments are useful when defining new
1391widgets: 1497widgets:
1392@table @code 1498@table @code
1499@vindex convert-widget@r{ keyword}
1393@item :convert-widget 1500@item :convert-widget
1394Function to convert a widget type before creating a widget of that 1501Function to convert a widget type before creating a widget of that
1395type. It takes a widget type as an argument, and returns the converted 1502type. It takes a widget type as an argument, and returns the converted
@@ -1406,6 +1513,7 @@ Convert @code{:args} as widget types in @var{widget}.
1406Initialize @code{:value} from @code{:args} in @var{widget}. 1513Initialize @code{:value} from @code{:args} in @var{widget}.
1407@end defun 1514@end defun
1408 1515
1516@vindex value-to-internal@r{ keyword}
1409@item :value-to-internal 1517@item :value-to-internal
1410Function to convert the value to the internal format. The function 1518Function to convert the value to the internal format. The function
1411takes two arguments, a widget and an external value, and returns the 1519takes two arguments, a widget and an external value, and returns the
@@ -1413,27 +1521,32 @@ internal value. The function is called on the present @code{:value}
1413when the widget is created, and on any value set later with 1521when the widget is created, and on any value set later with
1414@code{widget-value-set}. 1522@code{widget-value-set}.
1415 1523
1524@vindex value-to-external@r{ keyword}
1416@item :value-to-external 1525@item :value-to-external
1417Function to convert the value to the external format. The function 1526Function to convert the value to the external format. The function
1418takes two arguments, a widget and an internal value, and returns the 1527takes two arguments, a widget and an internal value, and returns the
1419internal value. The function is called on the present @code{:value} 1528external value. The function is called on the present @code{:value}
1420when the widget is created, and on any value set later with 1529when the widget is created, and on any value set later with
1421@code{widget-value-set}. 1530@code{widget-value-set}.
1422 1531
1532@vindex create@r{ keyword}
1423@item :create 1533@item :create
1424Function to create a widget from scratch. The function takes one 1534Function to create a widget from scratch. The function takes one
1425argument, a widget type, and creates a widget of that type, inserts it 1535argument, a widget type, and creates a widget of that type, inserts it
1426in the buffer, and returns a widget object. 1536in the buffer, and returns a widget object.
1427 1537
1538@vindex delete@r{ keyword}
1428@item :delete 1539@item :delete
1429Function to delete a widget. The function takes one argument, a widget, 1540Function to delete a widget. The function takes one argument, a widget,
1430and should remove all traces of the widget from the buffer. 1541and should remove all traces of the widget from the buffer.
1431 1542
1543@vindex value-create@r{ keyword}
1432@item :value-create 1544@item :value-create
1433Function to expand the @samp{%v} escape in the format string. It will 1545Function to expand the @samp{%v} escape in the format string. It will
1434be called with the widget as its argument and should insert a 1546be called with the widget as its argument and should insert a
1435representation of the widget's value in the buffer. 1547representation of the widget's value in the buffer.
1436 1548
1549@vindex value-delete@r{ keyword}
1437@item :value-delete 1550@item :value-delete
1438Should remove the representation of the widget's value from the buffer. 1551Should remove the representation of the widget's value from the buffer.
1439It will be called with the widget as its argument. It doesn't have to 1552It will be called with the widget as its argument. It doesn't have to
@@ -1446,6 +1559,7 @@ The following predefined function can be used here:
1446Delete all @code{:children} and @code{:buttons} in @var{widget}. 1559Delete all @code{:children} and @code{:buttons} in @var{widget}.
1447@end defun 1560@end defun
1448 1561
1562@vindex value-get@r{ keyword}
1449@item :value-get 1563@item :value-get
1450Function to extract the value of a widget, as it is displayed in the 1564Function to extract the value of a widget, as it is displayed in the
1451buffer. 1565buffer.
@@ -1456,15 +1570,19 @@ The following predefined function can be used here:
1456Return the @code{:value} property of @var{widget}. 1570Return the @code{:value} property of @var{widget}.
1457@end defun 1571@end defun
1458 1572
1573@vindex format-handler@r{ keyword}
1459@item :format-handler 1574@item :format-handler
1460Function to handle unknown @samp{%} escapes in the format string. It 1575Function to handle unknown @samp{%} escapes in the format string. It
1461will be called with the widget and the escape character as arguments. 1576will be called with the widget and the character that follows the
1462You can set this to allow your widget to handle non-standard escapes. 1577@samp{%} as arguments. You can set this to allow your widget to handle
1578non-standard escapes.
1463 1579
1580@findex widget-default-format-handler
1464You should end up calling @code{widget-default-format-handler} to handle 1581You should end up calling @code{widget-default-format-handler} to handle
1465unknown escape sequences, which will handle the @samp{%h} and any future 1582unknown escape sequences, which will handle the @samp{%h} and any future
1466escape sequences, as well as give an error for unknown escapes. 1583escape sequences, as well as give an error for unknown escapes.
1467 1584
1585@vindex action@r{ keyword}
1468@item :action 1586@item :action
1469Function to handle user initiated events. By default, @code{:notify} 1587Function to handle user initiated events. By default, @code{:notify}
1470the parent. 1588the parent.
@@ -1476,6 +1594,7 @@ Tell @code{:parent} of @var{widget} to handle the @code{:action}.
1476Optional @var{event} is the event that triggered the action. 1594Optional @var{event} is the event that triggered the action.
1477@end defun 1595@end defun
1478 1596
1597@vindex prompt-value@r{ keyword}
1479@item :prompt-value 1598@item :prompt-value
1480Function to prompt for a value in the minibuffer. The function should 1599Function to prompt for a value in the minibuffer. The function should
1481take four arguments, @var{widget}, @var{prompt}, @var{value}, and 1600take four arguments, @var{widget}, @var{prompt}, @var{value}, and
@@ -1499,11 +1618,12 @@ default'' in this text.
1499@node Widget Browser, Widget Minor Mode, Defining New Widgets, Top 1618@node Widget Browser, Widget Minor Mode, Defining New Widgets, Top
1500@comment node-name, next, previous, up 1619@comment node-name, next, previous, up
1501@section Widget Browser 1620@section Widget Browser
1621@cindex widget browser
1502 1622
1503There is a separate package to browse widgets. This is intended to help 1623There is a separate package to browse widgets. This is intended to help
1504programmers who want to examine the content of a widget. The browser 1624programmers who want to examine the content of a widget. The browser
1505shows the value of each keyword, but uses links for certain keywords 1625shows the value of each keyword, but uses links for certain keywords
1506such as `:parent', which avoids printing cyclic structures. 1626such as @samp{:parent}, which avoids printing cyclic structures.
1507 1627
1508@deffn Command widget-browse WIDGET 1628@deffn Command widget-browse WIDGET
1509Create a widget browser for WIDGET. 1629Create a widget browser for WIDGET.
@@ -1523,9 +1643,10 @@ When called interactively, use the position of point.
1523@node Widget Minor Mode, Utilities, Widget Browser, Top 1643@node Widget Minor Mode, Utilities, Widget Browser, Top
1524@comment node-name, next, previous, up 1644@comment node-name, next, previous, up
1525@section Widget Minor Mode 1645@section Widget Minor Mode
1646@cindex widget minor mode
1526 1647
1527There is a minor mode for manipulating widgets in major modes that 1648There is a minor mode for manipulating widgets in major modes that
1528doesn't provide any support for widgets themselves. This is mostly 1649don't provide any support for widgets themselves. This is mostly
1529intended to be useful for programmers doing experiments. 1650intended to be useful for programmers doing experiments.
1530 1651
1531@deffn Command widget-minor-mode 1652@deffn Command widget-minor-mode
@@ -1540,6 +1661,7 @@ Keymap used in @code{widget-minor-mode}.
1540@node Utilities, Widget Wishlist, Widget Minor Mode, Top 1661@node Utilities, Widget Wishlist, Widget Minor Mode, Top
1541@comment node-name, next, previous, up 1662@comment node-name, next, previous, up
1542@section Utilities. 1663@section Utilities.
1664@cindex utility functions for widgets
1543 1665
1544@defun widget-prompt-value widget prompt [ value unbound ] 1666@defun widget-prompt-value widget prompt [ value unbound ]
1545Prompt for a value matching @var{widget}, using @var{prompt}. 1667Prompt for a value matching @var{widget}, using @var{prompt}.
@@ -1548,13 +1670,14 @@ non-nil.@refill
1548@end defun 1670@end defun
1549 1671
1550@defun widget-get-sibling widget 1672@defun widget-get-sibling widget
1551Get the item @var{widget} is assumed to toggle. 1673Get the item which @var{widget} is assumed to toggle.
1552This is only meaningful for radio buttons or checkboxes in a list. 1674This is only meaningful for radio buttons or checkboxes in a list.
1553@end defun 1675@end defun
1554 1676
1555@node Widget Wishlist, , Utilities, Top 1677@node Widget Wishlist, Index, Utilities, Top
1556@comment node-name, next, previous, up 1678@comment node-name, next, previous, up
1557@section Wishlist 1679@section Wishlist
1680@cindex todo
1558 1681
1559@itemize @bullet 1682@itemize @bullet
1560@item 1683@item
@@ -1563,7 +1686,7 @@ and @kbd{C-o} (suggested by @sc{rms}).
1563 1686
1564@item 1687@item
1565The @samp{[INS]} and @samp{[DEL]} buttons should be replaced by a single 1688The @samp{[INS]} and @samp{[DEL]} buttons should be replaced by a single
1566dash (@samp{-}). The dash should be a button that, when invoked, ask 1689dash (@samp{-}). The dash should be a button that, when invoked, asks
1567whether you want to add or delete an item (@sc{rms} wanted to git rid of 1690whether you want to add or delete an item (@sc{rms} wanted to git rid of
1568the ugly buttons, the dash is my idea). 1691the ugly buttons, the dash is my idea).
1569 1692
@@ -1607,10 +1730,17 @@ See @code{TeX-printer-list} for an explanation.
1607@kbd{C-h} in @code{widget-prompt-value} should give type specific help. 1730@kbd{C-h} in @code{widget-prompt-value} should give type specific help.
1608 1731
1609@item 1732@item
1610A mailto widget. 1733Add a @code{mailto} widget.
1611
1612@end itemize 1734@end itemize
1613 1735
1736@node Index, , Widget Wishlist, Top
1737@comment node-name, next, previous, up
1738@unnumbered Index
1739
1740This is an alphabetical listing of all concepts, functions, commands,
1741variables, and widgets described in this manual.
1742@printindex cp
1743
1614@setchapternewpage odd 1744@setchapternewpage odd
1615@contents 1745@contents
1616@bye 1746@bye