annotate man/lispref/help.texi @ 52:461c7ba8286a r19-16-pre1

Import from CVS: tag r19-16-pre1
author cvs
date Mon, 13 Aug 2007 08:57:19 +0200
parents 376386a54a3c
children 05472e90ae02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 @c -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @c This is part of the XEmacs Lisp Reference Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @c See the file lispref.texi for copying conditions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @setfilename ../../info/help.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @node Documentation, Files, Modes, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @chapter Documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 @cindex documentation strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 XEmacs Lisp has convenient on-line help facilities, most of which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 derive their information from the documentation strings associated with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 functions and variables. This chapter describes how to write good
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 documentation strings for your Lisp programs, as well as how to write
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 programs to access documentation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 Note that the documentation strings for XEmacs are not the same thing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 as the XEmacs manual. Manuals have their own source files, written in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Texinfo language; documentation strings are specified in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 definitions of the functions and variables they apply to. A collection
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 of documentation strings is not sufficient as a manual because a good
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 manual is not organized in that fashion; it is organized in terms of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 topics of discussion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 * Documentation Basics:: Good style for doc strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 Where to put them. How XEmacs stores them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 * Accessing Documentation:: How Lisp programs can access doc strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 * Keys in Documentation:: Substituting current key bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 * Describing Characters:: Making printable descriptions of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 non-printing characters and key sequences.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 * Help Functions:: Subroutines used by XEmacs help facilities.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 * Obsoleteness:: Upgrading Lisp functionality over time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 @node Documentation Basics
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 @section Documentation Basics
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 @cindex documentation conventions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 @cindex writing a documentation string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 @cindex string, writing a doc string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 A documentation string is written using the Lisp syntax for strings,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 with double-quote characters surrounding the text of the string. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 is because it really is a Lisp string object. The string serves as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 documentation when it is written in the proper place in the definition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 of a function or variable. In a function definition, the documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 string follows the argument list. In a variable definition, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 documentation string follows the initial value of the variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 When you write a documentation string, make the first line a complete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 sentence (or two complete sentences) since some commands, such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 @code{apropos}, show only the first line of a multi-line documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 string. Also, you should not indent the second line of a documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 string, if you have one, because that looks odd when you use @kbd{C-h f}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (@code{describe-function}) or @kbd{C-h v} (@code{describe-variable}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 @xref{Documentation Tips}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 Documentation strings may contain several special substrings, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 stand for key bindings to be looked up in the current keymaps when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 documentation is displayed. This allows documentation strings to refer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 to the keys for related commands and be accurate even when a user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 rearranges the key bindings. (@xref{Accessing Documentation}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 Within the Lisp world, a documentation string is accessible through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 the function or variable that it describes:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 The documentation for a function is stored in the function definition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 itself (@pxref{Lambda Expressions}). The function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 @code{documentation} knows how to extract it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 @kindex variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 The documentation for a variable is stored in the variable's property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 list under the property name @code{variable-documentation}. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 function @code{documentation-property} knows how to extract it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 @cindex @file{DOC} (documentation) file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 @cindex @file{emacs/etc/DOC-@var{version}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 @cindex @file{etc/DOC-@var{version}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 To save space, the documentation for preloaded functions and variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (including primitive functions and autoloaded functions) is stored in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 the @dfn{internal doc file} @file{emacs/etc/DOC-@var{version}}. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 documentation for functions and variables loaded during the XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 session from byte-compiled files is stored in those very same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 byte-compiled files (@pxref{Docs and Compilation}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 XEmacs does not keep documentation strings in memory unless necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 Instead, XEmacs maintains, for preloaded symbols, an integer offset into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 the internal doc file, and for symbols loaded from byte-compiled files,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 a list containing the filename of the byte-compiled file and an integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 offset, in place of the documentation string. The functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 @code{documentation} and @code{documentation-property} use that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 information to read the documentation from the appropriate file; this is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 transparent to the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 For information on the uses of documentation strings, see @ref{Help, ,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 Help, emacs, The XEmacs Reference Manual}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 @c Wordy to prevent overfull hbox. --rjc 15mar92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 The @file{emacs/lib-src} directory contains two utilities that you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 use to print nice-looking hardcopy for the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 @file{emacs/etc/DOC-@var{version}}. These are @file{sorted-doc.c} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 @file{digest-doc.c}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 @node Accessing Documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 @section Access to Documentation Strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 @defun documentation-property symbol property &optional verbatim
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 This function returns the documentation string that is recorded in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 @var{symbol}'s property list under property @var{property}. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 retrieves the text from a file if necessary, and runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 @code{substitute-command-keys} to substitute actual key bindings. (This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 substitution is not done if @var{verbatim} is non-@code{nil}; the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 @var{verbatim} argument exists only as of Emacs 19.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (documentation-property 'command-line-processed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 'variable-documentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 @result{} "t once command line has been processed"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (symbol-plist 'command-line-processed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 @result{} (variable-documentation 188902)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 @defun documentation function &optional verbatim
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 This function returns the documentation string of @var{function}. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 reads the text from a file if necessary. Then (unless @var{verbatim} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 non-@code{nil}) it calls @code{substitute-command-keys}, to return a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 value containing the actual (current) key bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 The function @code{documentation} signals a @code{void-function} error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 if @var{function} has no function definition. However, it is ok if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 the function definition has no documentation string. In that case,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 @code{documentation} returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 @c Wordy to prevent overfull hboxes. --rjc 15mar92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 Here is an example of using the two functions, @code{documentation} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 @code{documentation-property}, to display the documentation strings for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 several symbols in a @samp{*Help*} buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (defun describe-symbols (pattern)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 "Describe the XEmacs Lisp symbols matching PATTERN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 All symbols that have PATTERN in their name are described
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 in the `*Help*' buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (interactive "sDescribe symbols matching: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (let ((describe-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (lambda (s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;; @r{Print description of symbol.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (if (fboundp s) ; @r{It is a function.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (princ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (format "%s\t%s\n%s\n\n" s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (if (commandp s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (let ((keys (where-is-internal s)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (if keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 "Keys: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (mapconcat 'key-description
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 keys " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 "Keys: none"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 "Function")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (or (documentation s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 "not documented"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (if (boundp s) ; @r{It is a variable.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (princ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (format "%s\t%s\n%s\n\n" s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (if (user-variable-p s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 "Option " "Variable")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (or (documentation-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 s 'variable-documentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 "not documented")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 sym-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;; @r{Build a list of symbols that match pattern.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (mapatoms (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (lambda (sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (if (string-match pattern (symbol-name sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (setq sym-list (cons sym sym-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;; @r{Display the data.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (with-output-to-temp-buffer "*Help*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (mapcar describe-func (sort sym-list 'string<))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (print-help-return-message))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 The @code{describe-symbols} function works like @code{apropos},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 but provides more information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (describe-symbols "goal")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ---------- Buffer: *Help* ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 goal-column Option
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 *Semipermanent goal column for vertical motion, as set by C-x C-n, or nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 @c Do not blithely break or fill these lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 @c That makes them incorrect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 set-goal-column Command: C-x C-n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 Set the current horizontal position as a goal for C-n and C-p.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 @c DO NOT put a blank line here! That is factually inaccurate!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 Those commands will move to this position in the line moved to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 rather than trying to keep the same horizontal position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 With a non-nil argument, clears out the goal column
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 so that C-n and C-p resume vertical motion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 The goal column is stored in the variable `goal-column'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 temporary-goal-column Variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 Current goal column for vertical motion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 It is the column where point was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 at the start of current run of vertical motion commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 When the `track-eol' feature is doing its job, the value is 9999.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ---------- Buffer: *Help* ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 @defun Snarf-documentation filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 This function is used only during XEmacs initialization, just before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 the runnable XEmacs is dumped. It finds the file offsets of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 documentation strings stored in the file @var{filename}, and records
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 them in the in-core function definitions and variable property lists in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 place of the actual strings. @xref{Building XEmacs}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 XEmacs finds the file @var{filename} in the @file{xemacs/lib-src}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 directory. When the dumped XEmacs is later executed, the same file is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 found in the directory @code{doc-directory}. Usually @var{filename} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 @file{"DOC-@var{version}"}, but this can be changed by modifying the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 variable @code{internal-doc-file-name}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @defvar internal-doc-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 This variable holds the name of the file containing documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 strings of built-in symbols, usually @file{"DOC-@var{version}"}. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 full pathname of the internal doc file is @samp{(concat doc-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 internal-doc-file-name)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 @defvar doc-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 This variable holds the name of the directory which contains the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 @dfn{internal doc file} that contains documentation strings for built-in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 and preloaded functions and variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 In most cases, this is the same as @code{exec-directory}. They may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 different when you run XEmacs from the directory where you built it,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 without actually installing it. See @code{exec-directory} in @ref{Help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 Functions}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 In older Emacs versions, @code{exec-directory} was used for this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 @defvar data-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 This variable holds the name of the directory in which XEmacs finds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 certain system independent documentation and text files that come
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 with XEmacs. In older Emacs versions, @code{exec-directory} was used for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 @node Keys in Documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 @section Substituting Key Bindings in Documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 @cindex documentation, keys in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 @cindex keys in documentation strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 @cindex substituting keys in documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 When documentation strings refer to key sequences, they should use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 current, actual key bindings. They can do so using certain special text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 sequences described below. Accessing documentation strings in the usual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 way substitutes current key binding information for these special
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 sequences. This works by calling @code{substitute-command-keys}. You
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 can also call that function yourself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 Here is a list of the special sequences and what they mean:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 @item \[@var{command}]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 stands for a key sequence that will invoke @var{command}, or @samp{M-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 @var{command}} if @var{command} has no key bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 @item \@{@var{mapvar}@}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 stands for a summary of the value of @var{mapvar}, which should be a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 keymap. The summary is made by @code{describe-bindings}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 @item \<@var{mapvar}>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 stands for no text itself. It is used for a side effect: it specifies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 @var{mapvar} as the keymap for any following @samp{\[@var{command}]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 sequences in this documentation string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 @item \=
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 quotes the following character and is discarded; this @samp{\=\=} puts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 @samp{\=} into the output, and @samp{\=\[} puts @samp{\[} into the output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 @strong{Please note:} Each @samp{\} must be doubled when written in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 string in XEmacs Lisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 @defun substitute-command-keys string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 This function scans @var{string} for the above special sequences and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 replaces them by what they stand for, returning the result as a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 This permits display of documentation that refers accurately to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 user's own customized key bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 Here are examples of the special sequences:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (substitute-command-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 "To abort recursive edit, type: \\[abort-recursive-edit]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 @result{} "To abort recursive edit, type: C-]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (substitute-command-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 "The keys that are defined for the minibuffer here are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 \\@{minibuffer-local-must-match-map@}")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 @result{} "The keys that are defined for the minibuffer here are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ? minibuffer-completion-help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 SPC minibuffer-complete-word
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 TAB minibuffer-complete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 LFD minibuffer-complete-and-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 RET minibuffer-complete-and-exit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 C-g abort-recursive-edit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (substitute-command-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 "To abort a recursive edit from the minibuffer, type\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 \\<minibuffer-local-must-match-map>\\[abort-recursive-edit].")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 @result{} "To abort a recursive edit from the minibuffer, type C-g."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (substitute-command-keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 "Substrings of the form \\=\\@{MAPVAR@} are replaced by summaries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 \(made by describe-bindings) of the value of MAPVAR, taken as a keymap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 Substrings of the form \\=\\<MAPVAR> specify to use the value of MAPVAR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 as the keymap for future \\=\\[COMMAND] substrings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 \\=\\= quotes the following character and is discarded;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 thus, \\=\\=\\=\\= puts \\=\\= into the output,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 and \\=\\=\\=\\[ puts \\=\\[ into the output.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 @result{} "Substrings of the form \@{MAPVAR@} are replaced by summaries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (made by describe-bindings) of the value of MAPVAR, taken as a keymap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 Substrings of the form \<MAPVAR> specify to use the value of MAPVAR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 as the keymap for future \[COMMAND] substrings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 \= quotes the following character and is discarded;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 thus, \=\= puts \= into the output,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 and \=\[ puts \[ into the output."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 @node Describing Characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 @section Describing Characters for Help Messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 These functions convert events, key sequences or characters to textual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 descriptions. These descriptions are useful for including arbitrary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 text characters or key sequences in messages, because they convert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 non-printing and whitespace characters to sequences of printing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 characters. The description of a non-whitespace printing character is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 the character itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 @defun key-description sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 @cindex XEmacs event standard notation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 This function returns a string containing the XEmacs standard notation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 for the input events in @var{sequence}. The argument @var{sequence} may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 be a string, vector or list. @xref{Events}, for more information about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 valid events. See also the examples for @code{single-key-description},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 @defun single-key-description key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 @cindex event printing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 @cindex character printing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @cindex control character printing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 @cindex meta character printing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 This function returns a string describing @var{key} in the standard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 XEmacs notation for keyboard input. A normal printing character appears
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 as itself, but a control character turns into a string starting with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 @samp{C-}, a meta character turns into a string starting with @samp{M-},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 and space, linefeed, etc.@: appear as @samp{SPC}, @samp{LFD}, etc. A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 symbol appears as the name of the symbol. An event that is a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 appears as the name of the symbol in the @sc{car} of the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (single-key-description ?\C-x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 @result{} "C-x"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (key-description "\C-x \M-y \n \t \r \f123")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 @result{} "C-x SPC M-y SPC LFD SPC TAB SPC RET SPC C-l 1 2 3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 @group
52
461c7ba8286a Import from CVS: tag r19-16-pre1
cvs
parents: 0
diff changeset
423 (single-key-description 'kp-next)
461c7ba8286a Import from CVS: tag r19-16-pre1
cvs
parents: 0
diff changeset
424 @result{} "kp-next"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (single-key-description '(shift button1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 @result{} "Sh-button1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 @defun text-char-description character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 This function returns a string describing @var{character} in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 standard XEmacs notation for characters that appear in text---like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 @code{single-key-description}, except that control characters are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 represented with a leading caret (which is how control characters in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 XEmacs buffers are usually displayed).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (text-char-description ?\C-c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 @result{} "^C"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (text-char-description ?\M-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 @result{} "M-m"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (text-char-description ?\C-\M-m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 @result{} "M-^M"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 @node Help Functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 @section Help Functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 XEmacs provides a variety of on-line help functions, all accessible to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 the user as subcommands of the prefix @kbd{C-h}, or on some keyboards,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 @kbd{help}. For more information about them, see @ref{Help, , Help,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 emacs, The XEmacs Reference Manual}. Here we describe some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 program-level interfaces to the same information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 @deffn Command apropos regexp &optional do-all predicate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 This function finds all symbols whose names contain a match for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 regular expression @var{regexp}, and returns a list of them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (@pxref{Regular Expressions}). It also displays the symbols in a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 named @samp{*Help*}, each with a one-line description.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 If @var{do-all} is non-@code{nil}, then @code{apropos} also shows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 key bindings for the functions that are found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 If @var{predicate} is non-@code{nil}, it should be a function to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 called on each symbol that has matched @var{regexp}. Only symbols for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 which @var{predicate} returns a non-@code{nil} value are listed or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 In the first of the following examples, @code{apropos} finds all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 symbols with names containing @samp{exec}. In the second example, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 finds and returns only those symbols that are also commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (We don't show the output that results in the @samp{*Help*} buffer.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (apropos "exec")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 @result{} (Buffer-menu-execute command-execute exec-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 exec-path execute-extended-command execute-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 executing-kbd-macro executing-macro)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (apropos "exec" nil 'commandp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 @result{} (Buffer-menu-execute execute-extended-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ---------- Buffer: *Help* ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 Buffer-menu-execute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 Function: Save and/or delete buffers marked with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 M-x Buffer-menu-save or M-x Buffer-menu-delete commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 execute-extended-command ESC x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 Function: Read function name, then read its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 arguments and call it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 ---------- Buffer: *Help* ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @code{apropos} is used by various user-level commands, such as @kbd{C-h
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 a} (@code{hyper-apropos}), a graphical front-end to @code{apropos}; and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 @kbd{C-h A} (@code{command-apropos}), which does an apropos over only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 those functions which are user commands. @code{command-apropos} calls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 @code{apropos}, specifying a @var{predicate} to restrict the output to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 symbols that are commands. The call to @code{apropos} looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (apropos string t 'commandp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 @c super-apropos is obsolete - function absorbed by apropos --mrb
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 @deffn Command super-apropos regexp &optional do-all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 This function differs from @code{apropos} in that it searches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 documentation strings as well as symbol names for matches for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 @var{regexp}. By default, it searches the documentation strings only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 for preloaded functions and variables. If @var{do-all} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 non-@code{nil}, it scans the names and documentation strings of all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 functions and variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 @defvar help-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 The value of this variable is a local keymap for characters following the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 Help key, @kbd{C-h}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 @deffn {Prefix Command} help-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 This symbol is not a function; its function definition is actually the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 keymap known as @code{help-map}. It is defined in @file{help.el} as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (define-key global-map "\C-h" 'help-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (fset 'help-command help-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 @defun print-help-return-message &optional function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 This function builds a string that explains how to restore the previous
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 state of the windows after a help command. After building the message,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 it applies @var{function} to it if @var{function} is non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 Otherwise it calls @code{message} to display it in the echo area.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 This function expects to be called inside a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 @code{with-output-to-temp-buffer} special form, and expects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 @code{standard-output} to have the value bound by that special form.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 For an example of its use, see the long example in @ref{Accessing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 Documentation}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 @defvar help-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 The value of this variable is the help character---the character that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 XEmacs recognizes as meaning Help. By default, it is the character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 @samp{?\^H} (ASCII 8), which is @kbd{C-h}. When XEmacs reads this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 character, if @code{help-form} is non-@code{nil} Lisp expression, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 evaluates that expression, and displays the result in a window if it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 @code{help-char} can be a character or a key description such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 @code{help} or @code{(meta h)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 Usually the value of @code{help-form}'s value is @code{nil}. Then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 help character has no special meaning at the level of command input, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 it becomes part of a key sequence in the normal way. The standard key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 binding of @kbd{C-h} is a prefix key for several general-purpose help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 features.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 The help character is special after prefix keys, too. If it has no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 binding as a subcommand of the prefix key, it runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 @code{describe-prefix-bindings}, which displays a list of all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 subcommands of the prefix key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 @defvar help-form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 If this variable is non-@code{nil}, its value is a form to evaluate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 whenever the character @code{help-char} is read. If evaluating the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 produces a string, that string is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 A command that calls @code{next-command-event} or @code{next-event}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 probably should bind @code{help-form} to a non-@code{nil} expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 while it does input. (The exception is when @kbd{C-h} is meaningful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 input.) Evaluating this expression should result in a string that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 explains what the input is for and how to enter it properly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 Entry to the minibuffer binds this variable to the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 @code{minibuffer-help-form} (@pxref{Minibuffer Misc}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 @defvar prefix-help-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 This variable holds a function to print help for a prefix character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 The function is called when the user types a prefix key followed by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 help character, and the help character has no binding after that prefix.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 The variable's default value is @code{describe-prefix-bindings}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 @defun describe-prefix-bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 This function calls @code{describe-bindings} to display a list of all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 the subcommands of the prefix key of the most recent key sequence. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 prefix described consists of all but the last event of that key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 sequence. (The last event is, presumably, the help character.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 The following two functions are found in the library @file{helper}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 They are for modes that want to provide help without relinquishing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 control, such as the ``electric'' modes. You must load that library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 with @code{(require 'helper)} in order to use them. Their names begin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 with @samp{Helper} to distinguish them from the ordinary help functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 @deffn Command Helper-describe-bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 This command pops up a window displaying a help buffer containing a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 listing of all of the key bindings from both the local and global keymaps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 It works by calling @code{describe-bindings}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 @deffn Command Helper-help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 This command provides help for the current mode. It prompts the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 in the minibuffer with the message @samp{Help (Type ? for further
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 options)}, and then provides assistance in finding out what the key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 bindings are, and what the mode is intended for. It returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 This can be customized by changing the map @code{Helper-help-map}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 @ignore @c Not in XEmacs currently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 @defmac make-help-screen fname help-line help-text help-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 This macro defines a help command named @var{fname} that acts like a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 prefix key that shows a list of the subcommands it offers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 When invoked, @var{fname} displays @var{help-text} in a window, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 reads and executes a key sequence according to @var{help-map}. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 string @var{help-text} should describe the bindings available in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 @var{help-map}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 The command @var{fname} is defined to handle a few events itself, by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 scrolling the display of @var{help-text}. When @var{fname} reads one of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 those special events, it does the scrolling and then reads another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 event. When it reads an event that is not one of those few, and which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 has a binding in @var{help-map}, it executes that key's binding and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 then returns.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 The argument @var{help-line} should be a single-line summary of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 alternatives in @var{help-map}. In the current version of Emacs, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 argument is used only if you set the option @code{three-step-help} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 @code{t}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 @end defmac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 @defopt three-step-help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 If this variable is non-@code{nil}, commands defined with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 @code{make-help-screen} display their @var{help-line} strings in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 echo area at first, and display the longer @var{help-text} strings only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 if the user types the help character again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 @node Obsoleteness
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 @section Obsoleteness
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 As you add functionality to a package, you may at times want to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 replace an older function with a new one. To preserve compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 with existing code, the older function needs to still exist; but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 users of that function should be told to use the newer one instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 XEmacs Lisp lets you mark a function or variable as @dfn{obsolete},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 and indicate what should be used instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 @defun make-obsolete function new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 This function indicates that @var{function} is an obsolete function,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 and the function @var{new} should be used instead. The byte compiler
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 will issue a warning to this effect when it encounters a usage of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 older function, and the help system will also note this in the function's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 documentation. @var{new} can also be a string (if there is not a single
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 function with the same functionality any more), and should be a descriptive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 statement, such as "use @var{foo} or @var{bar} instead" or "this function is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 unnecessary".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 @defun make-obsolete-variable variable new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 This is like @code{make-obsolete} but is for variables instead of functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 @defun define-obsolete-function-alias oldfun newfun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 This function combines @code{make-obsolete} and @code{define-function},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 declaring @var{oldfun} to be an obsolete variant of @var{newfun} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 defining @var{oldfun} as an alias for @var{newfun}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 @defun define-obsolete-variable-alias oldvar newvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 This is like @code{define-obsolete-function-alias} but for variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 Note that you should not normally put obsoleteness information
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 explicitly in a function or variable's doc string. The obsoleteness
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 information that you specify using the above functions will be displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 whenever the doc string is displayed, and by adding it explicitly the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 result is redundancy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 Also, if an obsolete function is substantially the same as a newer one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 but is not actually an alias, you should consider omitting the doc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 string entirely (use a null string @samp{""} as the doc string). That
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 way, the user is told about the obsoleteness and is forced to look at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 the documentation of the new function, making it more likely that he
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 will use the new function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 @defun function-obsoleteness-doc function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 If @var{function} is obsolete, this function returns a string describing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 this. This is the message that is printed out during byte compilation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 or in the function's documentation. If @var{function} is not obsolete,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 @code{nil} is returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 @defun variable-obsoleteness-doc variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 This is like @code{function-obsoleteness-doc} but for variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 The obsoleteness information is stored internally by putting a property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 @code{byte-obsolete-info} (for functions) or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 @code{byte-obsolete-variable} (for variables) on the symbol that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 specifies the obsolete function or variable. For more information, see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 the implementation of @code{make-obsolete} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 @code{make-obsolete-variable} in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 @file{lisp/bytecomp/bytecomp-runtime.el}.