comparison man/widget.texi @ 25829:ac7e9e5e2ccb

#
author Dave Love <fx@gnu.org>
date Wed, 29 Sep 1999 15:17:24 +0000
parents
children c1bde47f6b18
comparison
equal deleted inserted replaced
25828:55e4513821f8 25829:ac7e9e5e2ccb
1 \input texinfo.tex
2
3 @c %**start of header
4 @setfilename ../info/widget
5 @settitle The Emacs Widget Library
6 @iftex
7 @afourpaper
8 @headings double
9 @end iftex
10 @c %**end of header
11
12 @dircategory Editors
13 @direntry
14 * Widget: (widget). Documenting the "widget" package used by the
15 Emacs Custom facility.
16 @end direntry
17
18 @node Top, Introduction, (dir), (dir)
19 @comment node-name, next, previous, up
20 @top The Emacs Widget Library
21
22 Version: 1.9914
23
24 @menu
25 * Introduction::
26 * User Interface::
27 * Programming Example::
28 * Setting Up the Buffer::
29 * Basic Types::
30 * Sexp Types::
31 * Widget Properties::
32 * Defining New Widgets::
33 * Widget Browser::
34 * Widget Minor Mode::
35 * Utilities::
36 * Widget Wishlist::
37 @end menu
38
39 @node Introduction, User Interface, Top, Top
40 @comment node-name, next, previous, up
41 @section Introduction
42
43 Most graphical user interface toolkits, such as Motif and XView, provide
44 a number of standard user interface controls (sometimes known as
45 `widgets' or `gadgets'). Emacs doesn't really support anything like
46 this, except for an incredible powerful text ``widget''. On the other
47 hand, Emacs does provide the necessary primitives to implement many
48 other widgets within a text buffer. The @code{widget} package
49 simplifies this task.
50
51 The basic widgets are:
52
53 @table @code
54 @item link
55 Areas of text with an associated action. Intended for hypertext links
56 embedded in text.
57 @item push-button
58 Like link, but intended for stand-alone buttons.
59 @item editable-field
60 An editable text field. It can be either variable or fixed length.
61 @item menu-choice
62 Allows the user to choose one of multiple options from a menu, each
63 option is itself a widget. Only the selected option will be visible in
64 the buffer.
65 @item radio-button-choice
66 Allows the user to choose one of multiple options by activating radio
67 buttons. The options are implemented as widgets. All options will be
68 visible in the buffer.
69 @item item
70 A simple constant widget intended to be used in the @code{menu-choice} and
71 @code{radio-button-choice} widgets.
72 @item choice-item
73 An button item only intended for use in choices. When invoked, the user
74 will be asked to select another option from the choice widget.
75 @item toggle
76 A simple @samp{on}/@samp{off} switch.
77 @item checkbox
78 A checkbox (@samp{[ ]}/@samp{[X]}).
79 @item editable-list
80 Create an editable list. The user can insert or delete items in the
81 list. Each list item is itself a widget.
82 @end table
83
84 Now of what possible use can support for widgets be in a text editor?
85 I'm glad you asked. The answer is that widgets are useful for
86 implementing forms. A @dfn{form} in Emacs is a buffer where the user is
87 supposed to fill out a number of fields, each of which has a specific
88 meaning. The user is not supposed to change or delete any of the text
89 between the fields. Examples of forms in Emacs are the @file{forms}
90 package (of course), the customize buffers, the mail and news compose
91 modes, and the @sc{html} form support in the @file{w3} browser.
92
93 The advantages for a programmer of using the @code{widget} package to
94 implement forms are:
95
96 @enumerate
97 @item
98 More complex field than just editable text are supported.
99 @item
100 You can give the user immediate feedback if he enters invalid data in a
101 text field, and sometimes prevent entering invalid data.
102 @item
103 You can have fixed sized fields, thus allowing multiple field to be
104 lined up in columns.
105 @item
106 It is simple to query or set the value of a field.
107 @item
108 Editing happens in buffer, not in the mini-buffer.
109 @item
110 Packages using the library get a uniform look, making them easier for
111 the user to learn.
112 @item
113 As support for embedded graphics improve, the widget library will
114 extended to support it. This means that your code using the widget
115 library will also use the new graphic features by automatic.
116 @end enumerate
117
118 In order to minimize the code that is loaded by users who does not
119 create any widgets, the code has been split in two files:
120
121 @table @file
122 @item widget.el
123 This will declare the user variables, define the function
124 @code{widget-define}, and autoload the function @code{widget-create}.
125 @item wid-edit.el
126 Everything else is here, there is no reason to load it explicitly, as
127 it will be autoloaded when needed.
128 @end table
129
130 @node User Interface, Programming Example, Introduction, Top
131 @comment node-name, next, previous, up
132 @section User Interface
133
134 A form consist of read only text for documentation and some fields,
135 where each the fields contain two parts, as tag and a value. The tags
136 are used to identify the fields, so the documentation can refer to the
137 foo field, meaning the field tagged with @samp{Foo}. Here is an example
138 form:
139
140 @example
141 Here is some documentation.
142
143 Name: @i{My Name} @strong{Choose}: This option
144 Address: @i{Some Place
145 In some City
146 Some country.}
147
148 See also @b{_other work_} for more information.
149
150 Numbers: count to three below
151 @b{[INS]} @b{[DEL]} @i{One}
152 @b{[INS]} @b{[DEL]} @i{Eh, two?}
153 @b{[INS]} @b{[DEL]} @i{Five!}
154 @b{[INS]}
155
156 Select multiple:
157
158 @b{[X]} This
159 @b{[ ]} That
160 @b{[X]} Thus
161
162 Select one:
163
164 @b{(*)} One
165 @b{( )} Another One.
166 @b{( )} A Final One.
167
168 @b{[Apply Form]} @b{[Reset Form]}
169 @end example
170
171 The top level widgets in is example are tagged @samp{Name},
172 @samp{Choose}, @samp{Address}, @samp{_other work_}, @samp{Numbers},
173 @samp{Select multiple}, @samp{Select one}, @samp{[Apply Form]}, and
174 @samp{[Reset Form]}. There are basically two thing the user can do within
175 a form, namely editing the editable text fields and activating the
176 buttons.
177
178 @subsection Editable Text Fields
179
180 In the example, the value for the @samp{Name} is most likely displayed
181 in an editable text field, and so are values for each of the members of
182 the @samp{Numbers} list. All the normal Emacs editing operations are
183 available for editing these fields. The only restriction is that each
184 change you make must be contained within a single editable text field.
185 For example, capitalizing all text from the middle of one field to the
186 middle of another field is prohibited.
187
188 Editing text fields are created by the @code{editable-field} widget.
189
190 The editing text fields are highlighted with the
191 @code{widget-field-face} face, making them easy to find.
192
193 @deffn Face widget-field-face
194 Face used for other editing fields.
195 @end deffn
196
197 @subsection Buttons
198
199 Some portions of the buffer have an associated @dfn{action}, which can
200 be @dfn{invoked} by a standard key or mouse command. These portions
201 are called @dfn{buttons}. The default commands for activating a button
202 are:
203
204 @table @kbd
205 @item @key{RET}
206 @deffn Command widget-button-press @var{pos} &optional @var{event}
207 Invoke the button at @var{pos}, defaulting to point.
208 If point is not located on a button, invoke the binding in
209 @code{widget-global-map} (by default the global map).
210 @end deffn
211
212 @item mouse-2
213 @deffn Command widget-button-click @var{event}
214 Invoke the button at the location of the mouse pointer. If the mouse
215 pointer is located in an editable text field, invoke the binding in
216 @code{widget-global-map} (by default the global map).
217 @end deffn
218 @end table
219
220 There are several different kind of buttons, all of which are present in
221 the example:
222
223 @table @emph
224 @item The Option Field Tags.
225 When you invoke one of these buttons, you will be asked to choose
226 between a number of different options. This is how you edit an option
227 field. Option fields are created by the @code{menu-choice} widget. In
228 the example, @samp{@b{Choose}} is an option field tag.
229 @item The @samp{@b{[INS]}} and @samp{@b{[DEL]}} buttons.
230 Activating these will insert or delete elements from a editable list.
231 The list is created by the @code{editable-list} widget.
232 @item Embedded Buttons.
233 The @samp{@b{_other work_}} is an example of an embedded
234 button. Embedded buttons are not associated with a fields, but can serve
235 any purpose, such as implementing hypertext references. They are
236 usually created by the @code{link} widget.
237 @item The @samp{@b{[ ]}} and @samp{@b{[X]}} buttons.
238 Activating one of these will convert it to the other. This is useful
239 for implementing multiple-choice fields. You can create it wit
240 @item The @samp{@b{( )}} and @samp{@b{(*)}} buttons.
241 Only one radio button in a @code{radio-button-choice} widget can be
242 selected at any time. When you invoke one of the unselected radio
243 buttons, it will be selected and the previous selected radio button will
244 become unselected.
245 @item The @samp{@b{[Apply Form]}} @samp{@b{[Reset Form]}} buttons.
246 These are explicit buttons made with the @code{push-button} widget. The main
247 difference from the @code{link} widget is that the buttons are will be
248 displayed as GUI buttons when possible.
249 enough.
250 @end table
251
252 To make them easier to locate, buttons are emphasized in the buffer.
253
254 @deffn Face widget-button-face
255 Face used for buttons.
256 @end deffn
257
258 @defopt widget-mouse-face
259 Face used for buttons when the mouse pointer is above it.
260 @end defopt
261
262 @subsection Navigation
263
264 You can use all the normal Emacs commands to move around in a form
265 buffer, plus you will have these additional commands:
266
267 @table @kbd
268 @item @key{TAB}
269 @deffn Command widget-forward &optional count
270 Move point @var{count} buttons or editing fields forward.
271 @end deffn
272 @item @key{M-TAB}
273 @deffn Command widget-backward &optional count
274 Move point @var{count} buttons or editing fields backward.
275 @end deffn
276 @end table
277
278 @node Programming Example, Setting Up the Buffer, User Interface, Top
279 @comment node-name, next, previous, up
280 @section Programming Example
281
282 Here is the code to implement the user interface example (@pxref{User
283 Interface}).
284
285 @lisp
286 (require 'widget)
287
288 (eval-when-compile
289 (require 'wid-edit))
290
291 (defvar widget-example-repeat)
292
293 (defun widget-example ()
294 "Create the widgets from the Widget manual."
295 (interactive)
296 (switch-to-buffer "*Widget Example*")
297 (kill-all-local-variables)
298 (make-local-variable 'widget-example-repeat)
299 (let ((inhibit-read-only t))
300 (erase-buffer))
301 (widget-insert "Here is some documentation.\n\nName: ")
302 (widget-create 'editable-field
303 :size 13
304 "My Name")
305 (widget-create 'menu-choice
306 :tag "Choose"
307 :value "This"
308 :help-echo "Choose me, please!"
309 :notify (lambda (widget &rest ignore)
310 (message "%s is a good choice!"
311 (widget-value widget)))
312 '(item :tag "This option" :value "This")
313 '(choice-item "That option")
314 '(editable-field :menu-tag "No option" "Thus option"))
315 (widget-insert "Address: ")
316 (widget-create 'editable-field
317 "Some Place\nIn some City\nSome country.")
318 (widget-insert "\nSee also ")
319 (widget-create 'link
320 :notify (lambda (&rest ignore)
321 (widget-value-set widget-example-repeat
322 '("En" "To" "Tre"))
323 (widget-setup))
324 "other work")
325 (widget-insert " for more information.\n\nNumbers: count to three below\n")
326 (setq widget-example-repeat
327 (widget-create 'editable-list
328 :entry-format "%i %d %v"
329 :notify (lambda (widget &rest ignore)
330 (let ((old (widget-get widget
331 ':example-length))
332 (new (length (widget-value widget))))
333 (unless (eq old new)
334 (widget-put widget ':example-length new)
335 (message "You can count to %d." new))))
336 :value '("One" "Eh, two?" "Five!")
337 '(editable-field :value "three")))
338 (widget-insert "\n\nSelect multiple:\n\n")
339 (widget-create 'checkbox t)
340 (widget-insert " This\n")
341 (widget-create 'checkbox nil)
342 (widget-insert " That\n")
343 (widget-create 'checkbox
344 :notify (lambda (&rest ignore) (message "Tickle"))
345 t)
346 (widget-insert " Thus\n\nSelect one:\n\n")
347 (widget-create 'radio-button-choice
348 :value "One"
349 :notify (lambda (widget &rest ignore)
350 (message "You selected %s"
351 (widget-value widget)))
352 '(item "One") '(item "Another One.") '(item "A Final One."))
353 (widget-insert "\n")
354 (widget-create 'push-button
355 :notify (lambda (&rest ignore)
356 (if (= (length (widget-value widget-example-repeat))
357 3)
358 (message "Congratulation!")
359 (error "Three was the count!")))
360 "Apply Form")
361 (widget-insert " ")
362 (widget-create 'push-button
363 :notify (lambda (&rest ignore)
364 (widget-example))
365 "Reset Form")
366 (widget-insert "\n")
367 (use-local-map widget-keymap)
368 (widget-setup))
369 @end lisp
370
371 @node Setting Up the Buffer, Basic Types, Programming Example, Top
372 @comment node-name, next, previous, up
373 @section Setting Up the Buffer
374
375 Widgets are created with @code{widget-create}, which returns a
376 @dfn{widget} object. This object can be queried and manipulated by
377 other widget functions, until it is deleted with @code{widget-delete}.
378 After the widgets have been created, @code{widget-setup} must be called
379 to enable them.
380
381 @defun widget-create type [ keyword argument ]@dots{}
382 Create and return a widget of type @var{type}.
383 The syntax for the @var{type} argument is described in @ref{Basic Types}.
384
385 The keyword arguments can be used to overwrite the keyword arguments
386 that are part of @var{type}.
387 @end defun
388
389 @defun widget-delete widget
390 Delete @var{widget} and remove it from the buffer.
391 @end defun
392
393 @defun widget-setup
394 Setup a buffer to support widgets.
395
396 This should be called after creating all the widgets and before allowing
397 the user to edit them.
398 @refill
399 @end defun
400
401 If you want to insert text outside the widgets in the form, the
402 recommended way to do that is with @code{widget-insert}.
403
404 @defun widget-insert
405 Insert the arguments, either strings or characters, at point.
406 The inserted text will be read only.
407 @end defun
408
409 There is a standard widget keymap which you might find useful.
410
411 @defvr Const widget-keymap
412 A keymap with the global keymap as its parent.@*
413 @key{TAB} and @kbd{C-@key{TAB}} are bound to @code{widget-forward} and
414 @code{widget-backward}, respectively. @kbd{@key{RET}} and @kbd{mouse-2}
415 are bound to @code{widget-button-press} and
416 @code{widget-button-}.@refill
417 @end defvr
418
419 @defvar widget-global-map
420 Keymap used by @code{widget-button-press} and @code{widget-button-click}
421 when not on a button. By default this is @code{global-map}.
422 @end defvar
423
424 @node Basic Types, Sexp Types, Setting Up the Buffer, Top
425 @comment node-name, next, previous, up
426 @section Basic Types
427
428 The syntax of a type specification is given below:
429
430 @example
431 NAME ::= (NAME [KEYWORD ARGUMENT]... ARGS)
432 | NAME
433 @end example
434
435 Where, @var{name} is a widget name, @var{keyword} is the name of a
436 property, @var{argument} is the value of the property, and @var{args}
437 are interpreted in a widget specific way.
438
439 There following keyword arguments that apply to all widgets:
440
441 @table @code
442 @item :value
443 The initial value for widgets of this type.
444
445 @item :format
446 This string will be inserted in the buffer when you create a widget.
447 The following @samp{%} escapes are available:
448
449 @table @samp
450 @item %[
451 @itemx %]
452 The text inside will be marked as a button.
453
454 By default, the text will be shown in @code{widget-button-face}, and
455 surrounded by brackets.
456
457 @defopt widget-button-prefix
458 String to prefix buttons.
459 @end defopt
460
461 @defopt widget-button-suffix
462 String to suffix buttons.
463 @end defopt
464
465 @item %@{
466 @itemx %@}
467 The text inside will be displayed with the face specified by
468 @code{:sample-face}.
469
470 @item %v
471 This will be replaces with the buffer representation of the widgets
472 value. What this is depends on the widget type.
473
474 @item %d
475 Insert the string specified by @code{:doc} here.
476
477 @item %h
478 Like @samp{%d}, with the following modifications: If the documentation
479 string is more than one line, it will add a button which will toggle
480 between showing only the first line, and showing the full text.
481 Furthermore, if there is no @code{:doc} property in the widget, it will
482 instead examine the @code{:documentation-property} property. If it is a
483 lambda expression, it will be called with the widget's value as an
484 argument, and the result will be used as the documentation text.
485
486 @item %t
487 Insert the string specified by @code{:tag} here, or the @code{princ}
488 representation of the value if there is no tag.
489
490 @item %%
491 Insert a literal @samp{%}.
492 @end table
493
494 @item :button-face
495 Face used to highlight text inside %[ %] in the format.
496
497 @item :button-prefix
498 @itemx :button-suffix
499
500 Text around %[ %] in the format.
501
502 These can be
503 @table @emph
504 @item nil
505 No text is inserted.
506
507 @item a string
508 The string is inserted literally.
509
510 @item a symbol
511 The value of the symbol is expanded according to this table.
512 @end table
513
514 @item :doc
515 The string inserted by the @samp{%d} escape in the format
516 string.
517
518 @item :tag
519 The string inserted by the @samp{%t} escape in the format
520 string.
521
522 @item :tag-glyph
523 Name of image to use instead of the string specified by `:tag' on
524 Emacsen that supports it.
525
526 @item :help-echo
527 Message displayed whenever you move to the widget with either
528 @code{widget-forward} or @code{widget-backward}.
529
530 @item :indent
531 An integer indicating the absolute number of spaces to indent children
532 of this widget.
533
534 @item :offset
535 An integer indicating how many extra spaces to add to the widget's
536 grandchildren compared to this widget.
537
538 @item :extra-offset
539 An integer indicating how many extra spaces to add to the widget's
540 children compared to this widget.
541
542 @item :notify
543 A function called each time the widget or a nested widget is changed.
544 The function is called with two or three arguments. The first argument
545 is the widget itself, the second argument is the widget that was
546 changed, and the third argument is the event leading to the change, if
547 any.
548
549 @item :menu-tag
550 Tag used in the menu when the widget is used as an option in a
551 @code{menu-choice} widget.
552
553 @item :menu-tag-get
554 Function used for finding the tag when the widget is used as an option
555 in a @code{menu-choice} widget. By default, the tag used will be either the
556 @code{:menu-tag} or @code{:tag} property if present, or the @code{princ}
557 representation of the @code{:value} property if not.
558
559 @item :match
560 Should be a function called with two arguments, the widget and a value,
561 and returning non-nil if the widget can represent the specified value.
562
563 @item :validate
564 A function which takes a widget as an argument, and return nil if the
565 widgets current value is valid for the widget. Otherwise, it should
566 return the widget containing the invalid data, and set that widgets
567 @code{:error} property to a string explaining the error.
568
569 The following predefined function can be used:
570
571 @defun widget-children-validate widget
572 All the @code{:children} of @var{widget} must be valid.
573 @end defun
574
575 @item :tab-order
576 Specify the order in which widgets are traversed with
577 @code{widget-forward} or @code{widget-backward}. This is only partially
578 implemented.
579
580 @enumerate a
581 @item
582 Widgets with tabbing order @code{-1} are ignored.
583
584 @item
585 (Unimplemented) When on a widget with tabbing order @var{n}, go to the
586 next widget in the buffer with tabbing order @var{n+1} or @code{nil},
587 whichever comes first.
588
589 @item
590 When on a widget with no tabbing order specified, go to the next widget
591 in the buffer with a positive tabbing order, or @code{nil}
592 @end enumerate
593
594 @item :parent
595 The parent of a nested widget (e.g. a @code{menu-choice} item or an
596 element of a @code{editable-list} widget).
597
598 @item :sibling-args
599 This keyword is only used for members of a @code{radio-button-choice} or
600 @code{checklist}. The value should be a list of extra keyword
601 arguments, which will be used when creating the @code{radio-button} or
602 @code{checkbox} associated with this item.
603
604 @end table
605
606 @deffn {User Option} widget-glyph-directory
607 Directory where glyphs are found.
608 Widget will look here for a file with the same name as specified for the
609 image, with either a @samp{.xpm} (if supported) or @samp{.xbm} extension.
610 @end deffn
611
612 @deffn{User Option} widget-glyph-enable
613 If non-nil, allow glyphs to appear on displays where they are supported.
614 @end deffn
615
616
617 @menu
618 * link::
619 * url-link::
620 * info-link::
621 * push-button::
622 * editable-field::
623 * text::
624 * menu-choice::
625 * radio-button-choice::
626 * item::
627 * choice-item::
628 * toggle::
629 * checkbox::
630 * checklist::
631 * editable-list::
632 * group::
633 @end menu
634
635 @node link, url-link, Basic Types, Basic Types
636 @comment node-name, next, previous, up
637 @subsection The @code{link} Widget
638
639 Syntax:
640
641 @example
642 TYPE ::= (link [KEYWORD ARGUMENT]... [ VALUE ])
643 @end example
644
645 The @var{value}, if present, is used to initialize the @code{:value}
646 property. The value should be a string, which will be inserted in the
647 buffer.
648
649 By default the link will be shown in brackets.
650
651 @defopt widget-link-prefix
652 String to prefix links.
653 @end defopt
654
655 @defopt widget-link-suffix
656 String to suffix links.
657 @end defopt
658
659 @node url-link, info-link, link, Basic Types
660 @comment node-name, next, previous, up
661 @subsection The @code{url-link} Widget
662
663 Syntax:
664
665 @example
666 TYPE ::= (url-link [KEYWORD ARGUMENT]... URL)
667 @end example
668
669 When this link is invoked, the @sc{www} browser specified by
670 @code{browse-url-browser-function} will be called with @var{url}.
671
672 @node info-link, push-button, url-link, Basic Types
673 @comment node-name, next, previous, up
674 @subsection The @code{info-link} Widget
675
676 Syntax:
677
678 @example
679 TYPE ::= (info-link [KEYWORD ARGUMENT]... ADDRESS)
680 @end example
681
682 When this link is invoked, the build-in info browser is started on
683 @var{address}.
684
685 @node push-button, editable-field, info-link, Basic Types
686 @comment node-name, next, previous, up
687 @subsection The @code{push-button} Widget
688
689 Syntax:
690
691 @example
692 TYPE ::= (push-button [KEYWORD ARGUMENT]... [ VALUE ])
693 @end example
694
695 The @var{value}, if present, is used to initialize the @code{:value}
696 property. The value should be a string, which will be inserted in the
697 buffer.
698
699 By default the tag will be shown in brackets.
700
701 @defopt widget-push-button-prefix
702 String to prefix push buttons.
703 @end defopt
704
705 @defopt widget-push-button-suffix
706 String to suffix push buttons.
707 @end defopt
708
709 @node editable-field, text, push-button, Basic Types
710 @comment node-name, next, previous, up
711 @subsection The @code{editable-field} Widget
712
713 Syntax:
714
715 @example
716 TYPE ::= (editable-field [KEYWORD ARGUMENT]... [ VALUE ])
717 @end example
718
719 The @var{value}, if present, is used to initialize the @code{:value}
720 property. The value should be a string, which will be inserted in
721 field. This widget will match all string values.
722
723 The following extra properties are recognized.
724
725 @table @code
726 @item :size
727 The width of the editable field.@*
728 By default the field will reach to the end of the line.
729
730 @item :value-face
731 Face used for highlighting the editable field. Default is
732 @code{widget-field-face}.
733
734 @item :secret
735 Character used to display the value. You can set this to e.g. @code{?*}
736 if the field contains a password or other secret information. By
737 default, the value is not secret.
738
739 @item :valid-regexp
740 By default the @code{:validate} function will match the content of the
741 field with the value of this attribute. The default value is @code{""}
742 which matches everything.
743
744 @item :keymap
745 Keymap used in the editable field. The default value is
746 @code{widget-field-keymap}, which allows you to use all the normal
747 editing commands, even if the buffers major mode suppress some of them.
748 Pressing return invokes the function specified by @code{:action}.
749 @end table
750
751 @node text, menu-choice, editable-field, Basic Types
752 @comment node-name, next, previous, up
753 @subsection The @code{text} Widget
754
755 This is just like @code{editable-field}, but intended for multiline text
756 fields. The default @code{:keymap} is @code{widget-text-keymap}, which
757 does not rebind the return key.
758
759 @node menu-choice, radio-button-choice, text, Basic Types
760 @comment node-name, next, previous, up
761 @subsection The @code{menu-choice} Widget
762
763 Syntax:
764
765 @example
766 TYPE ::= (menu-choice [KEYWORD ARGUMENT]... TYPE ... )
767 @end example
768
769 The @var{type} arguments represents each possible choice. The widgets
770 value of will be the value of the chosen @var{type} argument. This
771 widget will match any value that matches at least one of the specified
772 @var{type} arguments.
773
774 @table @code
775 @item :void
776 Widget type used as a fallback when the value does not match any of the
777 specified @var{type} arguments.
778
779 @item :case-fold
780 Set this to nil if you don't want to ignore case when prompting for a
781 choice through the minibuffer.
782
783 @item :children
784 A list whose car is the widget representing the currently chosen type in
785 the buffer.
786
787 @item :choice
788 The current chosen type
789
790 @item :args
791 The list of types.
792 @end table
793
794 @node radio-button-choice, item, menu-choice, Basic Types
795 @comment node-name, next, previous, up
796 @subsection The @code{radio-button-choice} Widget
797
798 Syntax:
799
800 @example
801 TYPE ::= (radio-button-choice [KEYWORD ARGUMENT]... TYPE ... )
802 @end example
803
804 The @var{type} arguments represents each possible choice. The widgets
805 value of will be the value of the chosen @var{type} argument. This
806 widget will match any value that matches at least one of the specified
807 @var{type} arguments.
808
809 The following extra properties are recognized.
810
811 @table @code
812 @item :entry-format
813 This string will be inserted for each entry in the list.
814 The following @samp{%} escapes are available:
815 @table @samp
816 @item %v
817 Replaced with the buffer representation of the @var{type} widget.
818 @item %b
819 Replace with the radio button.
820 @item %%
821 Insert a literal @samp{%}.
822 @end table
823
824 @item button-args
825 A list of keywords to pass to the radio buttons. Useful for setting
826 e.g. the @samp{:help-echo} for each button.
827
828 @item :buttons
829 The widgets representing the radio buttons.
830
831 @item :children
832 The widgets representing each type.
833
834 @item :choice
835 The current chosen type
836
837 @item :args
838 The list of types.
839 @end table
840
841 You can add extra radio button items to a @code{radio-button-choice}
842 widget after it has been created with the function
843 @code{widget-radio-add-item}.
844
845 @defun widget-radio-add-item widget type
846 Add to @code{radio-button-choice} widget @var{widget} a new radio button item of type
847 @var{type}.
848 @end defun
849
850 Please note that such items added after the @code{radio-button-choice}
851 widget has been created will @strong{not} be properly destructed when
852 you call @code{widget-delete}.
853
854 @node item, choice-item, radio-button-choice, Basic Types
855 @comment node-name, next, previous, up
856 @subsection The @code{item} Widget
857
858 Syntax:
859
860 @example
861 ITEM ::= (item [KEYWORD ARGUMENT]... VALUE)
862 @end example
863
864 The @var{value}, if present, is used to initialize the @code{:value}
865 property. The value should be a string, which will be inserted in the
866 buffer. This widget will only match the specified value.
867
868 @node choice-item, toggle, item, Basic Types
869 @comment node-name, next, previous, up
870 @subsection The @code{choice-item} Widget
871
872 Syntax:
873
874 @example
875 ITEM ::= (choice-item [KEYWORD ARGUMENT]... VALUE)
876 @end example
877
878 The @var{value}, if present, is used to initialize the @code{:value}
879 property. The value should be a string, which will be inserted in the
880 buffer as a button. Activating the button of a @code{choice-item} is
881 equivalent to activating the parent widget. This widget will only match
882 the specified value.
883
884 @node toggle, checkbox, choice-item, Basic Types
885 @comment node-name, next, previous, up
886 @subsection The @code{toggle} Widget
887
888 Syntax:
889
890 @example
891 TYPE ::= (toggle [KEYWORD ARGUMENT]...)
892 @end example
893
894 The widget has two possible states, `on' and `off', which corresponds to
895 a @code{t} or @code{nil} value.
896
897 The following extra properties are recognized.
898
899 @table @code
900 @item :on
901 String representing the `on' state. By default the string @samp{on}.
902 @item :off
903 String representing the `off' state. By default the string @samp{off}.
904 @item :on-glyph
905 Name of a glyph to be used instead of the `:on' text string, on emacsen
906 that supports it.
907 @item :off-glyph
908 Name of a glyph to be used instead of the `:off' text string, on emacsen
909 that supports it.
910 @end table
911
912 @node checkbox, checklist, toggle, Basic Types
913 @comment node-name, next, previous, up
914 @subsection The @code{checkbox} Widget
915
916 The widget has two possible states, `selected' and `unselected', which
917 corresponds to a @code{t} or @code{nil} value.
918
919 Syntax:
920
921 @example
922 TYPE ::= (checkbox [KEYWORD ARGUMENT]...)
923 @end example
924
925 @node checklist, editable-list, checkbox, Basic Types
926 @comment node-name, next, previous, up
927 @subsection The @code{checklist} Widget
928
929 Syntax:
930
931 @example
932 TYPE ::= (checklist [KEYWORD ARGUMENT]... TYPE ... )
933 @end example
934
935 The @var{type} arguments represents each checklist item. The widgets
936 value of will be a list containing the value of each ticked @var{type}
937 argument. The checklist widget will match a list whose elements all
938 matches at least one of the specified @var{type} arguments.
939
940 The following extra properties are recognized.
941
942 @table @code
943 @item :entry-format
944 This string will be inserted for each entry in the list.
945 The following @samp{%} escapes are available:
946 @table @samp
947 @item %v
948 Replaced with the buffer representation of the @var{type} widget.
949 @item %b
950 Replace with the checkbox.
951 @item %%
952 Insert a literal @samp{%}.
953 @end table
954
955 @item :greedy
956 Usually, a checklist will only match if the items are in the exact
957 sequence given in the specification. By setting @code{:greedy} to
958 non-nil, it will allow the items to come in any sequence. However, if
959 you extract the value they will be in the sequence given in the
960 checklist. I.e. the original sequence is forgotten.
961
962 @item button-args
963 A list of keywords to pass to the checkboxes. Useful for setting
964 e.g. the @samp{:help-echo} for each checkbox.
965
966 @item :buttons
967 The widgets representing the checkboxes.
968
969 @item :children
970 The widgets representing each type.
971
972 @item :args
973 The list of types.
974 @end table
975
976 @node editable-list, group, checklist, Basic Types
977 @comment node-name, next, previous, up
978 @subsection The @code{editable-list} Widget
979
980 Syntax:
981
982 @example
983 TYPE ::= (editable-list [KEYWORD ARGUMENT]... TYPE)
984 @end example
985
986 The value is a list, where each member represents one widget of type
987 @var{type}.
988
989 The following extra properties are recognized.
990
991 @table @code
992 @item :entry-format
993 This string will be inserted for each entry in the list.
994 The following @samp{%} escapes are available:
995 @table @samp
996 @item %v
997 This will be replaced with the buffer representation of the @var{type}
998 widget.
999 @item %i
1000 Insert the @b{[INS]} button.
1001 @item %d
1002 Insert the @b{[DEL]} button.
1003 @item %%
1004 Insert a literal @samp{%}.
1005 @end table
1006
1007 @item :insert-button-args
1008 A list of keyword arguments to pass to the insert buttons.
1009
1010 @item :delete-button-args
1011 A list of keyword arguments to pass to the delete buttons.
1012
1013 @item :append-button-args
1014 A list of keyword arguments to pass to the trailing insert button.
1015
1016
1017 @item :buttons
1018 The widgets representing the insert and delete buttons.
1019
1020 @item :children
1021 The widgets representing the elements of the list.
1022
1023 @item :args
1024 List whose car is the type of the list elements.
1025
1026 @end table
1027
1028 @node group, , editable-list, Basic Types
1029 @comment node-name, next, previous, up
1030 @subsection The @code{group} Widget
1031
1032 This widget simply group other widget together.
1033
1034 Syntax:
1035
1036 @example
1037 TYPE ::= (group [KEYWORD ARGUMENT]... TYPE...)
1038 @end example
1039
1040 The value is a list, with one member for each @var{type}.
1041
1042 @node Sexp Types, Widget Properties, Basic Types, Top
1043 @comment
1044 @section Sexp Types
1045
1046 A number of widgets for editing s-expressions (lisp types) are also
1047 available. These basically fall in the following categories.
1048
1049 @menu
1050 * constants::
1051 * generic::
1052 * atoms::
1053 * composite::
1054 @end menu
1055
1056 @node constants, generic, Sexp Types, Sexp Types
1057 @comment node-name, next, previous, up
1058 @subsection The Constant Widgets.
1059
1060 The @code{const} widget can contain any lisp expression, but the user is
1061 prohibited from editing edit it, which is mainly useful as a component
1062 of one of the composite widgets.
1063
1064 The syntax for the @code{const} widget is
1065
1066 @example
1067 TYPE ::= (const [KEYWORD ARGUMENT]... [ VALUE ])
1068 @end example
1069
1070 The @var{value}, if present, is used to initialize the @code{:value}
1071 property and can be any s-expression.
1072
1073 @deffn Widget const
1074 This will display any valid s-expression in an immutable part of the
1075 buffer.
1076 @end deffn
1077
1078 There are two variations of the @code{const} widget, namely
1079 @code{variable-item} and @code{function-item}. These should contain a
1080 symbol with a variable or function binding. The major difference from
1081 the @code{const} widget is that they will allow the user to see the
1082 variable or function documentation for the symbol.
1083
1084 @deffn Widget variable-item
1085 An immutable symbol that is bound as a variable.
1086 @end deffn
1087
1088 @deffn Widget function-item
1089 An immutable symbol that is bound as a function.
1090 @end deffn
1091
1092 @node generic, atoms, constants, Sexp Types
1093 @comment node-name, next, previous, up
1094 @subsection Generic Sexp Widget.
1095
1096 The @code{sexp} widget can contain any lisp expression, and allows the
1097 user to edit it inline in the buffer.
1098
1099 The syntax for the @code{sexp} widget is
1100
1101 @example
1102 TYPE ::= (sexp [KEYWORD ARGUMENT]... [ VALUE ])
1103 @end example
1104
1105 @deffn Widget sexp
1106 This will allow you to edit any valid s-expression in an editable buffer
1107 field.
1108
1109 The @code{sexp} widget takes the same keyword arguments as the
1110 @code{editable-field} widget.
1111 @end deffn
1112
1113 @node atoms, composite, generic, Sexp Types
1114 @comment node-name, next, previous, up
1115 @subsection Atomic Sexp Widgets.
1116
1117 The atoms are s-expressions that does not consist of other
1118 s-expressions. A string is an atom, while a list is a composite type.
1119 You can edit the value of an atom with the following widgets.
1120
1121 The syntax for all the atoms are
1122
1123 @example
1124 TYPE ::= (NAME [KEYWORD ARGUMENT]... [ VALUE ])
1125 @end example
1126
1127 The @var{value}, if present, is used to initialize the @code{:value}
1128 property and must be an expression of the same type as the widget.
1129 I.e. the string widget can only be initialized with a string.
1130
1131 All the atom widgets take the same keyword arguments as the
1132 @code{editable-field} widget.
1133
1134 @deffn Widget string
1135 Allows you to edit a string in an editable field.
1136 @end deffn
1137
1138 @deffn Widget regexp
1139 Allows you to edit a regular expression in an editable field.
1140 @end deffn
1141
1142 @deffn Widget character
1143 Allows you to enter a character in an editable field.
1144 @end deffn
1145
1146 @deffn Widget file
1147 Allows you to edit a file name in an editable field. If you invoke
1148 the tag button, you can edit the file name in the mini-buffer with
1149 completion.
1150
1151 Keywords:
1152 @table @code
1153 @item :must-match
1154 If this is set to non-nil, only existing file names will be allowed in
1155 the minibuffer.
1156 @end table
1157 @end deffn
1158
1159 @deffn Widget directory
1160 Allows you to edit a directory name in an editable field.
1161 Similar to the @code{file} widget.
1162 @end deffn
1163
1164 @deffn Widget symbol
1165 Allows you to edit a lisp symbol in an editable field.
1166 @end deffn
1167
1168 @deffn Widget function
1169 Allows you to edit a lambda expression, or a function name with completion.
1170 @end deffn
1171
1172 @deffn Widget variable
1173 Allows you to edit a variable name, with completion.
1174 @end deffn
1175
1176 @deffn Widget integer
1177 Allows you to edit an integer in an editable field.
1178 @end deffn
1179
1180 @deffn Widget number
1181 Allows you to edit a number in an editable field.
1182 @end deffn
1183
1184 @deffn Widget boolean
1185 Allows you to edit a boolean. In lisp this means a variable which is
1186 either nil meaning false, or non-nil meaning true.
1187 @end deffn
1188
1189
1190 @node composite, , atoms, Sexp Types
1191 @comment node-name, next, previous, up
1192 @subsection Composite Sexp Widgets.
1193
1194 The syntax for the composite are
1195
1196 @example
1197 TYPE ::= (NAME [KEYWORD ARGUMENT]... COMPONENT...)
1198 @end example
1199
1200 Where each @var{component} must be a widget type. Each component widget
1201 will be displayed in the buffer, and be editable to the user.
1202
1203 @deffn Widget cons
1204 The value of a @code{cons} widget is a cons-cell where the car is the
1205 value of the first component and the cdr is the value of the second
1206 component. There must be exactly two components.
1207 @end deffn
1208
1209 @deffn Widget list
1210 The value of a @code{list} widget is a list containing the value of
1211 each of its component.
1212 @end deffn
1213
1214 @deffn Widget vector
1215 The value of a @code{vector} widget is a vector containing the value of
1216 each of its component.
1217 @end deffn
1218
1219 The above suffice for specifying fixed size lists and vectors. To get
1220 variable length lists and vectors, you can use a @code{choice},
1221 @code{set} or @code{repeat} widgets together with the @code{:inline}
1222 keywords. If any component of a composite widget has the @code{:inline}
1223 keyword set, its value must be a list which will then be spliced into
1224 the composite. For example, to specify a list whose first element must
1225 be a file name, and whose remaining arguments should either by the
1226 symbol @code{t} or two files, you can use the following widget
1227 specification:
1228
1229 @example
1230 (list file
1231 (choice (const t)
1232 (list :inline t
1233 :value ("foo" "bar")
1234 string string)))
1235 @end example
1236
1237 The value of a widget of this type will either have the form
1238 @samp{(file t)} or @code{(file string string)}.
1239
1240 This concept of inline is probably hard to understand. It was certainly
1241 hard to implement so instead of confuse you more by trying to explain it
1242 here, I'll just suggest you meditate over it for a while.
1243
1244 @deffn Widget choice
1245 Allows you to edit a sexp which may have one of fixed set of types. It
1246 is currently implemented with the @code{choice-menu} basic widget, and
1247 has a similar syntax.
1248 @end deffn
1249
1250 @deffn Widget set
1251 Allows you to specify a type which must be a list whose elements all
1252 belong to given set. The elements of the list is not significant. This
1253 is implemented on top of the @code{checklist} basic widget, and has a
1254 similar syntax.
1255 @end deffn
1256
1257 @deffn Widget repeat
1258 Allows you to specify a variable length list whose members are all of
1259 the same type. Implemented on top of the `editable-list' basic widget,
1260 and has a similar syntax.
1261 @end deffn
1262
1263 @node Widget Properties, Defining New Widgets, Sexp Types, Top
1264 @comment node-name, next, previous, up
1265 @section Properties
1266
1267 You can examine or set the value of a widget by using the widget object
1268 that was returned by @code{widget-create}.
1269
1270 @defun widget-value widget
1271 Return the current value contained in @var{widget}.
1272 It is an error to call this function on an uninitialized widget.
1273 @end defun
1274
1275 @defun widget-value-set widget value
1276 Set the value contained in @var{widget} to @var{value}.
1277 It is an error to call this function with an invalid @var{value}.
1278 @end defun
1279
1280 @strong{Important:} You @emph{must} call @code{widget-setup} after
1281 modifying the value of a widget before the user is allowed to edit the
1282 widget again. It is enough to call @code{widget-setup} once if you
1283 modify multiple widgets. This is currently only necessary if the widget
1284 contains an editing field, but may be necessary for other widgets in the
1285 future.
1286
1287 If your application needs to associate some information with the widget
1288 objects, for example a reference to the item being edited, it can be
1289 done with @code{widget-put} and @code{widget-get}. The property names
1290 must begin with a @samp{:}.
1291
1292 @defun widget-put widget property value
1293 In @var{widget} set @var{property} to @var{value}.
1294 @var{property} should be a symbol, while @var{value} can be anything.
1295 @end defun
1296
1297 @defun widget-get widget property
1298 In @var{widget} return the value for @var{property}.
1299 @var{property} should be a symbol, the value is what was last set by
1300 @code{widget-put} for @var{property}.
1301 @end defun
1302
1303 @defun widget-member widget property
1304 Non-nil if @var{widget} has a value (even nil) for property @var{property}.
1305 @end defun
1306
1307 Occasionally it can be useful to know which kind of widget you have,
1308 i.e. the name of the widget type you gave when the widget was created.
1309
1310 @defun widget-type widget
1311 Return the name of @var{widget}, a symbol.
1312 @end defun
1313
1314 Widgets can be in two states: active, which means they are modifiable by
1315 the user, or inactive, which means they cannot be modified by the user.
1316 You can query or set the state with the following code:
1317
1318 @lisp
1319 ;; Examine if @var{widget} is active or not.
1320 (if (widget-apply @var{widget} :active)
1321 (message "Widget is active.")
1322 (message "Widget is inactive.")
1323
1324 ;; Make @var{widget} inactive.
1325 (widget-apply @var{widget} :deactivate)
1326
1327 ;; Make @var{widget} active.
1328 (widget-apply @var{widget} :activate)
1329 @end lisp
1330
1331 A widget is inactive if itself, or any of its ancestors (found by
1332 following the @code{:parent} link) have been deactivated. To make sure
1333 a widget is really active, you must therefore activate both itself, and
1334 all its ancestors.
1335
1336 @lisp
1337 (while widget
1338 (widget-apply widget :activate)
1339 (setq widget (widget-get widget :parent)))
1340 @end lisp
1341
1342 You can check if a widget has been made inactive by examining the value
1343 of @code{:inactive} keyword. If this is non-nil, the widget itself has
1344 been deactivated. This is different from using the @code{:active}
1345 keyword, in that the later tell you if the widget @strong{or} any of its
1346 ancestors have been deactivated. Do not attempt to set the
1347 @code{:inactive} keyword directly. Use the @code{:activate}
1348 @code{:deactivated} keywords instead.
1349
1350
1351 @node Defining New Widgets, Widget Browser, Widget Properties, Top
1352 @comment node-name, next, previous, up
1353 @section Defining New Widgets
1354
1355 You can define specialized widgets with @code{define-widget}. It allows
1356 you to create a shorthand for more complex widgets, including specifying
1357 component widgets and default new default values for the keyword
1358 arguments.
1359
1360 @defun widget-define name class doc &rest args
1361 Define a new widget type named @var{name} from @code{class}.
1362
1363 @var{name} and class should both be symbols, @code{class} should be one
1364 of the existing widget types.
1365
1366 The third argument @var{DOC} is a documentation string for the widget.
1367
1368 After the new widget has been defined, the following two calls will
1369 create identical widgets:
1370
1371 @itemize @bullet
1372 @item
1373 @lisp
1374 (widget-create @var{name})
1375 @end lisp
1376
1377 @item
1378 @lisp
1379 (apply widget-create @var{class} @var{args})
1380 @end lisp
1381 @end itemize
1382
1383 @end defun
1384
1385 Using @code{widget-define} does just store the definition of the widget
1386 type in the @code{widget-type} property of @var{name}, which is what
1387 @code{widget-create} uses.
1388
1389 If you just want to specify defaults for keywords with no complex
1390 conversions, you can use @code{identity} as your conversion function.
1391
1392 The following additional keyword arguments are useful when defining new
1393 widgets:
1394 @table @code
1395 @item :convert-widget
1396 Function to convert a widget type before creating a widget of that
1397 type. It takes a widget type as an argument, and returns the converted
1398 widget type. When a widget is created, this function is called for the
1399 widget type and all the widgets parent types, most derived first.
1400
1401 The following predefined functions can be used here:
1402
1403 @defun widget-types-convert-widget widget
1404 Convert @code{:args} as widget types in @var{widget}.
1405 @end defun
1406
1407 @defun widget-value-convert-widget widget
1408 Initialize @code{:value} from @code{:args} in @var{widget}.
1409 @end defun
1410
1411 @item :value-to-internal
1412 Function to convert the value to the internal format. The function
1413 takes two arguments, a widget and an external value, and returns the
1414 internal value. The function is called on the present @code{:value}
1415 when the widget is created, and on any value set later with
1416 @code{widget-value-set}.
1417
1418 @item :value-to-external
1419 Function to convert the value to the external format. The function
1420 takes two arguments, a widget and an internal value, and returns the
1421 internal value. The function is called on the present @code{:value}
1422 when the widget is created, and on any value set later with
1423 @code{widget-value-set}.
1424
1425 @item :create
1426 Function to create a widget from scratch. The function takes one
1427 argument, a widget type, and create a widget of that type, insert it in
1428 the buffer, and return a widget object.
1429
1430 @item :delete
1431 Function to delete a widget. The function takes one argument, a widget,
1432 and should remove all traces of the widget from the buffer.
1433
1434 @item :value-create
1435 Function to expand the @samp{%v} escape in the format string. It will
1436 be called with the widget as its argument. Should
1437 insert a representation of the widgets value in the buffer.
1438
1439 @item :value-delete
1440 Should remove the representation of the widgets value from the buffer.
1441 It will be called with the widget as its argument. It doesn't have to
1442 remove the text, but it should release markers and delete nested widgets
1443 if such has been used.
1444
1445 The following predefined function can be used here:
1446
1447 @defun widget-children-value-delete widget
1448 Delete all @code{:children} and @code{:buttons} in @var{widget}.
1449 @end defun
1450
1451 @item :value-get
1452 Function to extract the value of a widget, as it is displayed in the
1453 buffer.
1454
1455 The following predefined function can be used here:
1456
1457 @defun widget-value-value-get widget
1458 Return the @code{:value} property of @var{widget}.
1459 @end defun
1460
1461 @item :format-handler
1462 Function to handle unknown @samp{%} escapes in the format string. It
1463 will be called with the widget and the escape character as arguments.
1464 You can set this to allow your widget to handle non-standard escapes.
1465
1466 You should end up calling @code{widget-default-format-handler} to handle
1467 unknown escape sequences, which will handle the @samp{%h} and any future
1468 escape sequences, as well as give an error for unknown escapes.
1469
1470 @item :action
1471 Function to handle user initiated events. By default, @code{:notify}
1472 the parent.
1473
1474 The following predefined function can be used here:
1475
1476 @defun widget-parent-action widget &optional event
1477 Tell @code{:parent} of @var{widget} to handle the @code{:action}.
1478 Optional @var{event} is the event that triggered the action.
1479 @end defun
1480
1481 @item :prompt-value
1482 Function to prompt for a value in the minibuffer. The function should
1483 take four arguments, @var{widget}, @var{prompt}, @var{value}, and
1484 @var{unbound} and should return a value for widget entered by the user.
1485 @var{prompt} is the prompt to use. @var{value} is the default value to
1486 use, unless @var{unbound} is non-nil in which case there are no default
1487 value. The function should read the value using the method most natural
1488 for this widget, and does not have to check that it matches.
1489 @end table
1490
1491 If you want to define a new widget from scratch, use the @code{default}
1492 widget as its base.
1493
1494 @deffn Widget default
1495 Widget used as a base for other widgets.
1496
1497 It provides most of the functionality that is referred to as ``by
1498 default'' in this text.
1499 @end deffn
1500
1501 @node Widget Browser, Widget Minor Mode, Defining New Widgets, Top
1502 @comment node-name, next, previous, up
1503 @section Widget Browser
1504
1505 There is a separate package to browse widgets. This is intended to help
1506 programmers who want to examine the content of a widget. The browser
1507 shows the value of each keyword, but uses links for certain keywords
1508 such as `:parent', which avoids printing cyclic structures.
1509
1510 @deffn Command widget-browse WIDGET
1511 Create a widget browser for WIDGET.
1512 When called interactively, prompt for WIDGET.
1513 @end deffn
1514
1515 @deffn Command widget-browse-other-window WIDGET
1516 Create a widget browser for WIDGET and show it in another window.
1517 When called interactively, prompt for WIDGET.
1518 @end deffn
1519
1520 @deffn Command widget-browse-at POS
1521 Create a widget browser for the widget at POS.
1522 When called interactively, use the position of point.
1523 @end deffn
1524
1525 @node Widget Minor Mode, Utilities, Widget Browser, Top
1526 @comment node-name, next, previous, up
1527 @section Widget Minor Mode
1528
1529 There is a minor mode for manipulating widgets in major modes that
1530 doesn't provide any support for widgets themselves. This is mostly
1531 intended to be useful for programmers doing experiments.
1532
1533 @deffn Command widget-minor-mode
1534 Toggle minor mode for traversing widgets.
1535 With arg, turn widget mode on if and only if arg is positive.
1536 @end deffn
1537
1538 @defvar widget-minor-mode-keymap
1539 Keymap used in @code{widget-minor-mode}.
1540 @end defvar
1541
1542 @node Utilities, Widget Wishlist, Widget Minor Mode, Top
1543 @comment node-name, next, previous, up
1544 @section Utilities.
1545
1546 @defun widget-prompt-value widget prompt [ value unbound ]
1547 Prompt for a value matching @var{widget}, using @var{prompt}.
1548 The current value is assumed to be @var{value}, unless @var{unbound} is
1549 non-nil.@refill
1550 @end defun
1551
1552 @defun widget-get-sibling widget
1553 Get the item @var{widget} is assumed to toggle.
1554 This is only meaningful for radio buttons or checkboxes in a list.
1555 @end defun
1556
1557 @node Widget Wishlist, , Utilities, Top
1558 @comment node-name, next, previous, up
1559 @section Wishlist
1560
1561 @itemize @bullet
1562 @item
1563 It should be possible to add or remove items from a list with @kbd{C-k}
1564 and @kbd{C-o} (suggested by @sc{rms}).
1565
1566 @item
1567 The @samp{[INS]} and @samp{[DEL]} buttons should be replaced by a single
1568 dash (@samp{-}). The dash should be a button that, when invoked, ask
1569 whether you want to add or delete an item (@sc{rms} wanted to git rid of
1570 the ugly buttons, the dash is my idea).
1571
1572 @item
1573 The @code{menu-choice} tag should be prettier, something like the abbreviated
1574 menus in Open Look.
1575
1576 @item
1577 Finish @code{:tab-order}.
1578
1579 @item
1580 Make indentation work with glyphs and proportional fonts.
1581
1582 @item
1583 Add commands to show overview of object and class hierarchies to the
1584 browser.
1585
1586 @item
1587 Find a way to disable mouse highlight for inactive widgets.
1588
1589 @item
1590 Find a way to make glyphs look inactive.
1591
1592 @item
1593 Add @code{property-list} widget.
1594
1595 @item
1596 Add @code{association-list} widget.
1597
1598 @item
1599 Add @code{key-binding} widget.
1600
1601 @item
1602 Add @code{widget} widget for editing widget specifications.
1603
1604 @item
1605 Find clean way to implement variable length list.
1606 See @code{TeX-printer-list} for an explanation.
1607
1608 @item
1609 @kbd{C-h} in @code{widget-prompt-value} should give type specific help.
1610
1611 @item
1612 A mailto widget.
1613
1614 @end itemize
1615
1616 @contents
1617 @bye