Mercurial > hg > xemacs-beta
comparison man/widget.texi @ 5492:e82f5b7010fe
Merge some stuff in man, fix up Makefile
-------------------- ChangeLog entries follow: --------------------
man/ChangeLog addition:
2010-02-19 Ben Wing <ben@xemacs.org>
* widget.texi:
* widget.texi (Top):
* widget.texi (Introduction):
* widget.texi (User Interface):
* widget.texi (Programming Example):
* widget.texi (Setting Up the Buffer):
* widget.texi (Basic Types):
* widget.texi (link):
* widget.texi (url-link):
* widget.texi (info-link):
* widget.texi (push-button):
* widget.texi (editable-field):
* widget.texi (text):
* widget.texi (menu-choice):
* widget.texi (radio-button-choice):
* widget.texi (item):
* widget.texi (choice-item):
* widget.texi (toggle):
* widget.texi (checkbox):
* widget.texi (checklist):
* widget.texi (editable-list):
* widget.texi (group):
* widget.texi (Sexp Types):
* widget.texi (constants):
* widget.texi (generic):
* widget.texi (atoms):
* widget.texi (composite):
* widget.texi (Widget Properties):
* widget.texi (Defining New Widgets):
* widget.texi (Widget Browser):
* widget.texi (Widget Minor Mode):
* widget.texi (Utilities):
* widget.texi (Widget Wishlist):
* widget.texi (Widget Internals):
* widget.texi (GNU Free Documentation License):
* widget.texi (Index):
Sync with FSF 23.1.92.
2010-02-19 Ben Wing <ben@xemacs.org>
* texinfo/fdl.texi: New file.
* texinfo/texinfo.texi:
* texinfo/texinfo.texi (Top):
* texinfo/texinfo.texi (Copying Conditions):
* texinfo/texinfo.texi (Overview):
* texinfo/texinfo.texi (Reporting Bugs):
* texinfo/texinfo.texi (Using Texinfo):
* texinfo/texinfo.texi (Output Formats):
* texinfo/texinfo.texi (Info Files):
* texinfo/texinfo.texi (Printed Books):
* texinfo/texinfo.texi (Formatting Commands):
* texinfo/texinfo.texi (Conventions):
* texinfo/texinfo.texi (Comments):
* texinfo/texinfo.texi (Minimum):
* texinfo/texinfo.texi (Six Parts):
* texinfo/texinfo.texi (Short Sample):
* texinfo/texinfo.texi (History):
* texinfo/texinfo.texi (Texinfo Mode):
* texinfo/texinfo.texi (Texinfo Mode Overview):
* texinfo/texinfo.texi (XEmacs Editing):
* texinfo/texinfo.texi (Inserting):
* texinfo/texinfo.texi (Showing the Structure):
* texinfo/texinfo.texi (Updating Nodes and Menus):
* texinfo/texinfo.texi (Updating Commands):
* texinfo/texinfo.texi (Updating Requirements):
* texinfo/texinfo.texi (Other Updating Commands):
* texinfo/texinfo.texi (Info Formatting):
* texinfo/texinfo.texi (Printing):
* texinfo/texinfo.texi (Texinfo Mode Summary):
* texinfo/texinfo.texi (Beginning a File):
* texinfo/texinfo.texi (Sample Beginning):
* texinfo/texinfo.texi (Texinfo File Header):
* texinfo/texinfo.texi (First Line):
* texinfo/texinfo.texi (Start of Header):
* texinfo/texinfo.texi (setfilename):
* texinfo/texinfo.texi (settitle):
* texinfo/texinfo.texi (End of Header):
* texinfo/texinfo.texi (Document Permissions):
* texinfo/texinfo.texi (copying):
* texinfo/texinfo.texi (insertcopying):
* texinfo/texinfo.texi (Titlepage & Copyright Page):
* texinfo/texinfo.texi (titlepage):
* texinfo/texinfo.texi (titlefont center sp):
* texinfo/texinfo.texi (title subtitle author):
* texinfo/texinfo.texi (Copyright):
* texinfo/texinfo.texi (end titlepage):
* texinfo/texinfo.texi (headings on off):
* texinfo/texinfo.texi (Contents):
* texinfo/texinfo.texi (The Top Node):
* texinfo/texinfo.texi (Top Node Example):
* texinfo/texinfo.texi (Master Menu Parts):
* texinfo/texinfo.texi (Global Document Commands):
* texinfo/texinfo.texi (documentdescription):
* texinfo/texinfo.texi (setchapternewpage):
* texinfo/texinfo.texi (paragraphindent):
* texinfo/texinfo.texi (firstparagraphindent):
* texinfo/texinfo.texi (exampleindent):
* texinfo/texinfo.texi (Software Copying Permissions):
* texinfo/texinfo.texi (Ending a File):
* texinfo/texinfo.texi (Printing Indices & Menus):
* texinfo/texinfo.texi (File End):
* texinfo/texinfo.texi (Structuring):
* texinfo/texinfo.texi (Tree Structuring):
* texinfo/texinfo.texi (Structuring Command Types):
* texinfo/texinfo.texi (makeinfo top):
* texinfo/texinfo.texi (chapter):
* texinfo/texinfo.texi (unnumbered & appendix):
* texinfo/texinfo.texi (majorheading & chapheading):
* texinfo/texinfo.texi (section):
* texinfo/texinfo.texi (unnumberedsec appendixsec heading):
* texinfo/texinfo.texi (subsection):
* texinfo/texinfo.texi (unnumberedsubsec appendixsubsec subheading):
* texinfo/texinfo.texi (subsubsection):
* texinfo/texinfo.texi (Raise/lower sections):
* texinfo/texinfo.texi (Nodes):
* texinfo/texinfo.texi (Two Paths):
* texinfo/texinfo.texi (Node Menu Illustration):
* texinfo/texinfo.texi (node):
* texinfo/texinfo.texi (Node Names):
* texinfo/texinfo.texi (Writing a Node):
* texinfo/texinfo.texi (Node Line Tips):
* texinfo/texinfo.texi (Node Line Requirements):
* texinfo/texinfo.texi (First Node):
* texinfo/texinfo.texi (makeinfo top command):
* texinfo/texinfo.texi (makeinfo Pointer Creation):
* texinfo/texinfo.texi (anchor):
* texinfo/texinfo.texi (Menus):
* texinfo/texinfo.texi (Menu Location):
* texinfo/texinfo.texi (Writing a Menu):
* texinfo/texinfo.texi (Menu Parts):
* texinfo/texinfo.texi (Less Cluttered Menu Entry):
* texinfo/texinfo.texi (Menu Example):
* texinfo/texinfo.texi (Other Info Files):
* texinfo/texinfo.texi (Cross References):
* texinfo/texinfo.texi (References):
* texinfo/texinfo.texi (Cross Reference Commands):
* texinfo/texinfo.texi (Cross Reference Parts):
* texinfo/texinfo.texi (xref):
* texinfo/texinfo.texi (Reference Syntax):
* texinfo/texinfo.texi (One Argument):
* texinfo/texinfo.texi (Two Arguments):
* texinfo/texinfo.texi (Three Arguments):
* texinfo/texinfo.texi (Four and Five Arguments):
* texinfo/texinfo.texi (Top Node Naming):
* texinfo/texinfo.texi (ref):
* texinfo/texinfo.texi (pxref):
* texinfo/texinfo.texi (inforef):
* texinfo/texinfo.texi (uref):
* texinfo/texinfo.texi (cite):
* texinfo/texinfo.texi (Marking Text):
* texinfo/texinfo.texi (Indicating):
* texinfo/texinfo.texi (Useful Highlighting):
* texinfo/texinfo.texi (code):
* texinfo/texinfo.texi (kbd):
* texinfo/texinfo.texi (key):
* texinfo/texinfo.texi (samp):
* texinfo/texinfo.texi (verb):
* texinfo/texinfo.texi (var):
* texinfo/texinfo.texi (env):
* texinfo/texinfo.texi (file):
* texinfo/texinfo.texi (command):
* texinfo/texinfo.texi (option):
* texinfo/texinfo.texi (dfn):
* texinfo/texinfo.texi (abbr):
* texinfo/texinfo.texi (acronym):
* texinfo/texinfo.texi (indicateurl):
* texinfo/texinfo.texi (email):
* texinfo/texinfo.texi (Emphasis):
* texinfo/texinfo.texi (emph & strong):
* texinfo/texinfo.texi (Smallcaps):
* texinfo/texinfo.texi (Fonts):
* texinfo/texinfo.texi (Quotations and Examples):
* texinfo/texinfo.texi (Block Enclosing Commands):
* texinfo/texinfo.texi (quotation):
* texinfo/texinfo.texi (example):
* texinfo/texinfo.texi (verbatim):
* texinfo/texinfo.texi (verbatiminclude):
* texinfo/texinfo.texi (lisp):
* texinfo/texinfo.texi (small):
* texinfo/texinfo.texi (display):
* texinfo/texinfo.texi (format):
* texinfo/texinfo.texi (exdent):
* texinfo/texinfo.texi (flushleft & flushright):
* texinfo/texinfo.texi (noindent):
* texinfo/texinfo.texi (indent):
* texinfo/texinfo.texi (cartouche):
* texinfo/texinfo.texi (Lists and Tables):
* texinfo/texinfo.texi (Introducing Lists):
* texinfo/texinfo.texi (itemize):
* texinfo/texinfo.texi (enumerate):
* texinfo/texinfo.texi (Two-column Tables):
* texinfo/texinfo.texi (table):
* texinfo/texinfo.texi (ftable vtable):
* texinfo/texinfo.texi (itemx):
* texinfo/texinfo.texi (Multi-column Tables):
* texinfo/texinfo.texi (Multitable Column Widths):
* texinfo/texinfo.texi (Multitable Rows):
* texinfo/texinfo.texi (Special Displays):
* texinfo/texinfo.texi (Floats):
* texinfo/texinfo.texi (float):
* texinfo/texinfo.texi (caption shortcaption):
* texinfo/texinfo.texi (listoffloats):
* texinfo/texinfo.texi (Images):
* texinfo/texinfo.texi (Image Syntax):
* texinfo/texinfo.texi (Image Scaling):
* texinfo/texinfo.texi (Footnotes):
* texinfo/texinfo.texi (Footnote Commands):
* texinfo/texinfo.texi (Footnote Styles):
* texinfo/texinfo.texi (Indices):
* texinfo/texinfo.texi (Index Entries):
* texinfo/texinfo.texi (Predefined Indices):
* texinfo/texinfo.texi (Indexing Commands):
* texinfo/texinfo.texi (Combining Indices):
* texinfo/texinfo.texi (syncodeindex):
* texinfo/texinfo.texi (synindex):
* texinfo/texinfo.texi (New Indices):
* texinfo/texinfo.texi (Insertions):
* texinfo/texinfo.texi (Atsign Braces Comma):
* texinfo/texinfo.texi (Inserting an Atsign):
* texinfo/texinfo.texi (Inserting Braces):
* texinfo/texinfo.texi (Inserting a Comma):
* texinfo/texinfo.texi (Inserting Quote Characters):
* texinfo/texinfo.texi (Inserting Space):
* texinfo/texinfo.texi (Not Ending a Sentence):
* texinfo/texinfo.texi (Ending a Sentence):
* texinfo/texinfo.texi (Multiple Spaces):
* texinfo/texinfo.texi (frenchspacing):
* texinfo/texinfo.texi (dmn):
* texinfo/texinfo.texi (Inserting Accents):
* texinfo/texinfo.texi (Inserting Quotation Marks):
* texinfo/texinfo.texi (Dots Bullets):
* texinfo/texinfo.texi (dots):
* texinfo/texinfo.texi (bullet):
* texinfo/texinfo.texi (TeX and copyright):
* texinfo/texinfo.texi (tex):
* texinfo/texinfo.texi (copyright symbol):
* texinfo/texinfo.texi (registered symbol):
* texinfo/texinfo.texi (euro):
* texinfo/texinfo.texi (pounds):
* texinfo/texinfo.texi (textdegree):
* texinfo/texinfo.texi (minus):
* texinfo/texinfo.texi (geq leq):
* texinfo/texinfo.texi (math):
* texinfo/texinfo.texi (Click Sequences):
* texinfo/texinfo.texi (Glyphs):
* texinfo/texinfo.texi (Glyphs Summary):
* texinfo/texinfo.texi (result):
* texinfo/texinfo.texi (expansion):
* texinfo/texinfo.texi (Print Glyph):
* texinfo/texinfo.texi (Error Glyph):
* texinfo/texinfo.texi (Equivalence):
* texinfo/texinfo.texi (Point Glyph):
* texinfo/texinfo.texi (Breaks):
* texinfo/texinfo.texi (Break Commands):
* texinfo/texinfo.texi (Line Breaks):
* texinfo/texinfo.texi (- and hyphenation):
* texinfo/texinfo.texi (allowcodebreaks):
* texinfo/texinfo.texi (w):
* texinfo/texinfo.texi (tie):
* texinfo/texinfo.texi (sp):
* texinfo/texinfo.texi (page):
* texinfo/texinfo.texi (group):
* texinfo/texinfo.texi (need):
* texinfo/texinfo.texi (Definition Commands):
* texinfo/texinfo.texi (Def Cmd Template):
* texinfo/texinfo.texi (Def Cmd Continuation Lines):
* texinfo/texinfo.texi (Optional Arguments):
* texinfo/texinfo.texi (deffnx):
* texinfo/texinfo.texi (Def Cmds in Detail):
* texinfo/texinfo.texi (Functions Commands):
* texinfo/texinfo.texi (Variables Commands):
* texinfo/texinfo.texi (Typed Functions):
* texinfo/texinfo.texi (Typed Variables):
* texinfo/texinfo.texi (Data Types):
* texinfo/texinfo.texi (Abstract Objects):
* texinfo/texinfo.texi (Object-Oriented Variables):
* texinfo/texinfo.texi (Object-Oriented Methods):
* texinfo/texinfo.texi (Defining Macros):
* texinfo/texinfo.texi (Invoking Macros):
* texinfo/texinfo.texi (Macro Details):
* texinfo/texinfo.texi (alias):
* texinfo/texinfo.texi (definfoenclose):
* texinfo/texinfo.texi (Hardcopy):
* texinfo/texinfo.texi (Use TeX):
* texinfo/texinfo.texi (Format with tex/texindex):
* texinfo/texinfo.texi (Format with texi2dvi):
* texinfo/texinfo.texi (Print with lpr):
* texinfo/texinfo.texi (Within XEmacs):
* texinfo/texinfo.texi (Texinfo Mode Printing):
* texinfo/texinfo.texi (Compile-Command):
* texinfo/texinfo.texi (Requirements Summary):
* texinfo/texinfo.texi (Preparing for TeX):
* texinfo/texinfo.texi (Overfull hboxes):
* texinfo/texinfo.texi (smallbook):
* texinfo/texinfo.texi (A4 Paper):
* texinfo/texinfo.texi (pagesizes):
* texinfo/texinfo.texi (Cropmarks and Magnification):
* texinfo/texinfo.texi (PDF Output):
* texinfo/texinfo.texi (Obtaining TeX):
* texinfo/texinfo.texi (Creating and Installing Info Files):
* texinfo/texinfo.texi (Creating an Info File):
* texinfo/texinfo.texi (makeinfo advantages):
* texinfo/texinfo.texi (Invoking makeinfo):
* texinfo/texinfo.texi (makeinfo options):
* texinfo/texinfo.texi (Pointer Validation):
* texinfo/texinfo.texi (makeinfo in XEmacs):
* texinfo/texinfo.texi (texinfo-format commands):
* texinfo/texinfo.texi (Batch Formatting):
* texinfo/texinfo.texi (Tag and Split Files):
* texinfo/texinfo.texi (Installing an Info File):
* texinfo/texinfo.texi (Directory File):
* texinfo/texinfo.texi (New Info File):
* texinfo/texinfo.texi (Other Info Directories):
* texinfo/texinfo.texi (Installing Dir Entries):
* texinfo/texinfo.texi (Invoking install-info):
* texinfo/texinfo.texi (Generating HTML):
* texinfo/texinfo.texi (HTML Translation):
* texinfo/texinfo.texi (HTML Splitting):
* texinfo/texinfo.texi (HTML CSS):
* texinfo/texinfo.texi (HTML Xref):
* texinfo/texinfo.texi (HTML Xref Link Basics):
* texinfo/texinfo.texi (HTML Xref Node Name Expansion):
* texinfo/texinfo.texi (HTML Xref Command Expansion):
* texinfo/texinfo.texi (HTML Xref 8-bit Character Expansion):
* texinfo/texinfo.texi (HTML Xref Mismatch):
* texinfo/texinfo.texi (Command List):
* texinfo/texinfo.texi (Command Syntax):
* texinfo/texinfo.texi (Tips):
* texinfo/texinfo.texi (Sample Texinfo Files):
* texinfo/texinfo.texi (Short Sample Texinfo File):
* texinfo/texinfo.texi (GNU Sample Texts):
* texinfo/texinfo.texi (Invoking sample):
* texinfo/texinfo.texi (GNU Free Documentation License):
* texinfo/texinfo.texi (Index):
* texinfo/texinfo.texi (Verbatim Copying License):
* texinfo/texinfo.texi (All-permissive Copying License):
* texinfo/texinfo.texi (Include Files):
* texinfo/texinfo.texi (Using Include Files):
* texinfo/texinfo.texi (texinfo-multiple-files-update):
* texinfo/texinfo.texi (Include Files Requirements):
* texinfo/texinfo.texi (Sample Include File):
* texinfo/texinfo.texi (Include Files Evolution):
* texinfo/texinfo.texi (Headings):
* texinfo/texinfo.texi (Headings Introduced):
* texinfo/texinfo.texi (Heading Format):
* texinfo/texinfo.texi (Heading Choice):
* texinfo/texinfo.texi (Custom Headings):
* texinfo/texinfo.texi (Catching Mistakes):
* texinfo/texinfo.texi (makeinfo Preferred):
* texinfo/texinfo.texi (Debugging with Info):
* texinfo/texinfo.texi (Debugging with TeX):
* texinfo/texinfo.texi (Using texinfo-show-structure):
* texinfo/texinfo.texi (Using occur):
* texinfo/texinfo.texi (Running Info-Validate):
* texinfo/texinfo.texi (Using Info-validate):
* texinfo/texinfo.texi (Unsplit):
* texinfo/texinfo.texi (Tagifying):
* texinfo/texinfo.texi (Splitting):
* texinfo/texinfo.texi (Refilling Paragraphs):
* texinfo/texinfo.texi (Command and Variable Index):
* texinfo/texinfo.texi (General Index):
* texinfo/version.texi: New file.
Sync with FSF 23.1.92. Make new directory to hold the files needed
to generate texinfo.info, since there are three such files now.
2010-02-19 Ben Wing <ben@xemacs.org>
* Makefile:
* Makefile (src_files1):
* Makefile (DIR):
* Makefile (texinfo-srcs):
* Makefile ($(INFODIR)/widget.info):
* Makefile ($(INFODIR)/texinfo.info):
* Makefile (.PHONY):
* Makefile (texinfo.dvi):
* Makefile (texinfo.pdf):
* Makefile ($(HTMLDIR)/widget.html):
* Makefile ($(HTMLDIR)/texinfo.html):
Incorporate texinfo.texi moving to a subdirectory texinfo/.
Do some tricks to reduce the amount of duplication while still
maintaining compatible with non-GNU make (at least, with
Solaris make).
* doclicense.texi: New file.
* info.texi:
* info.texi (Top):
* info.texi (Getting Started):
* info.texi (Help-Small-Screen):
* info.texi (Help):
* info.texi (Help-P):
* info.texi (Help-^L):
* info.texi (Help-Inv):
* info.texi (Help-]):
* info.texi (Help-M):
* info.texi (Help-FOO):
* info.texi (Help-Xref):
* info.texi (Help-Int):
* info.texi (Help-Q):
* info.texi (Advanced):
* info.texi (Search Text):
* info.texi (Search Index):
* info.texi (Go to node):
* info.texi (Choose menu subtopic):
* info.texi (Create Info buffer):
* info.texi (XEmacs Info Variables):
* info.texi (Expert Info):
* info.texi (Add):
* info.texi (Menus):
* info.texi (Cross-refs):
* info.texi (Help-Cross):
* info.texi (Tags):
* info.texi (Checking):
* info.texi (Index):
* texinfo.tex:
* texinfo.tex (paragraphindent{%):
* texinfo.tex (sectionheading will have):
* texinfo.tex (chapterzzz{#3}%):
* texinfo.tex (subsubsection = \numberedsubsubsec):
* texinfo.tex (subsubsection = \appendixsubsubsec):
* texinfo.tex (subsubsection = \unnumberedsubsubsec):
* texinfo.tex (sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%):
* texinfo.tex (sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%):
* texinfo.tex (sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%):
* texinfo.tex (sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%):
* texinfo.tex (sectionheading{#1}{subsec}{Yappendix}%):
* texinfo.tex (sectionheading{#1}{subsec}{Ynothing}%):
* texinfo.tex (sectionheading{#1}{subsubsec}{Ynumbered}%):
* texinfo.tex (sectionheading{#1}{subsubsec}{Yappendix}%):
* texinfo.tex (sectionheading{#1}{subsubsec}{Ynothing}%):
* texinfo.tex (sectionheading{#1}{subsubsec}{Yomitfromtoc}{}):
* texinfo.tex (sectionheading to do the printing.):
* texinfo.tex (sectionlevel}{#1}{#4}%):
* texinfo.tex (sectionheading, q.v.):
Sync with FSF 23.1.92.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Fri, 19 Feb 2010 22:39:19 -0600 |
parents | 1094d6d400fb |
children | a7da359711ce |
comparison
equal
deleted
inserted
replaced
5491:06dd936cde16 | 5492:e82f5b7010fe |
---|---|
1 \input texinfo.tex | 1 \input texinfo.tex |
2 | |
3 @c %**start of header | 2 @c %**start of header |
4 @setfilename ../info/widget.info | 3 @setfilename ../info/widget.info |
5 @settitle The Emacs Widget Library | 4 @settitle The Emacs Widget Library |
6 @iftex | 5 @syncodeindex fn cp |
7 @afourpaper | 6 @syncodeindex vr cp |
8 @headings double | 7 @syncodeindex ky cp |
9 @end iftex | |
10 @c %**end of header | 8 @c %**end of header |
9 @c Synced up with: FSF 23.1.92. | |
10 @c Synced by: Ben Wing, 2-17-10. | |
11 | |
12 @copying | |
13 Copyright @copyright{} 2000, 2001, 2002, 2003, 2004, 2005, | |
14 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | |
15 | |
16 @quotation | |
17 Permission is granted to copy, distribute and/or modify this document | |
18 under the terms of the GNU Free Documentation License, Version 1.3 or | |
19 any later version published by the Free Software Foundation; with no | |
20 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', | |
21 and with the Back-Cover Texts as in (a) below. A copy of the license | |
22 is included in the section entitled ``GNU Free Documentation License''. | |
23 | |
24 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and | |
25 modify this GNU manual. Buying copies from the FSF supports it in | |
26 developing GNU and promoting software freedom.'' | |
27 @end quotation | |
28 @end copying | |
11 | 29 |
12 @ifinfo | 30 @ifinfo |
13 @dircategory XEmacs Editor | 31 @dircategory XEmacs Editor |
14 @direntry | 32 @direntry |
15 * Widgets: (widget). The Emacs Widget Library. | 33 * Widget: (widget). The "widget" package used by the Emacs Customization |
34 facility. | |
16 @end direntry | 35 @end direntry |
17 @end ifinfo | 36 @end ifinfo |
18 | 37 |
38 @contents | |
39 | |
19 @node Top, Introduction, (dir), (dir) | 40 @node Top, Introduction, (dir), (dir) |
20 @comment node-name, next, previous, up | 41 @comment node-name, next, previous, up |
21 @top The Emacs Widget Library | 42 @top The Emacs Widget Library |
43 | |
44 @insertcopying | |
22 | 45 |
23 @menu | 46 @menu |
24 * Introduction:: | 47 * Introduction:: |
25 * User Interface:: | 48 * User Interface:: |
26 * Programming Example:: | 49 * Programming Example:: |
31 * Defining New Widgets:: | 54 * Defining New Widgets:: |
32 * Widget Browser:: | 55 * Widget Browser:: |
33 * Widget Minor Mode:: | 56 * Widget Minor Mode:: |
34 * Utilities:: | 57 * Utilities:: |
35 * Widget Wishlist:: | 58 * Widget Wishlist:: |
36 * Widget Internals:: | 59 * Widget Internals:: |
60 * GNU Free Documentation License:: | |
61 * Index:: | |
62 @detailmenu | |
63 --- The Detailed Node Listing --- | |
64 | |
65 The Emacs Widget Library | |
66 | |
67 * Introduction:: | |
68 * User Interface:: | |
69 * Programming Example:: | |
70 * Setting Up the Buffer:: | |
71 * Basic Types:: | |
72 * Sexp Types:: | |
73 * Widget Properties:: | |
74 * Defining New Widgets:: | |
75 * Widget Browser:: | |
76 * Widget Minor Mode:: | |
77 * Utilities:: | |
78 * Widget Wishlist:: | |
79 * Widget Internals:: | |
80 * GNU Free Documentation License:: | |
81 * Index:: | |
82 | |
83 Basic Types | |
84 | |
85 * link:: | |
86 * url-link:: | |
87 * info-link:: | |
88 * push-button:: | |
89 * editable-field:: | |
90 * text:: | |
91 * menu-choice:: | |
92 * radio-button-choice:: | |
93 * item:: | |
94 * choice-item:: | |
95 * toggle:: | |
96 * checkbox:: | |
97 * checklist:: | |
98 * editable-list:: | |
99 * group:: | |
100 | |
101 Sexp Types | |
102 | |
103 * constants:: | |
104 * generic:: | |
105 * atoms:: | |
106 * composite:: | |
107 | |
108 @end detailmenu | |
37 @end menu | 109 @end menu |
38 | 110 |
111 | |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | |
120 | |
39 @node Introduction, User Interface, Top, Top | 121 @node Introduction, User Interface, Top, Top |
40 @comment node-name, next, previous, up | 122 @comment node-name, next, previous, up |
41 @section Introduction | 123 @section Introduction |
42 | 124 |
43 @c XEmacs changes to reflect history, native widgets, and GTK | 125 @c XEmacs changes to reflect history, native widgets, and GTK |
44 Most graphical user interface toolkits, since Motif and XView, provide | 126 Most graphical user interface toolkits provide |
45 a number of standard user interface controls (sometimes known as | 127 a number of standard user interface controls (sometimes known as |
46 `widgets' or `gadgets'). Historically, Emacs didn't support anything like | 128 `widgets' or `gadgets'). Historically, Emacs didn't support anything like |
47 this, except for its incredible powerful text ``widget''. However, | 129 this, except for its incredible powerful text ``widget''. However, |
48 since XEmacs 21.4, XEmacs has supported ``native'' widgets (GUI controls | 130 since XEmacs 21.4, XEmacs has supported ``native'' widgets (GUI controls |
49 implemented as Lisp APIs in C for the MS Windows, Motif, Athena, and GTK | 131 implemented as Lisp APIs in C for the MS Windows, Motif, Athena, and GTK |
51 toolkit). On the other hand, Emacs does provide the necessary | 133 toolkit). On the other hand, Emacs does provide the necessary |
52 primitives to implement many other widgets within a text buffer, and of | 134 primitives to implement many other widgets within a text buffer, and of |
53 course this is the only way to implement self-contained controls in a | 135 course this is the only way to implement self-contained controls in a |
54 text terminal. The @code{widget} package simplifies this task. | 136 text terminal. The @code{widget} package simplifies this task. |
55 | 137 |
138 @cindex basic widgets | |
139 @cindex widgets, basic types | |
56 Examples of some basic widgets include: | 140 Examples of some basic widgets include: |
57 | 141 |
58 @table @code | 142 @table @code |
59 @item link | 143 @item link |
60 Areas of text with an associated action. Intended for hypertext links | 144 Areas of text with an associated action. Intended for hypertext links |
61 embedded in text. | 145 embedded in text. |
62 @item push-button | 146 @item push-button |
63 Like link, but intended for stand-alone buttons. | 147 Like link, but intended for stand-alone buttons. |
64 @item editable-field | 148 @item editable-field |
65 An editable text field. It can be either variable or fixed length. | 149 An editable text field. It can be either variable or fixed length. |
66 @item menu-choice | 150 @item menu-choice |
67 Allows the user to choose one of multiple options from a menu, each | 151 Allows the user to choose one of multiple options from a menu, each |
71 Allows the user to choose one of multiple options by activating radio | 155 Allows the user to choose one of multiple options by activating radio |
72 buttons. The options are implemented as widgets. All options will be | 156 buttons. The options are implemented as widgets. All options will be |
73 visible in the buffer. | 157 visible in the buffer. |
74 @item item | 158 @item item |
75 A simple constant widget intended to be used in the @code{menu-choice} and | 159 A simple constant widget intended to be used in the @code{menu-choice} and |
76 @code{radio-button-choice} widgets. | 160 @code{radio-button-choice} widgets. |
77 @item choice-item | 161 @item choice-item |
78 A button item only intended for use in choices. When invoked, the user | 162 A button item only intended for use in choices. When invoked, the user |
79 will be asked to select another option from the choice widget. | 163 will be asked to select another option from the choice widget. |
80 @item toggle | 164 @item toggle |
81 A simple @samp{on}/@samp{off} switch. | 165 A simple @samp{on}/@samp{off} switch. |
82 @item checkbox | 166 @item checkbox |
83 A checkbox (@samp{[ ]}/@samp{[X]}). | 167 A checkbox (@samp{[ ]}/@samp{[X]}). |
84 @item editable-list | 168 @item editable-list |
85 Create an editable list. The user can insert or delete items in the | 169 Create an editable list. The user can insert or delete items in the |
86 list. Each list item is itself a widget. | 170 list. Each list item is itself a widget. |
87 @end table | 171 @end table |
88 | 172 |
89 Now of what possible use can support for widgets be in a text editor? | 173 Now, of what possible use can support for widgets be in a text editor? |
90 I'm glad you asked. The answer is that widgets are useful for | 174 I'm glad you asked. The answer is that widgets are useful for |
91 implementing forms. A @dfn{form} in Emacs is a buffer where the user is | 175 implementing forms. A @dfn{form} in Emacs is a buffer where the user is |
92 supposed to fill out a number of fields, each of which has a specific | 176 supposed to fill out a number of fields, each of which has a specific |
93 meaning. The user is not supposed to change or delete any of the text | 177 meaning. The user is not supposed to change or delete any of the text |
94 between the fields. Examples of forms in Emacs are the @file{forms} | 178 between the fields. Examples of forms in Emacs are the @file{forms} |
95 package (of course), the customize buffers, the mail and news compose | 179 package (of course), the customize buffers, the mail and news compose |
96 modes, and the @sc{html} form support in the @file{w3} browser. | 180 modes, and the @acronym{HTML} form support in the @file{w3} browser. |
97 | 181 |
182 @cindex widget library, why use it | |
98 The advantages for a programmer of using the @code{widget} package to | 183 The advantages for a programmer of using the @code{widget} package to |
99 implement forms are: | 184 implement forms are: |
100 | 185 |
101 @enumerate | 186 @enumerate |
102 @item | 187 @item |
103 More complex fields than just editable text are supported. | 188 More complex fields than just editable text are supported. |
104 @item | 189 @item |
105 You can give the user immediate feedback if he enters invalid data in a | 190 You can give the users immediate feedback if they enter invalid data in a |
106 text field, and sometimes prevent entering invalid data. | 191 text field, and sometimes prevent entering invalid data. |
107 @item | 192 @item |
108 You can have fixed sized fields, thus allowing multiple fields to be | 193 You can have fixed sized fields, thus allowing multiple fields to be |
109 lined up in columns. | 194 lined up in columns. |
110 @item | 195 @item |
111 It is simple to query or set the value of a field. | 196 It is simple to query or set the value of a field. |
112 @item | 197 @item |
113 Editing happens in a normal buffer, not in the mini-buffer. | 198 Editing happens in a normal buffer, not in the mini-buffer. |
114 @item | 199 @item |
115 Packages using the library get a uniform look-and-feel, making them easier for | 200 Packages using the library get a uniform look-and-feel, making them easier for |
116 the user to learn. | 201 the user to learn. |
117 @item | 202 @item |
118 As support for embedded graphics has improved, the widget library will | 203 As support for embedded graphics improve, the widget library will be |
119 extended to support it. This means that your code using the widget | 204 extended to use the GUI features. This means that your code using the |
120 library will also use the new graphic features automatically. | 205 widget library will also use the new graphic features automatically. |
121 @item | 206 @item |
122 A widget specification is implemented as a class, and new subclasses can | 207 A widget specification is implemented as a class, and new subclasses can |
123 be derived from any class, by restricting or extending the behavior. | 208 be derived from any class, by restricting or extending the behavior. |
124 @end enumerate | 209 @end enumerate |
125 | 210 |
133 @item wid-edit.el | 218 @item wid-edit.el |
134 Everything else is here. Do not load it explicitly, as | 219 Everything else is here. Do not load it explicitly, as |
135 it will be autoloaded when needed. | 220 it will be autoloaded when needed. |
136 @end table | 221 @end table |
137 | 222 |
223 In order to minimize the code that is loaded by users who does not | |
224 create any widgets, the code has been split in two files: | |
225 | |
226 @table @file | |
227 @item widget.el | |
228 This will declare the user variables, define the function | |
229 @code{widget-define}, and autoload the function @code{widget-create}. | |
230 @item wid-edit.el | |
231 Everything else is here, there is no reason to load it explicitly, as | |
232 it will be autoloaded when needed. | |
233 @end table | |
234 | |
138 @node User Interface, Programming Example, Introduction, Top | 235 @node User Interface, Programming Example, Introduction, Top |
139 @comment node-name, next, previous, up | 236 @comment node-name, next, previous, up |
140 @section User Interface | 237 @section User Interface |
141 | 238 |
142 A form consists of read only text for documentation and some fields, | 239 A form consists of read only text for documentation and some fields, |
143 where each of the fields contains two parts, a tag and a value. The | 240 where each field contains two parts, a tag and a value. The tags are |
144 tags are used to identify the fields, so the documentation can refer to | 241 used to identify the fields, so the documentation can refer to the |
145 the foo field, meaning the field tagged with @samp{Foo}. Here is an | 242 @samp{foo field}, meaning the field tagged with @samp{Foo}. Here is an |
146 example form: | 243 example form: |
147 | 244 |
148 @example | 245 @example |
149 Here is some documentation. | 246 Here is some documentation. |
150 | 247 |
157 | 254 |
158 Numbers: count to three below | 255 Numbers: count to three below |
159 @b{[INS]} @b{[DEL]} @i{One} | 256 @b{[INS]} @b{[DEL]} @i{One} |
160 @b{[INS]} @b{[DEL]} @i{Eh, two?} | 257 @b{[INS]} @b{[DEL]} @i{Eh, two?} |
161 @b{[INS]} @b{[DEL]} @i{Five!} | 258 @b{[INS]} @b{[DEL]} @i{Five!} |
162 @b{[INS]} | 259 @b{[INS]} |
163 | 260 |
164 Select multiple: | 261 Select multiple: |
165 | 262 |
166 @b{[X]} This | 263 @b{[X]} This |
167 @b{[ ]} That | 264 @b{[ ]} That |
177 @end example | 274 @end example |
178 | 275 |
179 The top level widgets in this example are tagged @samp{Name}, | 276 The top level widgets in this example are tagged @samp{Name}, |
180 @samp{Choose}, @samp{Address}, @samp{_other work_}, @samp{Numbers}, | 277 @samp{Choose}, @samp{Address}, @samp{_other work_}, @samp{Numbers}, |
181 @samp{Select multiple}, @samp{Select one}, @samp{[Apply Form]}, and | 278 @samp{Select multiple}, @samp{Select one}, @samp{[Apply Form]}, and |
182 @samp{[Reset Form]}. There are basically two thing the user can do within | 279 @samp{[Reset Form]}. There are basically two things the user can do |
183 a form, namely editing the editable text fields and activating the | 280 within a form, namely editing the editable text fields and activating |
184 buttons. | 281 the buttons. |
185 | 282 |
186 @subsection Editable Text Fields | 283 @subsection Editable Text Fields |
187 | 284 |
188 In the example, the value for the @samp{Name} is most likely displayed | 285 In the example, the value for the @samp{Name} is most likely displayed |
189 in an editable text field, and so are values for each of the members of | 286 in an editable text field, and so are values for each of the members of |
191 available for editing these fields. The only restriction is that each | 288 available for editing these fields. The only restriction is that each |
192 change you make must be contained within a single editable text field. | 289 change you make must be contained within a single editable text field. |
193 For example, capitalizing all text from the middle of one field to the | 290 For example, capitalizing all text from the middle of one field to the |
194 middle of another field is prohibited. | 291 middle of another field is prohibited. |
195 | 292 |
196 Editing text fields are created by the @code{editable-field} widget. | 293 Editable text fields are created by the @code{editable-field} widget. |
294 | |
295 @strong{Warning:} In an @code{editable-field} widget, the editable | |
296 field must not be adjacent to another widget---that won't work. | |
297 You must put some text in between. Either make this text part of | |
298 the @code{editable-field} widget itself, or insert it with | |
299 @code{widget-insert}. | |
300 | |
301 The @code{:format} keyword is useful for generating the necessary | |
302 text; for instance, if you give it a value of @code{"Name: %v "}, | |
303 the @samp{Name: } part will provide the necessary separating text | |
304 before the field and the trailing space will provide the | |
305 separating text after the field. If you don't include the | |
306 @code{:size} keyword, the field will extend to the end of the | |
307 line, and the terminating newline will provide separation after. | |
308 | |
309 @strong{Warning:} In an @code{editable-field} widget, the @samp{%v} escape | |
310 must be preceded by some other text in the @code{:format} string | |
311 (if specified). | |
197 | 312 |
198 The editing text fields are highlighted with the | 313 The editing text fields are highlighted with the |
199 @code{widget-field-face} face, making them easy to find. | 314 @code{widget-field-face} face, making them easy to find. |
200 | 315 |
201 @deffn Face widget-field-face | 316 @deffn Face widget-field-face |
202 Face used for other editing fields. | 317 Face used for other editing fields. |
203 @end deffn | 318 @end deffn |
204 | 319 |
205 @subsection Buttons | 320 @subsection Buttons |
206 | 321 |
322 @cindex widget buttons | |
323 @cindex button widgets | |
207 Some portions of the buffer have an associated @dfn{action}, which can | 324 Some portions of the buffer have an associated @dfn{action}, which can |
208 be @dfn{invoked} by a standard key or mouse command. These portions | 325 be @dfn{invoked} by a standard key or mouse command. These portions |
209 are called @dfn{buttons}. The default commands for activating a button | 326 are called @dfn{buttons}. The default commands for activating a button |
210 are: | 327 are: |
211 | 328 |
215 Invoke the button at @var{pos}, defaulting to point. | 332 Invoke the button at @var{pos}, defaulting to point. |
216 If point is not located on a button, invoke the binding in | 333 If point is not located on a button, invoke the binding in |
217 @code{widget-global-map} (by default the global map). | 334 @code{widget-global-map} (by default the global map). |
218 @end deffn | 335 @end deffn |
219 | 336 |
220 @item mouse-2 | 337 @kindex Mouse-2 @r{(on button widgets}) |
338 @item Mouse-2 | |
221 @deffn Command widget-button-click @var{event} | 339 @deffn Command widget-button-click @var{event} |
222 Invoke the button at the location of the mouse pointer. If the mouse | 340 Invoke the button at the location of the mouse pointer. If the mouse |
223 pointer is located in an editable text field, invoke the binding in | 341 pointer is located in an editable text field, invoke the binding in |
224 @code{widget-global-map} (by default the global map). | 342 @code{widget-global-map} (by default the global map). |
225 @end deffn | 343 @end deffn |
227 | 345 |
228 There are several different kind of buttons, all of which are present in | 346 There are several different kind of buttons, all of which are present in |
229 the example: | 347 the example: |
230 | 348 |
231 @table @emph | 349 @table @emph |
232 @item The Option Field Tags. | 350 @cindex option field tag |
351 @item The Option Field Tags | |
233 When you invoke one of these buttons, you will be asked to choose | 352 When you invoke one of these buttons, you will be asked to choose |
234 between a number of different options. This is how you edit an option | 353 between a number of different options. This is how you edit an option |
235 field. Option fields are created by the @code{menu-choice} widget. In | 354 field. Option fields are created by the @code{menu-choice} widget. In |
236 the example, @samp{@b{Choose}} is an option field tag. | 355 the example, @samp{@b{Choose}} is an option field tag. |
237 @item The @samp{@b{[INS]}} and @samp{@b{[DEL]}} buttons. | 356 @item The @samp{@b{[INS]}} and @samp{@b{[DEL]}} buttons |
238 Activating these will insert or delete elements from an editable list. | 357 Activating these will insert or delete elements from an editable list. |
239 The list is created by the @code{editable-list} widget. | 358 The list is created by the @code{editable-list} widget. |
240 @item Embedded Buttons. | 359 @cindex embedded buttons |
360 @item Embedded Buttons | |
241 The @samp{@b{_other work_}} is an example of an embedded | 361 The @samp{@b{_other work_}} is an example of an embedded |
242 button. Embedded buttons are not associated with a fields, but can serve | 362 button. Embedded buttons are not associated with any fields, but can serve |
243 any purpose, such as implementing hypertext references. They are | 363 any purpose, such as implementing hypertext references. They are |
244 usually created by the @code{link} widget. | 364 usually created by the @code{link} widget. |
245 @item The @samp{@b{[ ]}} and @samp{@b{[X]}} buttons. | 365 @item The @samp{@b{[ ]}} and @samp{@b{[X]}} buttons |
246 Activating one of these will convert it to the other. This is useful | 366 Activating one of these will convert it to the other. This is useful |
247 for implementing multiple-choice fields. You can create it wit | 367 for implementing multiple-choice fields. You can create them with the |
248 @item The @samp{@b{( )}} and @samp{@b{(*)}} buttons. | 368 @code{checkbox} widget. |
369 @item The @samp{@b{( )}} and @samp{@b{(*)}} buttons | |
249 Only one radio button in a @code{radio-button-choice} widget can be | 370 Only one radio button in a @code{radio-button-choice} widget can be |
250 selected at any time. When you invoke one of the unselected radio | 371 selected at any time. When you invoke one of the unselected radio |
251 buttons, it will be selected and the previous selected radio button will | 372 buttons, it will be selected and the previous selected radio button will |
252 become unselected. | 373 become unselected. |
253 @item The @samp{@b{[Apply Form]}} @samp{@b{[Reset Form]}} buttons. | 374 @item The @samp{@b{[Apply Form]}} and @samp{@b{[Reset Form]}} buttons |
254 These are explicit buttons made with the @code{push-button} widget. The main | 375 These are explicit buttons made with the @code{push-button} widget. The |
255 difference from the @code{link} widget is that the buttons are will be | 376 main difference from the @code{link} widget is that the buttons will be |
256 displayed as GUI buttons when possible. | 377 displayed as GUI buttons when possible. |
257 enough. | |
258 @end table | 378 @end table |
259 | 379 |
260 To make them easier to locate, buttons are emphasized in the buffer. | 380 To make them easier to locate, buttons are emphasized in the buffer. |
261 | 381 |
262 @deffn Face widget-button-face | 382 @deffn Face widget-button-face |
263 Face used for buttons. | 383 Face used for buttons. |
264 @end deffn | 384 @end deffn |
265 | 385 |
266 @defopt widget-mouse-face | 386 @defopt widget-mouse-face |
267 Face used for buttons when the mouse pointer is above it. | 387 Face used for highlighting a button when the mouse pointer moves across |
388 it. | |
268 @end defopt | 389 @end defopt |
269 | 390 |
270 @subsection Navigation | 391 @subsection Navigation |
271 | 392 |
272 You can use all the normal Emacs commands to move around in a form | 393 You can use all the normal Emacs commands to move around in a form |
275 @table @kbd | 396 @table @kbd |
276 @item @key{TAB} | 397 @item @key{TAB} |
277 @deffn Command widget-forward &optional count | 398 @deffn Command widget-forward &optional count |
278 Move point @var{count} buttons or editing fields forward. | 399 Move point @var{count} buttons or editing fields forward. |
279 @end deffn | 400 @end deffn |
280 @item @key{M-TAB} | 401 @item @kbd{M-@key{TAB}} |
402 @itemx @kbd{S-@key{TAB}} | |
281 @deffn Command widget-backward &optional count | 403 @deffn Command widget-backward &optional count |
282 Move point @var{count} buttons or editing fields backward. | 404 Move point @var{count} buttons or editing fields backward. |
283 @end deffn | 405 @end deffn |
284 @end table | 406 @end table |
285 | 407 |
286 @node Programming Example, Setting Up the Buffer, User Interface, Top | 408 @node Programming Example, Setting Up the Buffer, User Interface, Top |
287 @comment node-name, next, previous, up | 409 @comment node-name, next, previous, up |
288 @section Programming Example | 410 @section Programming Example |
289 | 411 |
290 Here is the code to implement the user interface example (see @ref{User | 412 @cindex widgets, programming example |
413 @cindex example of using widgets | |
414 Here is the code to implement the user interface example (@pxref{User | |
291 Interface}). | 415 Interface}). |
292 | 416 |
293 @lisp | 417 @lisp |
294 (require 'widget) | 418 (require 'widget) |
295 | 419 |
303 (interactive) | 427 (interactive) |
304 (kill-buffer (get-buffer-create "*Widget Example*")) | 428 (kill-buffer (get-buffer-create "*Widget Example*")) |
305 (switch-to-buffer (get-buffer-create "*Widget Example*")) | 429 (switch-to-buffer (get-buffer-create "*Widget Example*")) |
306 (kill-all-local-variables) | 430 (kill-all-local-variables) |
307 (make-local-variable 'widget-example-repeat) | 431 (make-local-variable 'widget-example-repeat) |
308 (widget-insert "Here is some documentation.\n\nName: ") | 432 (widget-insert "Here is some documentation.\n\n") |
309 (widget-create 'editable-field | 433 (widget-create 'editable-field |
310 :size 13 | 434 :size 13 |
311 "My Name") | 435 :format "Name: %v " ; Text after the field! |
436 "My Name") | |
312 (widget-create 'menu-choice | 437 (widget-create 'menu-choice |
313 :tag "Choose" | 438 :tag "Choose" |
314 :value "This" | 439 :value "This" |
315 :help-echo "Choose me, please!" | 440 :help-echo "Choose me, please!" |
316 :notify (lambda (widget &rest ignore) | 441 :notify (lambda (widget &rest ignore) |
317 (message "%s is a good choice!" | 442 (message "%s is a good choice!" |
318 (widget-value widget))) | 443 (widget-value widget))) |
319 '(item :tag "This option" :value "This") | 444 '(item :tag "This option" :value "This") |
320 '(choice-item "That option") | 445 '(choice-item "That option") |
321 '(editable-field :menu-tag "No option" "Thus option")) | 446 '(editable-field :menu-tag "No option" "Thus option")) |
322 (widget-insert "Address: ") | |
323 (widget-create 'editable-field | 447 (widget-create 'editable-field |
324 "Some Place\nIn some City\nSome country.") | 448 :format "Address: %v" |
449 "Some Place\nIn some City\nSome country.") | |
325 (widget-insert "\nSee also ") | 450 (widget-insert "\nSee also ") |
326 (widget-create 'link | 451 (widget-create 'link |
327 :notify (lambda (&rest ignore) | 452 :notify (lambda (&rest ignore) |
328 (widget-value-set widget-example-repeat | 453 (widget-value-set widget-example-repeat |
329 '("En" "To" "Tre")) | 454 '("En" "To" "Tre")) |
330 (widget-setup)) | 455 (widget-setup)) |
331 "other work") | 456 "other work") |
332 (widget-insert " for more information.\n\nNumbers: count to three below\n") | 457 (widget-insert |
458 " for more information.\n\nNumbers: count to three below\n") | |
333 (setq widget-example-repeat | 459 (setq widget-example-repeat |
334 (widget-create 'editable-list | 460 (widget-create 'editable-list |
335 :entry-format "%i %d %v" | 461 :entry-format "%i %d %v" |
336 :notify (lambda (widget &rest ignore) | 462 :notify (lambda (widget &rest ignore) |
337 (let ((old (widget-get widget | 463 (let ((old (widget-get widget |
357 (message "You selected %s" | 483 (message "You selected %s" |
358 (widget-value widget))) | 484 (widget-value widget))) |
359 '(item "One") '(item "Another One.") '(item "A Final One.")) | 485 '(item "One") '(item "Another One.") '(item "A Final One.")) |
360 (widget-insert "\n") | 486 (widget-insert "\n") |
361 (widget-create 'push-button | 487 (widget-create 'push-button |
362 :notify (lambda (&rest ignore) | 488 :notify (lambda (&rest ignore) |
363 (if (= (length (widget-value widget-example-repeat)) | 489 (if (= (length (widget-value widget-example-repeat)) |
364 3) | 490 3) |
365 (message "Congratulation!") | 491 (message "Congratulation!") |
366 (error "Three was the count!"))) | 492 (error "Three was the count!"))) |
367 "Apply Form") | 493 "Apply Form") |
368 (widget-insert " ") | 494 (widget-insert " ") |
369 (widget-create 'push-button | 495 (widget-create 'push-button |
370 :notify (lambda (&rest ignore) | 496 :notify (lambda (&rest ignore) |
371 (widget-example)) | 497 (widget-example)) |
372 "Reset Form") | 498 "Reset Form") |
395 | 521 |
396 @defun widget-delete widget | 522 @defun widget-delete widget |
397 Delete @var{widget} and remove it from the buffer. | 523 Delete @var{widget} and remove it from the buffer. |
398 @end defun | 524 @end defun |
399 | 525 |
400 @defun widget-setup | 526 @defun widget-setup |
401 Setup a buffer to support widgets. | 527 Set up a buffer to support widgets. |
402 | 528 |
403 This should be called after creating all the widgets and before allowing | 529 This should be called after creating all the widgets and before allowing |
404 the user to edit them. | 530 the user to edit them. |
405 @refill | 531 @refill |
406 @end defun | 532 @end defun |
407 | 533 |
408 If you want to insert text outside the widgets in the form, the | 534 If you want to insert text outside the widgets in the form, the |
409 recommended way to do that is with @code{widget-insert}. | 535 recommended way to do that is with @code{widget-insert}. |
410 | 536 |
411 @defun widget-insert | 537 @defun widget-insert |
412 Insert the arguments, either strings or characters, at point. | 538 Insert the arguments, either strings or characters, at point. |
413 The inserted text will be read only. | 539 The inserted text will be read-only. |
414 @end defun | 540 @end defun |
415 | 541 |
416 There is a standard widget keymap which you might find useful. | 542 There is a standard widget keymap which you might find useful. |
417 | 543 |
544 @findex widget-button-press | |
545 @findex widget-button-click | |
418 @defvr Const widget-keymap | 546 @defvr Const widget-keymap |
419 A keymap with the global keymap as its parent.@* | 547 A keymap with the global keymap as its parent.@* |
420 @key{TAB} and @kbd{C-@key{TAB}} are bound to @code{widget-forward} and | 548 @key{TAB} and @kbd{C-@key{TAB}} are bound to @code{widget-forward} and |
421 @code{widget-backward}, respectively. @kbd{@key{RET}} and @kbd{mouse-2} | 549 @code{widget-backward}, respectively. @key{RET} and @kbd{Mouse-2} |
422 are bound to @code{widget-button-press} and | 550 are bound to @code{widget-button-press} and |
423 @code{widget-button-}.@refill | 551 @code{widget-button-click}.@refill |
424 @end defvr | 552 @end defvr |
425 | 553 |
426 @defvar widget-global-map | 554 @defvar widget-global-map |
427 Keymap used by @code{widget-button-press} and @code{widget-button-click} | 555 Keymap used by @code{widget-button-press} and @code{widget-button-click} |
428 when not on a button. By default this is @code{global-map}. | 556 when not on a button. By default this is @code{global-map}. |
430 | 558 |
431 @node Basic Types, Sexp Types, Setting Up the Buffer, Top | 559 @node Basic Types, Sexp Types, Setting Up the Buffer, Top |
432 @comment node-name, next, previous, up | 560 @comment node-name, next, previous, up |
433 @section Basic Types | 561 @section Basic Types |
434 | 562 |
435 The syntax of a type specification is given below: | 563 This is the general syntax of a type specification: |
436 | 564 |
437 @example | 565 @example |
438 NAME ::= (NAME [KEYWORD ARGUMENT]... ARGS) | 566 @var{name} ::= (@var{name} [@var{keyword} @var{argument}]... @var{args}) |
439 | NAME | 567 | @var{name} |
440 @end example | 568 @end example |
441 | 569 |
442 where @var{name} is a widget name, @var{keyword} is the name of a | 570 where @var{name} is a widget name, @var{keyword} is the name of a |
443 property, @var{argument} is the value of the property, and @var{args} | 571 property, @var{argument} is the value of the property, and @var{args} |
444 are interpreted in a widget specific way. | 572 are interpreted in a widget specific way. |
445 | 573 |
446 There following keyword arguments that apply to all widgets: | 574 @cindex keyword arguments |
575 The following keyword arguments apply to all widgets: | |
447 | 576 |
448 @table @code | 577 @table @code |
578 @vindex value@r{ keyword} | |
449 @item :value | 579 @item :value |
450 The initial value for widgets of this type. | 580 The initial value for widgets of this type. |
451 | 581 |
582 @vindex format@r{ keyword} | |
452 @item :format | 583 @item :format |
453 This string will be inserted in the buffer when you create a widget. | 584 This string will be inserted in the buffer when you create a widget. |
454 The following @samp{%} escapes are available: | 585 The following @samp{%} escapes are available: |
455 | 586 |
456 @table @samp | 587 @table @samp |
457 @item %[ | 588 @item %[ |
458 @itemx %] | 589 @itemx %] |
459 The text inside will be marked as a button. | 590 The text inside will be marked as a button. |
460 | 591 |
461 By default, the text will be shown in @code{widget-button-face}, and | 592 By default, the text will be shown in @code{widget-button-face}, and |
462 surrounded by brackets. | 593 surrounded by brackets. |
463 | 594 |
464 @defopt widget-button-prefix | 595 @defopt widget-button-prefix |
465 String to prefix buttons. | 596 String to prefix buttons. |
466 @end defopt | 597 @end defopt |
467 | 598 |
475 @code{:sample-face}. | 606 @code{:sample-face}. |
476 | 607 |
477 @item %v | 608 @item %v |
478 This will be replaced with the buffer representation of the widget's | 609 This will be replaced with the buffer representation of the widget's |
479 value. What this is depends on the widget type. | 610 value. What this is depends on the widget type. |
611 | |
612 @strong{Warning:} In an @code{editable-field} widget, the @samp{%v} escape | |
613 must be preceded by some other text in the format string (if specified). | |
480 | 614 |
481 @item %d | 615 @item %d |
482 Insert the string specified by @code{:doc} here. | 616 Insert the string specified by @code{:doc} here. |
483 | 617 |
484 @item %h | 618 @item %h |
493 @item %t | 627 @item %t |
494 Insert the string specified by @code{:tag} here, or the @code{princ} | 628 Insert the string specified by @code{:tag} here, or the @code{princ} |
495 representation of the value if there is no tag. | 629 representation of the value if there is no tag. |
496 | 630 |
497 @item %% | 631 @item %% |
498 Insert a literal @samp{%}. | 632 Insert a literal @samp{%}. |
499 @end table | 633 @end table |
500 | 634 |
635 @vindex button-face@r{ keyword} | |
501 @item :button-face | 636 @item :button-face |
502 Face used to highlight text inside %[ %] in the format. | 637 Face used to highlight text inside %[ %] in the format. |
503 | 638 |
639 @vindex button-prefix@r{ keyword} | |
640 @vindex button-suffix@r{ keyword} | |
504 @item :button-prefix | 641 @item :button-prefix |
505 @itemx :button-suffix | 642 @itemx :button-suffix |
506 | |
507 Text around %[ %] in the format. | 643 Text around %[ %] in the format. |
508 | 644 |
509 These can be | 645 These can be |
510 @table @emph | 646 @table @emph |
511 @item nil | 647 @item nil |
516 | 652 |
517 @item a symbol | 653 @item a symbol |
518 The value of the symbol is expanded according to this table. | 654 The value of the symbol is expanded according to this table. |
519 @end table | 655 @end table |
520 | 656 |
657 @vindex doc@r{ keyword} | |
521 @item :doc | 658 @item :doc |
522 The string inserted by the @samp{%d} or @samp{%h} escape in the format | 659 The string inserted by the @samp{%d} or @samp{%h} escape in the format |
523 string. | 660 string. |
524 | 661 |
662 @vindex tag@r{ keyword} | |
525 @item :tag | 663 @item :tag |
526 The string inserted by the @samp{%t} escape in the format | 664 The string inserted by the @samp{%t} escape in the format |
527 string. | 665 string. |
528 | 666 |
667 @vindex tag-glyph@r{ keyword} | |
529 @item :tag-glyph | 668 @item :tag-glyph |
530 Name of image to use instead of the string specified by `:tag' on | 669 Name of image to use instead of the string specified by @code{:tag} on |
531 Emacsen that supports it. | 670 Emacsen that supports it. |
532 | 671 |
672 @vindex help-echo@r{ keyword} | |
533 @item :help-echo | 673 @item :help-echo |
534 Message displayed whenever you move to the widget with either | 674 Specifies how to display a message whenever you move to the widget with |
535 @code{widget-forward} or @code{widget-backward}. | 675 either @code{widget-forward} or @code{widget-backward} or move the mouse |
536 | 676 over it (using the standard @code{help-echo} mechanism). The argument |
677 is either a string to display, a function of one argument, the widget, | |
678 which should return a string to display, or a form that evaluates to | |
679 such a string. | |
680 | |
681 @vindex follow-link@r{ keyword} | |
682 @item :follow-link | |
683 Specifies how to interpret a @key{mouse-1} click on the widget. | |
684 @xref{Clickable Text,, Defining Clickable Text, elisp, the Emacs Lisp Reference Manual}. | |
685 | |
686 @vindex indent@r{ keyword} | |
537 @item :indent | 687 @item :indent |
538 An integer indicating the absolute number of spaces to indent children | 688 An integer indicating the absolute number of spaces to indent children |
539 of this widget. | 689 of this widget. |
540 | 690 |
691 @vindex offset@r{ keyword} | |
541 @item :offset | 692 @item :offset |
542 An integer indicating how many extra spaces to add to the widget's | 693 An integer indicating how many extra spaces to add to the widget's |
543 grandchildren compared to this widget. | 694 grandchildren compared to this widget. |
544 | 695 |
696 @vindex extra-offset@r{ keyword} | |
545 @item :extra-offset | 697 @item :extra-offset |
546 An integer indicating how many extra spaces to add to the widget's | 698 An integer indicating how many extra spaces to add to the widget's |
547 children compared to this widget. | 699 children compared to this widget. |
548 | 700 |
701 @vindex notify@r{ keyword} | |
549 @item :notify | 702 @item :notify |
550 A function called each time the widget or a nested widget is changed. | 703 A function called each time the widget or a nested widget is changed. |
551 The function is called with two or three arguments. The first argument | 704 The function is called with two or three arguments. The first argument |
552 is the widget itself, the second argument is the widget that was | 705 is the widget itself, the second argument is the widget that was |
553 changed, and the third argument is the event leading to the change, if | 706 changed, and the third argument is the event leading to the change, if |
554 any. In editable fields, this includes all insertions, deletions, | 707 any. In editable fields, this includes all insertions, deletions, |
555 @emph{etc}. To watch only for ``final'' actions, redefine the | 708 @emph{etc}. To watch only for ``final'' actions, redefine the |
556 @code{:action} callback. | 709 @code{:action} callback. |
557 | 710 |
711 @vindex menu-tag@r{ keyword} | |
558 @item :menu-tag | 712 @item :menu-tag |
559 Tag used in the menu when the widget is used as an option in a | 713 Tag used in the menu when the widget is used as an option in a |
560 @code{menu-choice} widget. | 714 @code{menu-choice} widget. |
561 | 715 |
716 @vindex menu-tag-get@r{ keyword} | |
562 @item :menu-tag-get | 717 @item :menu-tag-get |
563 Function used for finding the tag when the widget is used as an option | 718 Function used for finding the tag when the widget is used as an option |
564 in a @code{menu-choice} widget. By default, the tag used will be either the | 719 in a @code{menu-choice} widget. By default, the tag used will be either the |
565 @code{:menu-tag} or @code{:tag} property if present, or the @code{princ} | 720 @code{:menu-tag} or @code{:tag} property if present, or the @code{princ} |
566 representation of the @code{:value} property if not. | 721 representation of the @code{:value} property if not. |
567 | 722 |
723 @vindex match@r{ keyword} | |
568 @item :match | 724 @item :match |
569 Should be a function called with two arguments, the widget and a value, | 725 Should be a function called with two arguments, the widget and a value, |
570 and returning non-nil if the widget can represent the specified value. | 726 and returning non-@code{nil} if the widget can represent the specified value. |
571 | 727 |
728 @vindex validate@r{ keyword} | |
572 @item :validate | 729 @item :validate |
573 A function which takes a widget as an argument, and returns nil if the | 730 A function which takes a widget as an argument, and returns @code{nil} |
574 widget's current value is valid for the widget. Otherwise it should | 731 if the widget's current value is valid for the widget. Otherwise it |
575 return the widget containing the invalid data, and set that widget's | 732 should return the widget containing the invalid data, and set that |
576 @code{:error} property to a string explaining the error. | 733 widget's @code{:error} property to a string explaining the error. |
577 | 734 |
578 The following predefined function can be used: | 735 The following predefined function can be used: |
579 | 736 |
580 @defun widget-children-validate widget | 737 @defun widget-children-validate widget |
581 All the @code{:children} of @var{widget} must be valid. | 738 All the @code{:children} of @var{widget} must be valid. |
582 @end defun | 739 @end defun |
583 | 740 |
741 @vindex tab-order@r{ keyword} | |
584 @item :tab-order | 742 @item :tab-order |
585 Specify the order in which widgets are traversed with | 743 Specify the order in which widgets are traversed with |
586 @code{widget-forward} or @code{widget-backward}. This is only partially | 744 @code{widget-forward} or @code{widget-backward}. This is only partially |
587 implemented. | 745 implemented. |
588 | 746 |
589 @enumerate a | 747 @enumerate a |
590 @item | 748 @item |
591 Widgets with tabbing order @code{-1} are ignored. | 749 Widgets with tabbing order @code{-1} are ignored. |
592 | 750 |
593 @item | 751 @item |
594 (Unimplemented) When on a widget with tabbing order @var{n}, go to the | 752 (Unimplemented) When on a widget with tabbing order @var{n}, go to the |
595 next widget in the buffer with tabbing order @var{n+1} or @code{nil}, | 753 next widget in the buffer with tabbing order @var{n+1} or @code{nil}, |
596 whichever comes first. | 754 whichever comes first. |
597 | 755 |
598 @item | 756 @item |
599 When on a widget with no tabbing order specified, go to the next widget | 757 When on a widget with no tabbing order specified, go to the next widget |
600 in the buffer with a positive tabbing order, or @code{nil} | 758 in the buffer with a positive tabbing order, or @code{nil} |
601 @end enumerate | 759 @end enumerate |
602 | 760 |
761 @vindex parent@r{ keyword} | |
603 @item :parent | 762 @item :parent |
604 The parent of a nested widget (e.g. a @code{menu-choice} item or an | 763 The parent of a nested widget (e.g.@: a @code{menu-choice} item or an |
605 element of an @code{editable-list} widget). | 764 element of an @code{editable-list} widget). |
606 | 765 |
766 @vindex sibling-args@r{ keyword} | |
607 @item :sibling-args | 767 @item :sibling-args |
608 This keyword is only used for members of a @code{radio-button-choice} or | 768 This keyword is only used for members of a @code{radio-button-choice} or |
609 @code{checklist}. The value should be a list of extra keyword | 769 @code{checklist}. The value should be a list of extra keyword |
610 arguments, which will be used when creating the @code{radio-button} or | 770 arguments, which will be used when creating the @code{radio-button} or |
611 @code{checkbox} associated with this item. | 771 @code{checkbox} associated with this item. |
612 | 772 |
613 @end table | 773 @end table |
614 | 774 |
615 @deffn {User Option} widget-glyph-directory | 775 @deffn {User Option} widget-glyph-directory |
616 Directory where glyphs are found. | 776 Directory where glyphs are found. |
617 Widget will look here for a file with the same name as specified for the | 777 Widget will look here for a file with the same name as specified for the |
618 image, with either a @samp{.xpm} (if supported) or @samp{.xbm} extension. | 778 image, with either a @file{.xpm} (if supported) or @file{.xbm} extension. |
619 @end deffn | 779 @end deffn |
620 | 780 |
621 @deffn{User Option} widget-glyph-enable | 781 @deffn{User Option} widget-glyph-enable |
622 If non-nil, allow glyphs to appear on displays where they are supported. | 782 If non-@code{nil}, allow glyphs to appear on displays where they are supported. |
623 @end deffn | 783 @end deffn |
624 | 784 |
625 | 785 |
626 @menu | 786 @menu |
627 * link:: | 787 * link:: |
642 @end menu | 802 @end menu |
643 | 803 |
644 @node link, url-link, Basic Types, Basic Types | 804 @node link, url-link, Basic Types, Basic Types |
645 @comment node-name, next, previous, up | 805 @comment node-name, next, previous, up |
646 @subsection The @code{link} Widget | 806 @subsection The @code{link} Widget |
807 @findex link@r{ widget} | |
647 | 808 |
648 Syntax: | 809 Syntax: |
649 | 810 |
650 @example | 811 @example |
651 TYPE ::= (link [KEYWORD ARGUMENT]... [ VALUE ]) | 812 @var{type} ::= (link [@var{keyword} @var{argument}]... [ @var{value} ]) |
652 @end example | 813 @end example |
653 | 814 |
654 The @var{value}, if present, is used to initialize the @code{:value} | 815 The @var{value}, if present, is used to initialize the @code{:value} |
655 property. The value should be a string, which will be inserted in the | 816 property. The value should be a string, which will be inserted in the |
656 buffer. | 817 buffer. |
657 | 818 |
658 By default the link will be shown in brackets. | 819 By default the link will be shown in brackets. |
659 | 820 |
660 @defopt widget-link-prefix | 821 @defopt widget-link-prefix |
661 String to prefix links. | 822 String to prefix links. |
666 @end defopt | 827 @end defopt |
667 | 828 |
668 @node url-link, info-link, link, Basic Types | 829 @node url-link, info-link, link, Basic Types |
669 @comment node-name, next, previous, up | 830 @comment node-name, next, previous, up |
670 @subsection The @code{url-link} Widget | 831 @subsection The @code{url-link} Widget |
832 @findex url-link@r{ widget} | |
671 | 833 |
672 Syntax: | 834 Syntax: |
673 | 835 |
674 @example | 836 @example |
675 TYPE ::= (url-link [KEYWORD ARGUMENT]... URL) | 837 @var{type} ::= (url-link [@var{keyword} @var{argument}]... @var{url}) |
676 @end example | 838 @end example |
677 | 839 |
678 When this link is invoked, the @sc{www} browser specified by | 840 @findex browse-url-browser-function@r{, and @code{url-link} widget} |
679 @code{browse-url-browser-function} will be called with @var{url}. | 841 When this link is invoked, the @acronym{WWW} browser specified by |
842 @code{browse-url-browser-function} will be called with @var{url}. | |
680 | 843 |
681 @node info-link, push-button, url-link, Basic Types | 844 @node info-link, push-button, url-link, Basic Types |
682 @comment node-name, next, previous, up | 845 @comment node-name, next, previous, up |
683 @subsection The @code{info-link} Widget | 846 @subsection The @code{info-link} Widget |
847 @findex info-link@r{ widget} | |
684 | 848 |
685 Syntax: | 849 Syntax: |
686 | 850 |
687 @example | 851 @example |
688 TYPE ::= (info-link [KEYWORD ARGUMENT]... ADDRESS) | 852 @var{type} ::= (info-link [@var{keyword} @var{argument}]... @var{address}) |
689 @end example | 853 @end example |
690 | 854 |
691 When this link is invoked, the built-in info browser is started on | 855 When this link is invoked, the built-in Info reader is started on |
692 @var{address}. | 856 @var{address}. |
693 | 857 |
694 @node push-button, editable-field, info-link, Basic Types | 858 @node push-button, editable-field, info-link, Basic Types |
695 @comment node-name, next, previous, up | 859 @comment node-name, next, previous, up |
696 @subsection The @code{push-button} Widget | 860 @subsection The @code{push-button} Widget |
861 @findex push-button@r{ widget} | |
697 | 862 |
698 Syntax: | 863 Syntax: |
699 | 864 |
700 @example | 865 @example |
701 TYPE ::= (push-button [KEYWORD ARGUMENT]... [ VALUE ]) | 866 @var{type} ::= (push-button [@var{keyword} @var{argument}]... [ @var{value} ]) |
702 @end example | 867 @end example |
703 | 868 |
704 The @var{value}, if present, is used to initialize the @code{:value} | 869 The @var{value}, if present, is used to initialize the @code{:value} |
705 property. The value should be a string, which will be inserted in the | 870 property. The value should be a string, which will be inserted in the |
706 buffer. | 871 buffer. |
707 | 872 |
708 By default the tag will be shown in brackets. | 873 By default the tag will be shown in brackets. |
709 | 874 |
710 @defopt widget-push-button-prefix | 875 @defopt widget-push-button-prefix |
711 String to prefix push buttons. | 876 String to prefix push buttons. |
716 @end defopt | 881 @end defopt |
717 | 882 |
718 @node editable-field, text, push-button, Basic Types | 883 @node editable-field, text, push-button, Basic Types |
719 @comment node-name, next, previous, up | 884 @comment node-name, next, previous, up |
720 @subsection The @code{editable-field} Widget | 885 @subsection The @code{editable-field} Widget |
886 @findex editable-field@r{ widget} | |
721 | 887 |
722 Syntax: | 888 Syntax: |
723 | 889 |
724 @example | 890 @example |
725 TYPE ::= (editable-field [KEYWORD ARGUMENT]... [ VALUE ]) | 891 @var{type} ::= (editable-field [@var{keyword} @var{argument}]... [ @var{value} ]) |
726 @end example | 892 @end example |
727 | 893 |
728 The @var{value}, if present, is used to initialize the @code{:value} | 894 The @var{value}, if present, is used to initialize the @code{:value} |
729 property. The value should be a string, which will be inserted in | 895 property. The value should be a string, which will be inserted in the |
730 field. This widget will match all string values. | 896 field. This widget will match all string values. |
731 | 897 |
732 The following extra properties are recognized. | 898 The following extra properties are recognized: |
733 | 899 |
734 @table @code | 900 @table @code |
901 @vindex size@r{ keyword} | |
735 @item :size | 902 @item :size |
736 The minimum width of the editable field.@* | 903 The minimum width of the editable field.@* |
737 By default the field will reach to the end of the line. If the | 904 By default the field will reach to the end of the line. If the |
738 content is too large, the displayed representation will expand to | 905 content is too large, the displayed representation will expand to |
739 contain it. The content is not truncated to size. | 906 contain it. The content is not truncated to size. |
740 | 907 |
908 @vindex value-face@r{ keyword} | |
741 @item :value-face | 909 @item :value-face |
742 Face used for highlighting the editable field. Default is | 910 Face used for highlighting the editable field. Default is |
743 @code{widget-field-face}. | 911 @code{widget-field-face}, see @ref{User Interface}. |
744 | 912 |
913 @vindex secret@r{ keyword} | |
745 @item :secret | 914 @item :secret |
746 Character used to display the value. You can set this to e.g. @code{?*} | 915 Character used to display the value. You can set this to e.g.@: @code{?*} |
747 if the field contains a password or other secret information. By | 916 if the field contains a password or other secret information. By |
748 default, the value is not secret. | 917 default, this is @code{nil}, and the value is not secret. |
749 | 918 |
919 @vindex valid-regexp@r{ keyword} | |
750 @item :valid-regexp | 920 @item :valid-regexp |
751 By default the @code{:validate} function will match the content of the | 921 By default the @code{:validate} function will match the content of the |
752 field with the value of this attribute. The default value is @code{""} | 922 field with the value of this attribute. The default value is @code{""} |
753 which matches everything. | 923 which matches everything. |
754 | 924 |
925 @vindex keymap@r{ keyword} | |
926 @vindex widget-field-keymap | |
755 @item :keymap | 927 @item :keymap |
756 Keymap used in the editable field. The default value is | 928 Keymap used in the editable field. The default value is |
757 @code{widget-field-keymap}, which allows you to use all the normal | 929 @code{widget-field-keymap}, which allows you to use all the normal |
758 editing commands, even if the buffer's major mode suppress some of them. | 930 editing commands, even if the buffer's major mode suppresses some of |
759 Pressing return invokes the function specified by @code{:action}. | 931 them. Pressing @key{RET} invokes the function specified by |
932 @code{:action}. | |
760 @end table | 933 @end table |
761 | 934 |
762 @node text, menu-choice, editable-field, Basic Types | 935 @node text, menu-choice, editable-field, Basic Types |
763 @comment node-name, next, previous, up | 936 @comment node-name, next, previous, up |
764 @subsection The @code{text} Widget | 937 @subsection The @code{text} Widget |
765 | 938 @findex text@r{ widget} |
939 | |
940 @vindex widget-text-keymap | |
766 This is just like @code{editable-field}, but intended for multiline text | 941 This is just like @code{editable-field}, but intended for multiline text |
767 fields. The default @code{:keymap} is @code{widget-text-keymap}, which | 942 fields. The default @code{:keymap} is @code{widget-text-keymap}, which |
768 does not rebind the return key. | 943 does not rebind the @key{RET} key. |
769 | 944 |
770 @node menu-choice, radio-button-choice, text, Basic Types | 945 @node menu-choice, radio-button-choice, text, Basic Types |
771 @comment node-name, next, previous, up | 946 @comment node-name, next, previous, up |
772 @subsection The @code{menu-choice} Widget | 947 @subsection The @code{menu-choice} Widget |
948 @findex menu-choice@r{ widget} | |
773 | 949 |
774 Syntax: | 950 Syntax: |
775 | 951 |
776 @example | 952 @example |
777 TYPE ::= (menu-choice [KEYWORD ARGUMENT]... TYPE ... ) | 953 @var{type} ::= (menu-choice [@var{keyword} @var{argument}]... @var{type} ... ) |
778 @end example | 954 @end example |
779 | 955 |
780 The @var{type} argument represents each possible choice. The widget's | 956 The @var{type} argument represents each possible choice. The widget's |
781 value will be that of the chosen @var{type} argument. This widget will | 957 value will be that of the chosen @var{type} argument. This widget will |
782 match any value matching at least one of the specified @var{type} | 958 match any value matching at least one of the specified @var{type} |
783 arguments. | 959 arguments. |
784 | 960 |
785 @table @code | 961 @table @code |
786 @item :void | 962 @vindex void@r{ keyword} |
963 @item :void | |
787 Widget type used as a fallback when the value does not match any of the | 964 Widget type used as a fallback when the value does not match any of the |
788 specified @var{type} arguments. | 965 specified @var{type} arguments. |
789 | 966 |
967 @vindex case-fold@r{ keyword} | |
790 @item :case-fold | 968 @item :case-fold |
791 Set this to nil if you don't want to ignore case when prompting for a | 969 Set this to @code{nil} if you don't want to ignore case when prompting for a |
792 choice through the minibuffer. | 970 choice through the minibuffer. |
793 | 971 |
972 @vindex children@r{ keyword} | |
794 @item :children | 973 @item :children |
795 A list whose car is the widget representing the currently chosen type in | 974 A list whose @sc{car} is the widget representing the currently chosen |
796 the buffer. | 975 type in the buffer. |
797 | 976 |
977 @vindex choice@r{ keyword} | |
798 @item :choice | 978 @item :choice |
799 The current chosen type | 979 The current chosen type. |
800 | 980 |
801 @item :args | 981 @vindex args@r{ keyword} |
802 The list of types. | 982 @item :args |
983 The list of types. | |
803 @end table | 984 @end table |
804 | 985 |
805 @node radio-button-choice, item, menu-choice, Basic Types | 986 @node radio-button-choice, item, menu-choice, Basic Types |
806 @comment node-name, next, previous, up | 987 @comment node-name, next, previous, up |
807 @subsection The @code{radio-button-choice} Widget | 988 @subsection The @code{radio-button-choice} Widget |
989 @findex radio-button-choice@r{ widget} | |
808 | 990 |
809 Syntax: | 991 Syntax: |
810 | 992 |
811 @example | 993 @example |
812 TYPE ::= (radio-button-choice [KEYWORD ARGUMENT]... TYPE ... ) | 994 @var{type} ::= (radio-button-choice [@var{keyword} @var{argument}]... @var{type} ... ) |
813 @end example | 995 @end example |
814 | 996 |
815 The @var{type} argument represents each possible choice. The widget's | 997 The component types specify the choices, with one radio button for |
816 value will be that of the chosen @var{type} argument. This widget will | 998 each. The widget's value will be that of the chosen @var{type} |
817 match any value matching at least one of the specified @var{type} | 999 argument. This widget matches any value that matches at least one of |
818 arguments. | 1000 the specified @var{type} arguments. |
819 | 1001 |
820 The following extra properties are recognized. | 1002 The following extra properties are recognized. |
821 | 1003 |
822 @table @code | 1004 @table @code |
1005 @vindex entry-format@r{ keyword} | |
823 @item :entry-format | 1006 @item :entry-format |
824 This string will be inserted for each entry in the list. | 1007 This string will be inserted for each entry in the list. |
825 The following @samp{%} escapes are available: | 1008 The following @samp{%} escapes are available: |
826 @table @samp | 1009 @table @samp |
827 @item %v | 1010 @item %v |
828 Replaced with the buffer representation of the @var{type} widget. | 1011 Replace with the buffer representation of the @var{type} widget. |
829 @item %b | 1012 @item %b |
830 Replace with the radio button. | 1013 Replace with the radio button. |
831 @item %% | 1014 @item %% |
832 Insert a literal @samp{%}. | 1015 Insert a literal @samp{%}. |
833 @end table | 1016 @end table |
834 | 1017 |
835 @item button-args | 1018 @vindex button-args@r{ keyword} |
1019 @item :button-args | |
836 A list of keywords to pass to the radio buttons. Useful for setting | 1020 A list of keywords to pass to the radio buttons. Useful for setting |
837 e.g. the @samp{:help-echo} for each button. | 1021 e.g.@: the @samp{:help-echo} for each button. |
838 | 1022 |
1023 @vindex buttons@r{ keyword} | |
839 @item :buttons | 1024 @item :buttons |
840 The widgets representing the radio buttons. | 1025 The widgets representing the radio buttons. |
841 | 1026 |
1027 @vindex children@r{ keyword} | |
842 @item :children | 1028 @item :children |
843 The widgets representing each type. | 1029 The widgets representing each type. |
844 | 1030 |
1031 @vindex choice@r{ keyword} | |
845 @item :choice | 1032 @item :choice |
846 The current chosen type | 1033 The current chosen type |
847 | 1034 |
848 @item :args | 1035 @vindex args@r{ keyword} |
849 The list of types. | 1036 @item :args |
1037 The list of types. | |
850 @end table | 1038 @end table |
851 | 1039 |
852 You can add extra radio button items to a @code{radio-button-choice} | 1040 You can add extra radio button items to a @code{radio-button-choice} |
853 widget after it has been created with the function | 1041 widget after it has been created with the function |
854 @code{widget-radio-add-item}. | 1042 @code{widget-radio-add-item}. |
855 | 1043 |
856 @defun widget-radio-add-item widget type | 1044 @defun widget-radio-add-item widget type |
857 Add to @code{radio-button-choice} widget @var{widget} a new radio button item of type | 1045 Add to @code{radio-button-choice} widget @var{widget} a new radio button |
858 @var{type}. | 1046 item of type @var{type}. |
859 @end defun | 1047 @end defun |
860 | 1048 |
861 Please note that such items added after the @code{radio-button-choice} | 1049 Please note that such items added after the @code{radio-button-choice} |
862 widget has been created will @strong{not} be properly destructed when | 1050 widget has been created will @strong{not} be properly destructed when |
863 you call @code{widget-delete}. | 1051 you call @code{widget-delete}. |
864 | 1052 |
865 @node item, choice-item, radio-button-choice, Basic Types | 1053 @node item, choice-item, radio-button-choice, Basic Types |
866 @comment node-name, next, previous, up | 1054 @comment node-name, next, previous, up |
867 @subsection The @code{item} Widget | 1055 @subsection The @code{item} Widget |
1056 @findex item@r{ widget} | |
868 | 1057 |
869 Syntax: | 1058 Syntax: |
870 | 1059 |
871 @example | 1060 @example |
872 ITEM ::= (item [KEYWORD ARGUMENT]... VALUE) | 1061 @var{item} ::= (item [@var{keyword} @var{argument}]... @var{value}) |
873 @end example | 1062 @end example |
874 | 1063 |
875 The @var{value}, if present, is used to initialize the @code{:value} | 1064 The @var{value}, if present, is used to initialize the @code{:value} |
876 property. The value should be a string, which will be inserted in the | 1065 property. The value should be a string, which will be inserted in the |
877 buffer. This widget will only match the specified value. | 1066 buffer. This widget will only match the specified value. |
878 | 1067 |
879 @node choice-item, toggle, item, Basic Types | 1068 @node choice-item, toggle, item, Basic Types |
880 @comment node-name, next, previous, up | 1069 @comment node-name, next, previous, up |
881 @subsection The @code{choice-item} Widget | 1070 @subsection The @code{choice-item} Widget |
1071 @findex choice-item@r{ widget} | |
882 | 1072 |
883 Syntax: | 1073 Syntax: |
884 | 1074 |
885 @example | 1075 @example |
886 ITEM ::= (choice-item [KEYWORD ARGUMENT]... VALUE) | 1076 @var{item} ::= (choice-item [@var{keyword} @var{argument}]... @var{value}) |
887 @end example | 1077 @end example |
888 | 1078 |
889 The @var{value}, if present, is used to initialize the @code{:value} | 1079 The @var{value}, if present, is used to initialize the @code{:value} |
890 property. The value should be a string, which will be inserted in the | 1080 property. The value should be a string, which will be inserted in the |
891 buffer as a button. Activating the button of a @code{choice-item} is | 1081 buffer as a button. Activating the button of a @code{choice-item} is |
892 equivalent to activating the parent widget. This widget will only match | 1082 equivalent to activating the parent widget. This widget will only match |
893 the specified value. | 1083 the specified value. |
894 | 1084 |
895 @node toggle, checkbox, choice-item, Basic Types | 1085 @node toggle, checkbox, choice-item, Basic Types |
896 @comment node-name, next, previous, up | 1086 @comment node-name, next, previous, up |
897 @subsection The @code{toggle} Widget | 1087 @subsection The @code{toggle} Widget |
1088 @findex toggle@r{ widget} | |
898 | 1089 |
899 Syntax: | 1090 Syntax: |
900 | 1091 |
901 @example | 1092 @example |
902 TYPE ::= (toggle [KEYWORD ARGUMENT]...) | 1093 @var{type} ::= (toggle [@var{keyword} @var{argument}]...) |
903 @end example | 1094 @end example |
904 | 1095 |
905 The widget has two possible states, `on' and `off', which correspond to | 1096 The widget has two possible states, @samp{on} and @samp{off}, which |
906 a @code{t} or @code{nil} value respectively. | 1097 correspond to a @code{t} or @code{nil} value, respectively. |
907 | 1098 |
908 The following extra properties are recognized. | 1099 The following extra properties are recognized: |
909 | 1100 |
910 @table @code | 1101 @table @code |
911 @item :on | 1102 @item :on |
912 String representing the `on' state. By default the string @samp{on}. | 1103 A string representing the @samp{on} state. By default the string |
913 @item :off | 1104 @samp{on}. |
914 String representing the `off' state. By default the string @samp{off}. | 1105 @item :off |
1106 A string representing the @samp{off} state. By default the string | |
1107 @samp{off}. | |
1108 @vindex on-glyph@r{ keyword} | |
915 @item :on-glyph | 1109 @item :on-glyph |
916 Name of a glyph to be used instead of the `:on' text string, on emacsen | 1110 Name of a glyph to be used instead of the @samp{:on} text string, on |
917 that supports it. | 1111 emacsen that supports this. |
1112 @vindex off-glyph@r{ keyword} | |
918 @item :off-glyph | 1113 @item :off-glyph |
919 Name of a glyph to be used instead of the `:off' text string, on emacsen | 1114 Name of a glyph to be used instead of the @samp{:off} text string, on |
920 that supports it. | 1115 emacsen that supports this. |
921 @end table | 1116 @end table |
922 | 1117 |
923 @node checkbox, checklist, toggle, Basic Types | 1118 @node checkbox, checklist, toggle, Basic Types |
924 @comment node-name, next, previous, up | 1119 @comment node-name, next, previous, up |
925 @subsection The @code{checkbox} Widget | 1120 @subsection The @code{checkbox} Widget |
926 | 1121 @findex checkbox@r{ widget} |
927 The widget has two possible states, `selected' and `unselected', which | 1122 |
928 corresponds to a @code{t} or @code{nil} value. | 1123 This widget has two possible states, @samp{selected} and |
1124 @samp{unselected}, which corresponds to a @code{t} or @code{nil} value. | |
929 | 1125 |
930 Syntax: | 1126 Syntax: |
931 | 1127 |
932 @example | 1128 @example |
933 TYPE ::= (checkbox [KEYWORD ARGUMENT]...) | 1129 @var{type} ::= (checkbox [@var{keyword} @var{argument}]...) |
934 @end example | 1130 @end example |
935 | 1131 |
936 @node checklist, editable-list, checkbox, Basic Types | 1132 @node checklist, editable-list, checkbox, Basic Types |
937 @comment node-name, next, previous, up | 1133 @comment node-name, next, previous, up |
938 @subsection The @code{checklist} Widget | 1134 @subsection The @code{checklist} Widget |
1135 @findex checklist@r{ widget} | |
939 | 1136 |
940 Syntax: | 1137 Syntax: |
941 | 1138 |
942 @example | 1139 @example |
943 TYPE ::= (checklist [KEYWORD ARGUMENT]... TYPE ... ) | 1140 @var{type} ::= (checklist [@var{keyword} @var{argument}]... @var{type} ... ) |
944 @end example | 1141 @end example |
945 | 1142 |
946 The @var{type} arguments represents each checklist item. The widget's | 1143 The @var{type} arguments represent each checklist item. The widget's |
947 value will be a list containing the values of all ticked @var{type} | 1144 value will be a list containing the values of all checked @var{type} |
948 arguments. The checklist widget will match a list whose elements all | 1145 arguments. The checklist widget will match a list whose elements all |
949 match at least one of the specified @var{type} arguments. | 1146 match at least one of the specified @var{type} arguments. |
950 | 1147 |
951 The following extra properties are recognized. | 1148 The following extra properties are recognized: |
952 | 1149 |
953 @table @code | 1150 @table @code |
1151 @vindex entry-format@r{ keyword} | |
954 @item :entry-format | 1152 @item :entry-format |
955 This string will be inserted for each entry in the list. | 1153 This string will be inserted for each entry in the list. |
956 The following @samp{%} escapes are available: | 1154 The following @samp{%} escapes are available: |
957 @table @samp | 1155 @table @samp |
958 @item %v | 1156 @item %v |
959 Replaced with the buffer representation of the @var{type} widget. | 1157 Replaced with the buffer representation of the @var{type} widget. |
960 @item %b | 1158 @item %b |
961 Replace with the checkbox. | 1159 Replace with the checkbox. |
962 @item %% | 1160 @item %% |
963 Insert a literal @samp{%}. | 1161 Insert a literal @samp{%}. |
964 @end table | 1162 @end table |
965 | 1163 |
1164 @vindex greedy@r{ keyword} | |
966 @item :greedy | 1165 @item :greedy |
967 Usually a checklist will only match if the items are in the exact | 1166 Usually a checklist will only match if the items are in the exact |
968 sequence given in the specification. By setting @code{:greedy} to | 1167 sequence given in the specification. By setting @code{:greedy} to |
969 non-nil, it will allow the items to appear in any sequence. However, if | 1168 non-@code{nil}, it will allow the items to appear in any sequence. |
970 you extract the values they will be in the sequence given in the | 1169 However, if you extract the value they will be in the sequence given |
971 checklist. I.e. the original sequence is forgotten. | 1170 in the checklist, i.e.@: the original sequence is forgotten. |
972 | 1171 |
973 @item button-args | 1172 @vindex button-args@r{ keyword} |
1173 @item :button-args | |
974 A list of keywords to pass to the checkboxes. Useful for setting | 1174 A list of keywords to pass to the checkboxes. Useful for setting |
975 e.g. the @samp{:help-echo} for each checkbox. | 1175 e.g.@: the @samp{:help-echo} for each checkbox. |
976 | 1176 |
1177 @vindex buttons@r{ keyword} | |
977 @item :buttons | 1178 @item :buttons |
978 The widgets representing the checkboxes. | 1179 The widgets representing the checkboxes. |
979 | 1180 |
1181 @vindex children@r{ keyword} | |
980 @item :children | 1182 @item :children |
981 The widgets representing each type. | 1183 The widgets representing each type. |
982 | 1184 |
983 @item :args | 1185 @vindex args@r{ keyword} |
984 The list of types. | 1186 @item :args |
1187 The list of types. | |
985 @end table | 1188 @end table |
986 | 1189 |
987 @node editable-list, group, checklist, Basic Types | 1190 @node editable-list, group, checklist, Basic Types |
988 @comment node-name, next, previous, up | 1191 @comment node-name, next, previous, up |
989 @subsection The @code{editable-list} Widget | 1192 @subsection The @code{editable-list} Widget |
1193 @findex editable-list@r{ widget} | |
990 | 1194 |
991 Syntax: | 1195 Syntax: |
992 | 1196 |
993 @example | 1197 @example |
994 TYPE ::= (editable-list [KEYWORD ARGUMENT]... TYPE) | 1198 @var{type} ::= (editable-list [@var{keyword} @var{argument}]... @var{type}) |
995 @end example | 1199 @end example |
996 | 1200 |
997 The value is a list, where each member represents one widget of type | 1201 The value is a list, where each member represents one widget of type |
998 @var{type}. | 1202 @var{type}. |
999 | 1203 |
1000 The following extra properties are recognized. | 1204 The following extra properties are recognized: |
1001 | 1205 |
1002 @table @code | 1206 @table @code |
1207 @vindex entry-format@r{ keyword} | |
1003 @item :entry-format | 1208 @item :entry-format |
1004 This string will be inserted for each entry in the list. | 1209 This string will be inserted for each entry in the list. |
1005 The following @samp{%} escapes are available: | 1210 The following @samp{%} escapes are available: |
1006 @table @samp | 1211 @table @samp |
1007 @item %v | 1212 @item %v |
1010 @item %i | 1215 @item %i |
1011 Insert the @b{[INS]} button. | 1216 Insert the @b{[INS]} button. |
1012 @item %d | 1217 @item %d |
1013 Insert the @b{[DEL]} button. | 1218 Insert the @b{[DEL]} button. |
1014 @item %% | 1219 @item %% |
1015 Insert a literal @samp{%}. | 1220 Insert a literal @samp{%}. |
1016 @end table | 1221 @end table |
1017 | 1222 |
1223 @vindex insert-button-args@r{ keyword} | |
1018 @item :insert-button-args | 1224 @item :insert-button-args |
1019 A list of keyword arguments to pass to the insert buttons. | 1225 A list of keyword arguments to pass to the insert buttons. |
1020 | 1226 |
1227 @vindex delete-button-args@r{ keyword} | |
1021 @item :delete-button-args | 1228 @item :delete-button-args |
1022 A list of keyword arguments to pass to the delete buttons. | 1229 A list of keyword arguments to pass to the delete buttons. |
1023 | 1230 |
1231 @vindex append-button-args@r{ keyword} | |
1024 @item :append-button-args | 1232 @item :append-button-args |
1025 A list of keyword arguments to pass to the trailing insert button. | 1233 A list of keyword arguments to pass to the trailing insert button. |
1026 | 1234 |
1027 | 1235 @vindex buttons@r{ keyword} |
1028 @item :buttons | 1236 @item :buttons |
1029 The widgets representing the insert and delete buttons. | 1237 The widgets representing the insert and delete buttons. |
1030 | 1238 |
1239 @vindex children@r{ keyword} | |
1031 @item :children | 1240 @item :children |
1032 The widgets representing the elements of the list. | 1241 The widgets representing the elements of the list. |
1033 | 1242 |
1243 @vindex args@r{ keyword} | |
1034 @item :args | 1244 @item :args |
1035 List whose car is the type of the list elements. | 1245 List whose @sc{car} is the type of the list elements. |
1036 | |
1037 @end table | 1246 @end table |
1038 | 1247 |
1039 @node group, , editable-list, Basic Types | 1248 @node group, , editable-list, Basic Types |
1040 @comment node-name, next, previous, up | 1249 @comment node-name, next, previous, up |
1041 @subsection The @code{group} Widget | 1250 @subsection The @code{group} Widget |
1251 @findex group@r{ widget} | |
1042 | 1252 |
1043 This widget simply groups other widgets together. | 1253 This widget simply groups other widgets together. |
1044 | 1254 |
1045 Syntax: | 1255 Syntax: |
1046 | 1256 |
1047 @example | 1257 @example |
1048 TYPE ::= (group [KEYWORD ARGUMENT]... TYPE...) | 1258 @var{type} ::= (group [@var{keyword} @var{argument}]... @var{type}...) |
1049 @end example | 1259 @end example |
1050 | 1260 |
1051 The value is a list, with one member for each @var{type}. | 1261 The value is a list, with one member for each @var{type}. |
1052 | 1262 |
1053 @node Sexp Types, Widget Properties, Basic Types, Top | 1263 @node Sexp Types, Widget Properties, Basic Types, Top |
1054 @comment | 1264 @comment |
1055 @section Sexp Types | 1265 @section Sexp Types |
1056 | 1266 @cindex sexp types |
1057 A number of widgets for editing s-expressions (lisp types) are also | 1267 |
1058 available. These basically fall in the following categories. | 1268 A number of widgets for editing @dfn{s-expressions} (Lisp types), sexp |
1269 for short, are also available. These basically fall in several | |
1270 categories described in this section. | |
1059 | 1271 |
1060 @menu | 1272 @menu |
1061 * constants:: | 1273 * constants:: |
1062 * generic:: | 1274 * generic:: |
1063 * atoms:: | 1275 * atoms:: |
1064 * composite:: | 1276 * composite:: |
1065 @end menu | 1277 @end menu |
1066 | 1278 |
1067 @node constants, generic, Sexp Types, Sexp Types | 1279 @node constants, generic, Sexp Types, Sexp Types |
1068 @comment node-name, next, previous, up | 1280 @comment node-name, next, previous, up |
1069 @subsection The Constant Widgets. | 1281 @subsection The Constant Widgets |
1070 | 1282 @cindex constant widgets |
1071 The @code{const} widget can contain any lisp expression, but the user is | 1283 |
1284 The @code{const} widget can contain any Lisp expression, but the user is | |
1072 prohibited from editing it, which is mainly useful as a component of one | 1285 prohibited from editing it, which is mainly useful as a component of one |
1073 of the composite widgets. | 1286 of the composite widgets. |
1074 | 1287 |
1075 The syntax for the @code{const} widget is | 1288 The syntax for the @code{const} widget is: |
1076 | 1289 |
1077 @example | 1290 @example |
1078 TYPE ::= (const [KEYWORD ARGUMENT]... [ VALUE ]) | 1291 @var{type} ::= (const [@var{keyword} @var{argument}]... [ @var{value} ]) |
1079 @end example | 1292 @end example |
1080 | 1293 |
1081 The @var{value}, if present, is used to initialize the @code{:value} | 1294 The @var{value}, if present, is used to initialize the @code{:value} |
1082 property and can be any s-expression. | 1295 property and can be any s-expression. |
1083 | 1296 |
1084 @deffn Widget const | 1297 @deffn Widget const |
1085 This will display any valid s-expression in an immutable part of the | 1298 This will display any valid s-expression in an immutable part of the |
1086 buffer. | 1299 buffer. |
1087 @end deffn | 1300 @end deffn |
1088 | 1301 |
1089 There are two variations of the @code{const} widget, namely | 1302 There are two variations of the @code{const} widget, namely |
1090 @code{variable-item} and @code{function-item}. These should contain a | 1303 @code{variable-item} and @code{function-item}. These should contain a |
1091 symbol with a variable or function binding. The major difference from | 1304 symbol with a variable or function binding. The major difference from |
1100 An immutable symbol that is bound as a function. | 1313 An immutable symbol that is bound as a function. |
1101 @end deffn | 1314 @end deffn |
1102 | 1315 |
1103 @node generic, atoms, constants, Sexp Types | 1316 @node generic, atoms, constants, Sexp Types |
1104 @comment node-name, next, previous, up | 1317 @comment node-name, next, previous, up |
1105 @subsection Generic Sexp Widget. | 1318 @subsection Generic Sexp Widget |
1106 | 1319 @cindex generic sexp widget |
1107 The @code{sexp} widget can contain any lisp expression, and allows the | 1320 |
1321 The @code{sexp} widget can contain any Lisp expression, and allows the | |
1108 user to edit it inline in the buffer. | 1322 user to edit it inline in the buffer. |
1109 | 1323 |
1110 The syntax for the @code{sexp} widget is | 1324 The syntax for the @code{sexp} widget is: |
1111 | 1325 |
1112 @example | 1326 @example |
1113 TYPE ::= (sexp [KEYWORD ARGUMENT]... [ VALUE ]) | 1327 @var{type} ::= (sexp [@var{keyword} @var{argument}]... [ @var{value} ]) |
1114 @end example | 1328 @end example |
1115 | 1329 |
1116 @deffn Widget sexp | 1330 @deffn Widget sexp |
1117 This will allow you to edit any valid s-expression in an editable buffer | 1331 This will allow you to edit any valid s-expression in an editable buffer |
1118 field. | 1332 field. |
1119 | 1333 |
1120 The @code{sexp} widget takes the same keyword arguments as the | 1334 The @code{sexp} widget takes the same keyword arguments as the |
1121 @code{editable-field} widget. | 1335 @code{editable-field} widget. @xref{editable-field}. |
1122 @end deffn | 1336 @end deffn |
1123 | 1337 |
1124 @node atoms, composite, generic, Sexp Types | 1338 @node atoms, composite, generic, Sexp Types |
1125 @comment node-name, next, previous, up | 1339 @comment node-name, next, previous, up |
1126 @subsection Atomic Sexp Widgets. | 1340 @subsection Atomic Sexp Widgets |
1127 | 1341 @cindex atomic sexp widget |
1128 The atoms are s-expressions that does not consist of other | 1342 |
1129 s-expressions. A string is an atom, while a list is a composite type. | 1343 The atoms are s-expressions that do not consist of other s-expressions. |
1130 You can edit the value of an atom with the following widgets. | 1344 For example, a string, a file name, or a symbol are atoms, while a list |
1131 | 1345 is a composite type. You can edit the value of an atom with the |
1132 The syntax for all the atoms are | 1346 following widgets. |
1133 | 1347 |
1134 @example | 1348 The syntax for all the atoms are: |
1135 TYPE ::= (NAME [KEYWORD ARGUMENT]... [ VALUE ]) | 1349 |
1350 @example | |
1351 @var{type} ::= (@var{construct} [@var{keyword} @var{argument}]... [ @var{value} ]) | |
1136 @end example | 1352 @end example |
1137 | 1353 |
1138 The @var{value}, if present, is used to initialize the @code{:value} | 1354 The @var{value}, if present, is used to initialize the @code{:value} |
1139 property and must be an expression of the same type as the widget. | 1355 property and must be an expression of the same type as the widget. |
1140 I.e. the string widget can only be initialized with a string. | 1356 That is, the string widget can only be initialized with a string. |
1141 | 1357 |
1142 All the atom widgets take the same keyword arguments as the | 1358 All the atom widgets take the same keyword arguments as the |
1143 @code{editable-field} widget. | 1359 @code{editable-field} widget. @xref{editable-field}. |
1144 | 1360 |
1145 @deffn Widget string | 1361 @deffn Widget string |
1146 Allows you to edit a string in an editable field. | 1362 Allows you to edit a string in an editable field. |
1147 @end deffn | 1363 @end deffn |
1148 | 1364 |
1153 @deffn Widget character | 1369 @deffn Widget character |
1154 Allows you to enter a character in an editable field. | 1370 Allows you to enter a character in an editable field. |
1155 @end deffn | 1371 @end deffn |
1156 | 1372 |
1157 @deffn Widget file | 1373 @deffn Widget file |
1158 Allows you to edit a file name in an editable field. If you invoke | 1374 Allows you to edit a file name in an editable field. |
1159 the tag button, you can edit the file name in the mini-buffer with | |
1160 completion. | |
1161 | 1375 |
1162 Keywords: | 1376 Keywords: |
1163 @table @code | 1377 @table @code |
1378 @vindex must-match@r{ keyword} | |
1164 @item :must-match | 1379 @item :must-match |
1165 If this is set to non-nil, only existing file names will be allowed in | 1380 If this is set to non-@code{nil}, only existing file names will be |
1166 the minibuffer. | 1381 allowed in the minibuffer. |
1167 @end table | 1382 @end table |
1168 @end deffn | 1383 @end deffn |
1169 | 1384 |
1170 @deffn Widget directory | 1385 @deffn Widget directory |
1171 Allows you to edit a directory name in an editable field. | 1386 Allows you to edit a directory name in an editable field. |
1172 Similar to the @code{file} widget. | 1387 Similar to the @code{file} widget. |
1173 @end deffn | 1388 @end deffn |
1174 | 1389 |
1175 @deffn Widget symbol | 1390 @deffn Widget symbol |
1176 Allows you to edit a lisp symbol in an editable field. | 1391 Allows you to edit a Lisp symbol in an editable field. |
1177 @end deffn | 1392 @end deffn |
1178 | 1393 |
1179 @deffn Widget function | 1394 @deffn Widget function |
1180 Allows you to edit a lambda expression, or a function name with completion. | 1395 Allows you to edit a lambda expression, or a function name with completion. |
1181 @end deffn | 1396 @end deffn |
1191 @deffn Widget number | 1406 @deffn Widget number |
1192 Allows you to edit a number in an editable field. | 1407 Allows you to edit a number in an editable field. |
1193 @end deffn | 1408 @end deffn |
1194 | 1409 |
1195 @deffn Widget boolean | 1410 @deffn Widget boolean |
1196 Allows you to edit a boolean. In lisp this means a variable which is | 1411 Allows you to edit a boolean. In Lisp this means a variable which is |
1197 either nil meaning false, or non-nil meaning true. | 1412 either @code{nil} meaning false, or non-@code{nil} meaning true. |
1198 @end deffn | 1413 @end deffn |
1199 | 1414 |
1200 | 1415 |
1201 @node composite, , atoms, Sexp Types | 1416 @node composite, , atoms, Sexp Types |
1202 @comment node-name, next, previous, up | 1417 @comment node-name, next, previous, up |
1203 @subsection Composite Sexp Widgets. | 1418 @subsection Composite Sexp Widgets |
1204 | 1419 @cindex composite sexp widgets |
1205 The syntax for the composite are | 1420 |
1206 | 1421 The syntax for the composite widget construct is: |
1207 @example | 1422 |
1208 TYPE ::= (NAME [KEYWORD ARGUMENT]... COMPONENT...) | 1423 @example |
1209 @end example | 1424 @var{type} ::= (@var{construct} [@var{keyword} @var{argument}]... @var{component}...) |
1210 | 1425 @end example |
1211 Where each @var{component} must be a widget type. Each component widget | 1426 |
1212 will be displayed in the buffer, and be editable to the user. | 1427 @noindent |
1428 where each @var{component} must be a widget type. Each component widget | |
1429 will be displayed in the buffer, and will be editable by the user. | |
1213 | 1430 |
1214 @deffn Widget cons | 1431 @deffn Widget cons |
1215 The value of a @code{cons} widget is a cons-cell where the car is the | 1432 The value of a @code{cons} widget must be a cons-cell whose @sc{car} |
1216 value of the first component and the cdr is the value of the second | 1433 and @sc{cdr} have two specified types. It uses this syntax: |
1217 component. There must be exactly two components. | 1434 |
1435 @example | |
1436 @var{type} ::= (cons [@var{keyword} @var{argument}]... @var{car-type} @var{cdr-type}) | |
1437 @end example | |
1438 @end deffn | |
1439 | |
1440 @deffn Widget choice | |
1441 The value matched by a @code{choice} widget must have one of a fixed | |
1442 set of types. The widget's syntax is as follows: | |
1443 | |
1444 @example | |
1445 @var{type} ::= (choice [@var{keyword} @var{argument}]... @var{type} ... ) | |
1446 @end example | |
1447 | |
1448 The value of a @code{choice} widget can be anything that matches any of the | |
1449 @var{types}. | |
1218 @end deffn | 1450 @end deffn |
1219 | 1451 |
1220 @deffn Widget list | 1452 @deffn Widget list |
1221 The value of a @code{list} widget is a list containing the value of | 1453 The value of a @code{list} widget must be a list whose element types |
1222 each of its component. | 1454 match the specified component types: |
1455 | |
1456 @example | |
1457 @var{type} ::= (list [@var{keyword} @var{argument}]... @var{component-type}...) | |
1458 @end example | |
1459 | |
1460 Thus, @code{(list string number)} matches lists of two elements, | |
1461 the first being a string and the second being a number. | |
1223 @end deffn | 1462 @end deffn |
1224 | 1463 |
1225 @deffn Widget vector | 1464 @deffn Widget vector |
1226 The value of a @code{vector} widget is a vector containing the value of | 1465 The @code{vector} widget is like the @code{list} widget but matches |
1227 each of its component. | 1466 vectors instead of lists. Thus, @code{(vector string number)} matches |
1467 vectors of two elements, the first being a string and the second being | |
1468 a number. | |
1228 @end deffn | 1469 @end deffn |
1229 | 1470 |
1230 The above suffice for specifying fixed size lists and vectors. To get | 1471 The above suffice for specifying fixed size lists and vectors. To get |
1231 variable length lists and vectors, you can use a @code{choice}, | 1472 variable length lists and vectors, you can use a @code{choice}, |
1232 @code{set} or @code{repeat} widgets together with the @code{:inline} | 1473 @code{set}, or @code{repeat} widget together with the @code{:inline} |
1233 keywords. If any component of a composite widget has the @code{:inline} | 1474 keyword. If any component of a composite widget has the |
1234 keyword set, its value must be a list which will then be spliced into | 1475 @code{:inline} keyword set, its value must be a list which will then |
1235 the composite. For example, to specify a list whose first element must | 1476 be spliced into the composite. For example, to specify a list whose |
1236 be a file name, and whose remaining arguments should either by the | 1477 first element must be a file name, and whose remaining elements should |
1237 symbol @code{t} or two files, you can use the following widget | 1478 either be the symbol @code{t} or two strings (file names), you can use |
1238 specification: | 1479 the following widget specification: |
1239 | 1480 |
1240 @example | 1481 @example |
1241 (list file | 1482 (list file |
1242 (choice (const t) | 1483 (choice (const t) |
1243 (list :inline t | 1484 (list :inline t |
1244 :value ("foo" "bar") | 1485 :value ("foo" "bar") |
1245 string string))) | 1486 string string))) |
1246 @end example | 1487 @end example |
1247 | 1488 |
1248 The value of a widget of this type will either have the form | 1489 The value of a widget of this type will either have the form |
1249 @samp{(file t)} or @code{(file string string)}. | 1490 @code{(file t)} or @code{(file @var{string} @var{string})}. |
1250 | 1491 |
1251 This concept of inline is probably hard to understand. It was certainly | 1492 This concept of @code{:inline} may be hard to understand. It was |
1252 hard to implement so instead of confusing you more by trying to explain | 1493 certainly hard to implement, so instead of confusing you more by |
1253 it here, I'll just suggest you meditate over it for a while. | 1494 trying to explain it here, I'll just suggest you meditate over it for |
1254 | 1495 a while. |
1255 @deffn Widget choice | |
1256 Allows you to edit a sexp which may have one of a fixed set of types. | |
1257 It is currently implemented with the @code{choice-menu} basic widget, | |
1258 and has a similar syntax. | |
1259 @end deffn | |
1260 | 1496 |
1261 @deffn Widget set | 1497 @deffn Widget set |
1262 Allows you to specify a type which must be a list whose elements all | 1498 Specifies a type whose values are the lists whose elements all belong |
1263 belong to given set. The elements of the list is not significant. This | 1499 to a given set. The order of elements of the list is not significant. |
1264 is implemented on top of the @code{checklist} basic widget, and has a | 1500 Here's the syntax: |
1265 similar syntax. | 1501 |
1502 @example | |
1503 @var{type} ::= (set [@var{keyword} @var{argument}]... @var{permitted-element} ... ) | |
1504 @end example | |
1505 | |
1506 Use @code{const} to specify each permitted element, like this: | |
1507 @code{(set (const a) (const b))}. | |
1266 @end deffn | 1508 @end deffn |
1267 | 1509 |
1268 @deffn Widget repeat | 1510 @deffn Widget repeat |
1269 Allows you to specify a variable length list whose members are all of | 1511 Specifies a list of any number of elements that fit a certain type. |
1270 the same type. Implemented on top of the `editable-list' basic widget, | 1512 |
1271 and has a similar syntax. | 1513 @example |
1514 @var{type} ::= (repeat [@var{keyword} @var{argument}]... @var{type}) | |
1515 @end example | |
1272 @end deffn | 1516 @end deffn |
1273 | 1517 |
1274 @node Widget Properties, Defining New Widgets, Sexp Types, Top | 1518 @node Widget Properties, Defining New Widgets, Sexp Types, Top |
1275 @comment node-name, next, previous, up | 1519 @comment node-name, next, previous, up |
1276 @section Properties | 1520 @section Properties |
1521 @cindex properties of widgets | |
1522 @cindex widget properties | |
1277 | 1523 |
1278 You can examine or set the value of a widget by using the widget object | 1524 You can examine or set the value of a widget by using the widget object |
1279 that was returned by @code{widget-create}. | 1525 that was returned by @code{widget-create}. |
1280 | 1526 |
1281 @defun widget-value widget | 1527 @defun widget-value widget |
1291 @strong{Important:} You @emph{must} call @code{widget-setup} after | 1537 @strong{Important:} You @emph{must} call @code{widget-setup} after |
1292 modifying the value of a widget before the user is allowed to edit the | 1538 modifying the value of a widget before the user is allowed to edit the |
1293 widget again. It is enough to call @code{widget-setup} once if you | 1539 widget again. It is enough to call @code{widget-setup} once if you |
1294 modify multiple widgets. This is currently only necessary if the widget | 1540 modify multiple widgets. This is currently only necessary if the widget |
1295 contains an editing field, but may be necessary for other widgets in the | 1541 contains an editing field, but may be necessary for other widgets in the |
1296 future. | 1542 future. |
1297 | 1543 |
1298 If your application needs to associate some information with the widget | 1544 If your application needs to associate some information with the widget |
1299 objects, for example a reference to the item being edited, it can be | 1545 objects, for example a reference to the item being edited, it can be |
1300 done with @code{widget-put} and @code{widget-get}. The property names | 1546 done with @code{widget-put} and @code{widget-get}. The property names |
1301 must begin with a @samp{:}. | 1547 must begin with a @samp{:}. |
1310 @var{property} should be a symbol, the value is what was last set by | 1556 @var{property} should be a symbol, the value is what was last set by |
1311 @code{widget-put} for @var{property}. | 1557 @code{widget-put} for @var{property}. |
1312 @end defun | 1558 @end defun |
1313 | 1559 |
1314 @defun widget-member widget property | 1560 @defun widget-member widget property |
1315 Non-nil if @var{widget} has a value (even nil) for property @var{property}. | 1561 Non-@code{nil} if @var{widget} has a value (even @code{nil}) for |
1562 property @var{property}. | |
1316 @end defun | 1563 @end defun |
1317 | 1564 |
1318 Occasionally it can be useful to know which kind of widget you have, | 1565 Occasionally it can be useful to know which kind of widget you have, |
1319 i.e. the name of the widget type you gave when the widget was created. | 1566 i.e.@: the name of the widget type you gave when the widget was created. |
1320 | 1567 |
1321 @defun widget-type widget | 1568 @defun widget-type widget |
1322 Return the name of @var{widget}, a symbol. | 1569 Return the name of @var{widget}, a symbol. |
1323 @end defun | 1570 @end defun |
1324 | 1571 |
1572 @cindex active widget | |
1573 @cindex inactive widget | |
1574 @cindex activate a widget | |
1575 @cindex deactivate a widget | |
1325 Widgets can be in two states: active, which means they are modifiable by | 1576 Widgets can be in two states: active, which means they are modifiable by |
1326 the user, or inactive, which means they cannot be modified by the user. | 1577 the user, or inactive, which means they cannot be modified by the user. |
1327 You can query or set the state with the following code: | 1578 You can query or set the state with the following code: |
1328 | 1579 |
1329 @lisp | 1580 @lisp |
1337 | 1588 |
1338 ;; Make @var{widget} active. | 1589 ;; Make @var{widget} active. |
1339 (widget-apply @var{widget} :activate) | 1590 (widget-apply @var{widget} :activate) |
1340 @end lisp | 1591 @end lisp |
1341 | 1592 |
1342 A widget is inactive if itself or any of its ancestors (found by | 1593 A widget is inactive if it, or any of its ancestors (found by |
1343 following the @code{:parent} link) have been deactivated. To make sure | 1594 following the @code{:parent} link), have been deactivated. To make sure |
1344 a widget is really active, you must therefore activate both itself and | 1595 a widget is really active, you must therefore activate both it and |
1345 all its ancestors. | 1596 all its ancestors. |
1346 | 1597 |
1347 @lisp | 1598 @lisp |
1348 (while widget | 1599 (while widget |
1349 (widget-apply widget :activate) | 1600 (widget-apply widget :activate) |
1350 (setq widget (widget-get widget :parent))) | 1601 (setq widget (widget-get widget :parent))) |
1351 @end lisp | 1602 @end lisp |
1352 | 1603 |
1353 You can check if a widget has been made inactive by examining the value | 1604 You can check if a widget has been made inactive by examining the value |
1354 of the @code{:inactive} keyword. If this is non-nil, the widget itself | 1605 of the @code{:inactive} keyword. If this is non-@code{nil}, the widget itself |
1355 has been deactivated. This is different from using the @code{:active} | 1606 has been deactivated. This is different from using the @code{:active} |
1356 keyword, in that the latter tells you if the widget @strong{or} any of | 1607 keyword, in that the latter tells you if the widget @strong{or} any of |
1357 its ancestors have been deactivated. Do not attempt to set the | 1608 its ancestors have been deactivated. Do not attempt to set the |
1358 @code{:inactive} keyword directly. Use the @code{:activate} | 1609 @code{:inactive} keyword directly. Use the @code{:activate} |
1359 @code{:deactivate} keywords instead. | 1610 @code{:deactivate} keywords instead. |
1360 | 1611 |
1361 | 1612 |
1362 @node Defining New Widgets, Widget Browser, Widget Properties, Top | 1613 @node Defining New Widgets, Widget Browser, Widget Properties, Top |
1363 @comment node-name, next, previous, up | 1614 @comment node-name, next, previous, up |
1364 @section Defining New Widgets | 1615 @section Defining New Widgets |
1616 @cindex new widgets | |
1617 @cindex defining new widgets | |
1365 | 1618 |
1366 You can define specialized widgets with @code{define-widget}. It allows | 1619 You can define specialized widgets with @code{define-widget}. It allows |
1367 you to create a shorthand for more complex widgets. This includes | 1620 you to create a shorthand for more complex widgets, including specifying |
1368 specifying component widgets and new default values for the keyword | 1621 component widgets and new default values for the keyword |
1369 arguments. | 1622 arguments. |
1370 | 1623 |
1371 @defun define-widget name class doc &rest args | 1624 @defun define-widget name class doc &rest args |
1372 Define a new widget type named @var{name} from @code{class}. | 1625 Define a new widget type named @var{name} from @code{class}. |
1373 | 1626 |
1374 @var{name} and class should both be symbols, @code{class} should be one | 1627 @var{name} and class should both be symbols, @code{class} should be one |
1375 of the existing widget types. | 1628 of the existing widget types. |
1376 | 1629 |
1377 The third argument @var{DOC} is a documentation string for the widget. | 1630 The third argument @var{doc} is a documentation string for the widget. |
1378 | 1631 |
1379 After the new widget has been defined the following two calls will | 1632 After the new widget has been defined the following two calls will |
1380 create identical widgets: | 1633 create identical widgets: |
1381 | 1634 |
1382 @itemize @bullet | 1635 @itemize @bullet |
1395 | 1648 |
1396 Using @code{define-widget} just stores the definition of the widget type | 1649 Using @code{define-widget} just stores the definition of the widget type |
1397 in the @code{widget-type} property of @var{name}, which is what | 1650 in the @code{widget-type} property of @var{name}, which is what |
1398 @code{widget-create} uses. | 1651 @code{widget-create} uses. |
1399 | 1652 |
1400 If you just want to specify defaults for keywords with no complex | 1653 If you only want to specify defaults for keywords with no complex |
1401 conversions, you can use @code{identity} as your @code{:convert-widget} | 1654 conversions, you can use @code{identity} as your @code{:convert-widget} |
1402 function. | 1655 function. |
1403 | 1656 |
1404 The following additional keyword arguments are useful when defining new | 1657 The following additional keyword arguments are useful when defining new |
1405 widgets: | 1658 widgets: |
1406 @table @code | 1659 @table @code |
1660 @vindex convert-widget@r{ keyword} | |
1407 @item :convert-widget | 1661 @item :convert-widget |
1408 Method to convert type-specific components of a widget type before | 1662 Method to convert type-specific components of a widget type before |
1409 instantiating a widget of that type. Not normally called from user | 1663 instantiating a widget of that type. Not normally called from user |
1410 code, it is invoked by @code{widget-convert}. Typical operations | 1664 code, it is invoked by @code{widget-convert}. Typical operations |
1411 include converting types of child widgets to widget instances and | 1665 include converting types of child widgets to widget instances and |
1427 @defun widget-value-convert-widget widget | 1681 @defun widget-value-convert-widget widget |
1428 Initialize @code{:value} from @code{(car :args)} in @var{widget}, and | 1682 Initialize @code{:value} from @code{(car :args)} in @var{widget}, and |
1429 reset @code{:args}. | 1683 reset @code{:args}. |
1430 @end defun | 1684 @end defun |
1431 | 1685 |
1686 @vindex copy@r{ keyword} | |
1432 @item :copy | 1687 @item :copy |
1433 A method to implement deep copying of the type. Any member of the | 1688 Function to deep copy a widget type. It takes a shallow copy of the |
1689 widget type as an argument (made by @code{copy-sequence}), and returns a | |
1690 deep copy. The purpose of this is to avoid having different instances | |
1691 of combined widgets share nested attributes. Any member of the | |
1434 widget which might be changed in place (rather than replaced) should be | 1692 widget which might be changed in place (rather than replaced) should be |
1435 copied by this method. (@code{widget-copy} uses @code{copy-sequence} to | 1693 copied by this method. (@code{widget-copy} uses @code{copy-sequence} to |
1436 ensure that the top-level list is a copy.) This particularly applies to | 1694 ensure that the top-level list is a copy.) This particularly applies to |
1437 child widgets. | 1695 child widgets. |
1438 | 1696 |
1697 The following predefined functions can be used here: | |
1698 | |
1699 @defun widget-types-copy widget | |
1700 Copy @code{:args} as widget types in @var{widget}. | |
1701 @end defun | |
1702 | |
1703 @vindex value-to-internal@r{ keyword} | |
1439 @item :value-to-internal | 1704 @item :value-to-internal |
1440 Function to convert the value to the internal format. The function | 1705 Function to convert the value to the internal format. The function |
1441 takes two arguments, a widget and an external value. It returns the | 1706 takes two arguments, a widget and an external value. It returns the |
1442 internal value. The function is called on the present @code{:value} | 1707 internal value. The function is called on the present @code{:value} |
1443 when the widget is created, and on any value set later with | 1708 when the widget is created, and on any value set later with |
1444 @code{widget-value-set}. | 1709 @code{widget-value-set}. |
1445 | 1710 |
1711 @vindex value-to-external@r{ keyword} | |
1446 @item :value-to-external | 1712 @item :value-to-external |
1447 Function to convert the value to the external format. The function | 1713 Function to convert the value to the external format. The function |
1448 takes two arguments, a widget and an internal value, and returns the | 1714 takes two arguments, a widget and an internal value, and returns the |
1449 internal value. The function is called on the present @code{:value} | 1715 external value. The function is called on the present @code{:value} |
1450 when the widget is created, and on any value set later with | 1716 when the widget is created, and on any value set later with |
1451 @code{widget-value-set}. | 1717 @code{widget-value-set}. |
1452 | 1718 |
1719 @vindex create@r{ keyword} | |
1453 @item :create | 1720 @item :create |
1454 Function to create a widget from scratch. The function takes one | 1721 Function to create a widget from scratch. The function takes one |
1455 argument, a widget, and inserts it in the buffer. Not normally called | 1722 argument, a widget, and inserts it in the buffer. Not normally called |
1456 from user code. Instead, call @code{widget-create} or related | 1723 from user code. Instead, call @code{widget-create} or related |
1457 functions, which take a type argument, (usually) convert it to a widget, | 1724 functions, which take a type argument, (usually) convert it to a widget, |
1459 return the (possibly converted) widget. | 1726 return the (possibly converted) widget. |
1460 | 1727 |
1461 The default, @code{widget-default-create}, is invariably appropriate. | 1728 The default, @code{widget-default-create}, is invariably appropriate. |
1462 (None of the standard widgets specify @code{:create}.) | 1729 (None of the standard widgets specify @code{:create}.) |
1463 | 1730 |
1731 @vindex delete@r{ keyword} | |
1464 @item :delete | 1732 @item :delete |
1465 Function to delete a widget. The function takes one argument, a widget, | 1733 Function to delete a widget. The function takes one argument, a widget, |
1466 and should remove all traces of the widget from the buffer. | 1734 and should remove all traces of the widget from the buffer. |
1467 | 1735 |
1736 The default value is: | |
1737 | |
1738 @defun widget-default-delete widget | |
1739 Remove @var{widget} from the buffer. | |
1740 Delete all @code{:children} and @code{:buttons} in @var{widget}. | |
1741 @end defun | |
1742 | |
1743 In most cases you should not change this value, but instead use | |
1744 @code{:value-delete} to make any additional cleanup. | |
1745 | |
1746 @vindex value-create@r{ keyword} | |
1468 @item :value-create | 1747 @item :value-create |
1469 Function to expand the @samp{%v} escape in the format string. It will | 1748 Function to expand the @samp{%v} escape in the format string. It will |
1470 be called with the widget as its argument and should insert a | 1749 be called with the widget as its argument and should insert a |
1471 representation of the widget's value in the buffer. | 1750 representation of the widget's value in the buffer. |
1472 | 1751 |
1752 Nested widgets should be listed in @code{:children} or @code{:buttons} | |
1753 to make sure they are automatically deleted. | |
1754 | |
1755 @vindex value-delete@r{ keyword} | |
1473 @item :value-delete | 1756 @item :value-delete |
1474 Should remove the representation of the widget's value from the buffer. | 1757 Should remove the representation of the widget's value from the buffer. |
1475 It will be called with the widget as its argument. It doesn't have to | 1758 It will be called with the widget as its argument. It doesn't have to |
1476 remove the text, but it should release markers and delete nested widgets | 1759 remove the text, but it should release markers and delete nested widgets |
1477 if such have been used. | 1760 if these are not listed in @code{:children} or @code{:buttons}. |
1478 | 1761 |
1479 The following predefined function can be used here: | 1762 @vindex value-get@r{ keyword} |
1480 | 1763 @item :value-get |
1481 @defun widget-children-value-delete widget | |
1482 Delete all @code{:children} and @code{:buttons} in @var{widget}. | |
1483 @end defun | |
1484 | |
1485 @item :value-get | |
1486 Function to extract the value of a widget, as it is displayed in the | 1764 Function to extract the value of a widget, as it is displayed in the |
1487 buffer. | 1765 buffer. |
1488 | 1766 |
1489 The following predefined function can be used here: | 1767 The following predefined function can be used here: |
1490 | 1768 |
1491 @defun widget-value-value-get widget | 1769 @defun widget-value-value-get widget |
1492 Return the @code{:value} property of @var{widget}. | 1770 Return the @code{:value} property of @var{widget}. |
1493 @end defun | 1771 @end defun |
1494 | 1772 |
1773 @vindex format-handler@r{ keyword} | |
1495 @item :format-handler | 1774 @item :format-handler |
1496 Function to handle unknown @samp{%} escapes in the format string. It | 1775 Function to handle unknown @samp{%} escapes in the format string. It |
1497 will be called with the widget and the escape character as arguments. | 1776 will be called with the widget and the character that follows the |
1498 You can set this to allow your widget to handle non-standard escapes. | 1777 @samp{%} as arguments. You can set this to allow your widget to handle |
1499 | 1778 non-standard escapes. |
1779 | |
1780 @findex widget-default-format-handler | |
1500 You should end up calling @code{widget-default-format-handler} to handle | 1781 You should end up calling @code{widget-default-format-handler} to handle |
1501 unknown escape sequences. It will handle the @samp{%h} and any future | 1782 unknown escape sequences. It will handle the @samp{%h} and any future |
1502 escape sequences as well as give an error for unknown escapes. | 1783 escape sequences as well as give an error for unknown escapes. |
1503 | 1784 |
1785 @vindex action@r{ keyword} | |
1504 @item :action | 1786 @item :action |
1505 Function to handle user initiated events. By default, @code{:notify} | 1787 Function to handle user initiated events. By default, @code{:notify} |
1506 the parent. Actions normally do not include mere edits, but refer to | 1788 the parent. Actions normally do not include mere edits, but refer to |
1507 things like invoking buttons or hitting enter in an editable field. To | 1789 things like invoking buttons or hitting enter in an editable field. To |
1508 watch for any change, redefine the @code{:notify} callback. | 1790 watch for any change, redefine the @code{:notify} callback. |
1512 @defun widget-parent-action widget &optional event | 1794 @defun widget-parent-action widget &optional event |
1513 Tell @code{:parent} of @var{widget} to handle the @code{:action}.@* | 1795 Tell @code{:parent} of @var{widget} to handle the @code{:action}.@* |
1514 Optional @var{event} is the event that triggered the action. | 1796 Optional @var{event} is the event that triggered the action. |
1515 @end defun | 1797 @end defun |
1516 | 1798 |
1799 @vindex prompt-value@r{ keyword} | |
1517 @item :prompt-value | 1800 @item :prompt-value |
1518 Function to prompt for a value in the minibuffer. The function should | 1801 Function to prompt for a value in the minibuffer. The function should |
1519 take four arguments, @var{widget}, @var{prompt}, @var{value}, and | 1802 take four arguments, @var{widget}, @var{prompt}, @var{value}, and |
1520 @var{unbound} and should return a value for widget entered by the user. | 1803 @var{unbound} and should return a value for widget entered by the user. |
1521 @var{prompt} is the prompt to use. @var{value} is the default value to | 1804 @var{prompt} is the prompt to use. @var{value} is the default value to |
1522 use, unless @var{unbound} is non-nil. In this case there is no default | 1805 use, unless @var{unbound} is non-@code{nil}, in which case there is no default |
1523 value. The function should read the value using the method most natural | 1806 value. The function should read the value using the method most natural |
1524 for this widget and does not have to check whether it matches. | 1807 for this widget and does not have to check whether it matches. |
1525 @end table | 1808 @end table |
1526 | 1809 |
1527 If you want to define a new widget from scratch, use the @code{default} | 1810 If you want to define a new widget from scratch, use the @code{default} |
1528 widget as its base. | 1811 widget as its base. |
1529 | 1812 |
1530 @deffn Widget default | 1813 @deffn Widget default |
1531 Widget used as a base for other widgets. | 1814 Widget used as a base for other widgets. |
1532 | 1815 |
1533 It provides most of the functionality that is referred to as ``by | 1816 It provides most of the functionality that is referred to as ``by |
1534 default'' in this text. | 1817 default'' in this text. |
1535 @end deffn | 1818 @end deffn |
1536 | 1819 |
1537 In implementing complex hierarchical widgets (@emph{e.g.}, using the | 1820 In implementing complex hierarchical widgets (@emph{e.g.}, using the |
1538 @samp{group} widget), the following functions may be useful. | 1821 @samp{group} widget), the following functions may be useful. |
1539 The syntax for the @var{type} arguments to these functions is described | 1822 The syntax for the @var{type} arguments to these functions is described |
1572 is called implicitly through the @samp{widget-create*} functions. | 1855 is called implicitly through the @samp{widget-create*} functions. |
1573 | 1856 |
1574 @node Widget Browser, Widget Minor Mode, Defining New Widgets, Top | 1857 @node Widget Browser, Widget Minor Mode, Defining New Widgets, Top |
1575 @comment node-name, next, previous, up | 1858 @comment node-name, next, previous, up |
1576 @section Widget Browser | 1859 @section Widget Browser |
1860 @cindex widget browser | |
1577 | 1861 |
1578 There is a separate package to browse widgets. This is intended to help | 1862 There is a separate package to browse widgets. This is intended to help |
1579 programmers who want to examine the content of a widget. The browser | 1863 programmers who want to examine the content of a widget. The browser |
1580 shows the value of each keyword, but uses links for certain keywords | 1864 shows the value of each keyword, but uses links for certain keywords |
1581 such as `:parent', which avoids printing cyclic structures. | 1865 such as @samp{:parent}, which avoids printing cyclic structures. |
1582 | 1866 |
1583 @deffn Command widget-browse WIDGET | 1867 @deffn Command widget-browse @var{widget} |
1584 Create a widget browser for WIDGET. | 1868 Create a widget browser for @var{widget}. |
1585 When called interactively, prompt for WIDGET. | 1869 When called interactively, prompt for @var{widget}. |
1586 @end deffn | 1870 @end deffn |
1587 | 1871 |
1588 @deffn Command widget-browse-other-window WIDGET | 1872 @deffn Command widget-browse-other-window @var{widget} |
1589 Create a widget browser for WIDGET and show it in another window. | 1873 Create a widget browser for @var{widget} and show it in another window. |
1590 When called interactively, prompt for WIDGET. | 1874 When called interactively, prompt for @var{widget}. |
1591 @end deffn | 1875 @end deffn |
1592 | 1876 |
1593 @deffn Command widget-browse-at POS | 1877 @deffn Command widget-browse-at @var{pos} |
1594 Create a widget browser for the widget at POS. | 1878 Create a widget browser for the widget at @var{pos}. |
1595 When called interactively, use the position of point. | 1879 When called interactively, use the position of point. |
1596 @end deffn | 1880 @end deffn |
1597 | 1881 |
1598 @node Widget Minor Mode, Utilities, Widget Browser, Top | 1882 @node Widget Minor Mode, Utilities, Widget Browser, Top |
1599 @comment node-name, next, previous, up | 1883 @comment node-name, next, previous, up |
1600 @section Widget Minor Mode | 1884 @section Widget Minor Mode |
1885 @cindex widget minor mode | |
1601 | 1886 |
1602 There is a minor mode for manipulating widgets in major modes that | 1887 There is a minor mode for manipulating widgets in major modes that |
1603 doesn't provide any support for widgets themselves. This is mostly | 1888 don't provide any support for widgets themselves. This is mostly |
1604 intended to be useful for programmers doing experiments. | 1889 intended to be useful for programmers doing experiments. |
1605 | 1890 |
1606 @deffn Command widget-minor-mode | 1891 @deffn Command widget-minor-mode |
1607 Toggle minor mode for traversing widgets. | 1892 Toggle minor mode for traversing widgets. |
1608 With arg, turn widget mode on if and only if arg is positive. | 1893 With arg, turn widget mode on if and only if arg is positive. |
1609 @end deffn | 1894 @end deffn |
1613 @end defvar | 1898 @end defvar |
1614 | 1899 |
1615 @node Utilities, Widget Wishlist, Widget Minor Mode, Top | 1900 @node Utilities, Widget Wishlist, Widget Minor Mode, Top |
1616 @comment node-name, next, previous, up | 1901 @comment node-name, next, previous, up |
1617 @section Utilities. | 1902 @section Utilities. |
1903 @cindex utility functions for widgets | |
1618 | 1904 |
1619 @defun widget-prompt-value widget prompt [ value unbound ] | 1905 @defun widget-prompt-value widget prompt [ value unbound ] |
1620 Prompt for a value matching @var{widget}, using @var{prompt}.@* | 1906 Prompt for a value matching @var{widget}, using @var{prompt}.@* |
1621 The current value is assumed to be @var{value}, unless @var{unbound} is | 1907 The current value is assumed to be @var{value}, unless @var{unbound} is |
1622 non-nil.@refill | 1908 non-@code{nil}.@refill |
1623 @end defun | 1909 @end defun |
1624 | 1910 |
1625 @defun widget-get-sibling widget | 1911 @defun widget-get-sibling widget |
1626 Get the item @var{widget} is assumed to toggle.@* | 1912 Get the item which @var{widget} is assumed to toggle.@* |
1627 This is only meaningful for radio buttons or checkboxes in a list. | 1913 This is only meaningful for radio buttons or checkboxes in a list. |
1628 @end defun | 1914 @end defun |
1629 | 1915 |
1630 @node Widget Wishlist, Widget Internals, Utilities, Top | 1916 @node Widget Wishlist, Widget Internals, Utilities, Top |
1631 @comment node-name, next, previous, up | 1917 @comment node-name, next, previous, up |
1632 @section Wishlist | 1918 @section Wishlist |
1919 @cindex todo | |
1633 | 1920 |
1634 @itemize @bullet | 1921 @itemize @bullet |
1635 @item | 1922 @item |
1636 It should be possible to add or remove items from a list with @kbd{C-k} | 1923 It should be possible to add or remove items from a list with @kbd{C-k} |
1637 and @kbd{C-o} (suggested by @sc{rms}). | 1924 and @kbd{C-o} (suggested by @sc{rms}). |
1638 | 1925 |
1639 @item | 1926 @item |
1640 The @samp{[INS]} and @samp{[DEL]} buttons should be replaced by a single | 1927 The @samp{[INS]} and @samp{[DEL]} buttons should be replaced by a single |
1641 dash (@samp{-}). The dash should be a button that, when invoked, ask | 1928 dash (@samp{-}). The dash should be a button that, when invoked, asks |
1642 whether you want to add or delete an item (@sc{rms} wanted to git rid of | 1929 whether you want to add or delete an item (@sc{rms} wanted to git rid of |
1643 the ugly buttons, the dash is my idea). | 1930 the ugly buttons, the dash is my idea). |
1644 | 1931 |
1645 @item | 1932 @item |
1646 The @code{menu-choice} tag should be prettier, something like the abbreviated | 1933 The @code{menu-choice} tag should be prettier, something like the abbreviated |
1652 @item | 1939 @item |
1653 Make indentation work with glyphs and proportional fonts. | 1940 Make indentation work with glyphs and proportional fonts. |
1654 | 1941 |
1655 @item | 1942 @item |
1656 Add commands to show overview of object and class hierarchies to the | 1943 Add commands to show overview of object and class hierarchies to the |
1657 browser. | 1944 browser. |
1658 | 1945 |
1659 @item | 1946 @item |
1660 Find a way to disable mouse highlight for inactive widgets. | 1947 Find a way to disable mouse highlight for inactive widgets. |
1661 | 1948 |
1662 @item | 1949 @item |
1663 Find a way to make glyphs look inactive. | 1950 Find a way to make glyphs look inactive. |
1664 | 1951 |
1676 | 1963 |
1677 @item | 1964 @item |
1678 Find clean way to implement variable length list. | 1965 Find clean way to implement variable length list. |
1679 See @code{TeX-printer-list} for an explanation. | 1966 See @code{TeX-printer-list} for an explanation. |
1680 | 1967 |
1681 @item | 1968 @item |
1682 @kbd{C-h} in @code{widget-prompt-value} should give type specific help. | 1969 @kbd{C-h} in @code{widget-prompt-value} should give type specific help. |
1683 | 1970 |
1684 @item | 1971 @item |
1685 A mailto widget. | 1972 Add a @code{mailto} widget. |
1686 | 1973 |
1687 @item | 1974 @item |
1688 @kbd{C-e e} in a fixed size field should go to the end of the text in | 1975 @kbd{C-e e} in a fixed size field should go to the end of the text in |
1689 the field, not the end of the field itself. | 1976 the field, not the end of the field itself. |
1690 | 1977 |
1695 @item | 1982 @item |
1696 Clicking on documentation links should call @code{describe-function} or | 1983 Clicking on documentation links should call @code{describe-function} or |
1697 @code{widget-browse-other-window} and friends directly, instead of going | 1984 @code{widget-browse-other-window} and friends directly, instead of going |
1698 through @code{apropos}. If more than one function is valid for the | 1985 through @code{apropos}. If more than one function is valid for the |
1699 symbol, it should pop up a menu. | 1986 symbol, it should pop up a menu. |
1700 | |
1701 @end itemize | 1987 @end itemize |
1702 | 1988 |
1703 @node Widget Internals, , Widget Wishlist, Top | 1989 @node Widget Internals, GNU Free Documentation License, Widget Wishlist, Top |
1704 @section Internals | 1990 @section Internals |
1705 | 1991 |
1706 This (very brief!) section provides a few notes on the internal | 1992 This (very brief!) section provides a few notes on the internal |
1707 structure and implementation of Emacs widgets. Avoid relying on this | 1993 structure and implementation of Emacs widgets. Avoid relying on this |
1708 information. (We intend to improve it, but this will take some time.) | 1994 information. (We intend to improve it, but this will take some time.) |
1728 a type name or a type, and whose cdr is a property list. Furthermore, | 2014 a type name or a type, and whose cdr is a property list. Furthermore, |
1729 all children of the converted widget must be converted. Finally, in the | 2015 all children of the converted widget must be converted. Finally, in the |
1730 process of appropriate parts of the list structure are copied to ensure | 2016 process of appropriate parts of the list structure are copied to ensure |
1731 that changes in values of one instance do not affect another's. | 2017 that changes in values of one instance do not affect another's. |
1732 | 2018 |
1733 @contents | 2019 @node GNU Free Documentation License, Index, Widget Internals, Top |
2020 @appendix GNU Free Documentation License | |
2021 @include doclicense.texi | |
2022 | |
2023 @node Index, , GNU Free Documentation License, Top | |
2024 @comment node-name, next, previous, up | |
2025 @unnumbered Index | |
2026 | |
2027 This is an alphabetical listing of all concepts, functions, commands, | |
2028 variables, and widgets described in this manual. | |
2029 @printindex cp | |
2030 | |
1734 @bye | 2031 @bye |
2032 | |
2033 @ignore | |
2034 arch-tag: 2b427731-4c61-4e72-85de-5ccec9c623f0 | |
2035 @end ignore |