]> code.delx.au - gnu-emacs/blob - doc/lispref/help.texi
Merge from emacs-24; up to 2012-05-07T14:57:18Z!michael.albinus@gmx.de
[gnu-emacs] / doc / lispref / help.texi
1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
4 @c Free Software Foundation, Inc.
5 @c See the file elisp.texi for copying conditions.
6 @node Documentation
7 @chapter Documentation
8 @cindex documentation strings
9
10 GNU Emacs has convenient built-in help facilities, most of which
11 derive their information from documentation strings associated with
12 functions and variables. This chapter describes how to access
13 documentation strings in Lisp programs. @xref{Documentation Tips},
14 for how to write good documentation strings.
15
16 Note that the documentation strings for Emacs are not the same thing
17 as the Emacs manual. Manuals have their own source files, written in
18 the Texinfo language; documentation strings are specified in the
19 definitions of the functions and variables they apply to. A collection
20 of documentation strings is not sufficient as a manual because a good
21 manual is not organized in that fashion; it is organized in terms of
22 topics of discussion.
23
24 For commands to display documentation strings, see @ref{Help, ,
25 Help, emacs, The GNU Emacs Manual}.
26
27 @menu
28 * Documentation Basics:: Where doc strings are defined and stored.
29 * Accessing Documentation:: How Lisp programs can access doc strings.
30 * Keys in Documentation:: Substituting current key bindings.
31 * Describing Characters:: Making printable descriptions of
32 non-printing characters and key sequences.
33 * Help Functions:: Subroutines used by Emacs help facilities.
34 @end menu
35
36 @node Documentation Basics
37 @section Documentation Basics
38 @cindex documentation conventions
39 @cindex writing a documentation string
40 @cindex string, writing a doc string
41
42 A documentation string is written using the Lisp syntax for strings,
43 with double-quote characters surrounding the text of the string. This
44 is because it really is a Lisp string object. The string serves as
45 documentation when it is written in the proper place in the definition
46 of a function or variable. In a function definition, the documentation
47 string follows the argument list. In a variable definition, the
48 documentation string follows the initial value of the variable.
49
50 When you write a documentation string, make the first line a
51 complete sentence (or two complete sentences) that briefly describes
52 what the function or variable does. Some commands, such as
53 @code{apropos}, show only the first line of a multi-line documentation
54 string. Also, you should not indent the second line of a
55 documentation string, if it has one, because that looks odd when you
56 use @kbd{C-h f} (@code{describe-function}) or @kbd{C-h v}
57 (@code{describe-variable}) to view the documentation string. There
58 are many other conventions for documentation strings; see
59 @ref{Documentation Tips}.
60
61 Documentation strings can contain several special substrings, which
62 stand for key bindings to be looked up in the current keymaps when the
63 documentation is displayed. This allows documentation strings to refer
64 to the keys for related commands and be accurate even when a user
65 rearranges the key bindings. (@xref{Keys in Documentation}.)
66
67 @vindex emacs-lisp-docstring-fill-column
68 Emacs Lisp mode fills documentation strings to the width
69 specified by @code{emacs-lisp-docstring-fill-column}.
70
71 Exactly where a documentation string is stored depends on how its
72 function or variable was defined or loaded into memory:
73
74 @itemize @bullet
75 @item
76 @kindex function-documentation
77 When you define a function (@pxref{Lambda Expressions}, and
78 @pxref{Function Documentation}), the documentation string is stored in
79 the function definition itself. You can also put function
80 documentation in the @code{function-documentation} property of a
81 function name. That is useful for function definitions which can't
82 hold a documentation string, such as keyboard macros.
83
84 @item
85 @kindex variable-documentation
86 When you define a variable with a @code{defvar} or related form
87 (@pxref{Defining Variables}), the documentation is stored in the
88 variable's @code{variable-documentation} property.
89
90 @cindex @file{DOC-@var{version}} (documentation) file
91 @item
92 To save memory, the documentation for preloaded functions and
93 variables (including primitive functions and autoloaded functions) is
94 not kept in memory, but in the file
95 @file{emacs/etc/DOC-@var{version}}, where @var{version} is the Emacs
96 version number (@pxref{Version Info}).
97
98 @item
99 When a function or variable is loaded from a byte-compiled file during
100 the Emacs session, its documentation string is not loaded into memory.
101 Instead, Emacs looks it up in the byte-compiled file as needed.
102 @xref{Docs and Compilation}.
103 @end itemize
104
105 @noindent
106 Regardless of where the documentation string is stored, you can
107 retrieve it using the @code{documentation} or
108 @code{documentation-property} function, described in the next section.
109
110 @node Accessing Documentation
111 @section Access to Documentation Strings
112
113 @defun documentation-property symbol property &optional verbatim
114 This function returns the documentation string recorded in
115 @var{symbol}'s property list under property @var{property}. It is
116 most often used to look up the documentation strings of variables, for
117 which @var{property} is @code{variable-documentation}. However, it
118 can also be used to look up other kinds of documentation, such as for
119 customization groups (but for function documentation, use the
120 @code{documentation} command, below).
121
122 If the value recorded in the property list refers to a documentation
123 string stored in a @file{DOC-@var{version}} file or a byte-compiled
124 file, it looks up that string and returns it. If the property value
125 isn't @code{nil}, isn't a string, and doesn't refer to text in a file,
126 then it is evaluated as a Lisp expression to obtain a string.
127
128 The last thing this function does is pass the string through
129 @code{substitute-command-keys} to substitute actual key bindings
130 (@pxref{Keys in Documentation}). However, it skips this step if
131 @var{verbatim} is non-@code{nil}.
132
133 @smallexample
134 @group
135 (documentation-property 'command-line-processed
136 'variable-documentation)
137 @result{} "Non-nil once command line has been processed"
138 @end group
139 @group
140 (symbol-plist 'command-line-processed)
141 @result{} (variable-documentation 188902)
142 @end group
143 @group
144 (documentation-property 'emacs 'group-documentation)
145 @result{} "Customization of the One True Editor."
146 @end group
147 @end smallexample
148 @end defun
149
150 @defun documentation function &optional verbatim
151 This function returns the documentation string of @var{function}. It
152 handles macros, named keyboard macros, and special forms, as well as
153 ordinary functions.
154
155 If @var{function} is a symbol, this function first looks for the
156 @code{function-documentation} property of that symbol; if that has a
157 non-@code{nil} value, the documentation comes from that value (if the
158 value is not a string, it is evaluated). If @var{function} is not a
159 symbol, or if it has no @code{function-documentation} property, then
160 @code{documentation} extracts the documentation string from the actual
161 function definition, reading it from a file if called for.
162
163 Finally, unless @var{verbatim} is non-@code{nil}, it calls
164 @code{substitute-command-keys} so as to return a value containing the
165 actual (current) key bindings.
166
167 The function @code{documentation} signals a @code{void-function} error
168 if @var{function} has no function definition. However, it is OK if
169 the function definition has no documentation string. In that case,
170 @code{documentation} returns @code{nil}.
171 @end defun
172
173 @defun face-documentation face
174 This function returns the documentation string of @var{face} as a
175 face.
176 @end defun
177
178 @c Wordy to prevent overfull hboxes. --rjc 15mar92
179 Here is an example of using the two functions, @code{documentation} and
180 @code{documentation-property}, to display the documentation strings for
181 several symbols in a @file{*Help*} buffer.
182
183 @anchor{describe-symbols example}
184 @smallexample
185 @group
186 (defun describe-symbols (pattern)
187 "Describe the Emacs Lisp symbols matching PATTERN.
188 All symbols that have PATTERN in their name are described
189 in the `*Help*' buffer."
190 (interactive "sDescribe symbols matching: ")
191 (let ((describe-func
192 (function
193 (lambda (s)
194 @end group
195 @group
196 ;; @r{Print description of symbol.}
197 (if (fboundp s) ; @r{It is a function.}
198 (princ
199 (format "%s\t%s\n%s\n\n" s
200 (if (commandp s)
201 (let ((keys (where-is-internal s)))
202 (if keys
203 (concat
204 "Keys: "
205 (mapconcat 'key-description
206 keys " "))
207 "Keys: none"))
208 "Function")
209 @end group
210 @group
211 (or (documentation s)
212 "not documented"))))
213
214 (if (boundp s) ; @r{It is a variable.}
215 @end group
216 @group
217 (princ
218 (format "%s\t%s\n%s\n\n" s
219 (if (custom-variable-p s)
220 "Option " "Variable")
221 @end group
222 @group
223 (or (documentation-property
224 s 'variable-documentation)
225 "not documented")))))))
226 sym-list)
227 @end group
228
229 @group
230 ;; @r{Build a list of symbols that match pattern.}
231 (mapatoms (function
232 (lambda (sym)
233 (if (string-match pattern (symbol-name sym))
234 (setq sym-list (cons sym sym-list))))))
235 @end group
236
237 @group
238 ;; @r{Display the data.}
239 (help-setup-xref (list 'describe-symbols pattern) (interactive-p))
240 (with-help-window (help-buffer)
241 (mapcar describe-func (sort sym-list 'string<)))))
242 @end group
243 @end smallexample
244
245 The @code{describe-symbols} function works like @code{apropos},
246 but provides more information.
247
248 @smallexample
249 @group
250 (describe-symbols "goal")
251
252 ---------- Buffer: *Help* ----------
253 goal-column Option
254 Semipermanent goal column for vertical motion, as set by @dots{}
255 @end group
256 @c Do not blithely break or fill these lines.
257 @c That makes them incorrect.
258
259 @group
260 set-goal-column Keys: C-x C-n
261 Set the current horizontal position as a goal for C-n and C-p.
262 @end group
263 @c DO NOT put a blank line here! That is factually inaccurate!
264 @group
265 Those commands will move to this position in the line moved to
266 rather than trying to keep the same horizontal position.
267 With a non-nil argument, clears out the goal column
268 so that C-n and C-p resume vertical motion.
269 The goal column is stored in the variable `goal-column'.
270 @end group
271
272 @group
273 temporary-goal-column Variable
274 Current goal column for vertical motion.
275 It is the column where point was
276 at the start of current run of vertical motion commands.
277 When the `track-eol' feature is doing its job, the value is 9999.
278 ---------- Buffer: *Help* ----------
279 @end group
280 @end smallexample
281
282 @anchor{Definition of Snarf-documentation}
283 @defun Snarf-documentation filename
284 This function is used when building Emacs, just before the runnable
285 Emacs is dumped. It finds the positions of the documentation strings
286 stored in the file @var{filename}, and records those positions into
287 memory in the function definitions and variable property lists.
288 @xref{Building Emacs}.
289
290 Emacs reads the file @var{filename} from the @file{emacs/etc} directory.
291 When the dumped Emacs is later executed, the same file will be looked
292 for in the directory @code{doc-directory}. Usually @var{filename} is
293 @code{"DOC-@var{version}"}.
294 @end defun
295
296 @defvar doc-directory
297 This variable holds the name of the directory which should contain the
298 file @code{"DOC-@var{version}"} that contains documentation strings for
299 built-in and preloaded functions and variables.
300
301 In most cases, this is the same as @code{data-directory}. They may be
302 different when you run Emacs from the directory where you built it,
303 without actually installing it. @xref{Definition of data-directory}.
304 @end defvar
305
306 @node Keys in Documentation
307 @section Substituting Key Bindings in Documentation
308 @cindex documentation, keys in
309 @cindex keys in documentation strings
310 @cindex substituting keys in documentation
311
312 When documentation strings refer to key sequences, they should use the
313 current, actual key bindings. They can do so using certain special text
314 sequences described below. Accessing documentation strings in the usual
315 way substitutes current key binding information for these special
316 sequences. This works by calling @code{substitute-command-keys}. You
317 can also call that function yourself.
318
319 Here is a list of the special sequences and what they mean:
320
321 @table @code
322 @item \[@var{command}]
323 stands for a key sequence that will invoke @var{command}, or @samp{M-x
324 @var{command}} if @var{command} has no key bindings.
325
326 @item \@{@var{mapvar}@}
327 stands for a summary of the keymap which is the value of the variable
328 @var{mapvar}. The summary is made using @code{describe-bindings}.
329
330 @item \<@var{mapvar}>
331 stands for no text itself. It is used only for a side effect: it
332 specifies @var{mapvar}'s value as the keymap for any following
333 @samp{\[@var{command}]} sequences in this documentation string.
334
335 @item \=
336 quotes the following character and is discarded; thus, @samp{\=\[} puts
337 @samp{\[} into the output, and @samp{\=\=} puts @samp{\=} into the
338 output.
339 @end table
340
341 @strong{Please note:} Each @samp{\} must be doubled when written in a
342 string in Emacs Lisp.
343
344 @defun substitute-command-keys string
345 This function scans @var{string} for the above special sequences and
346 replaces them by what they stand for, returning the result as a string.
347 This permits display of documentation that refers accurately to the
348 user's own customized key bindings.
349
350 @cindex advertised binding
351 If a command has multiple bindings, this function normally uses the
352 first one it finds. You can specify one particular key binding by
353 assigning an @code{:advertised-binding} symbol property to the
354 command, like this:
355
356 @smallexample
357 (put 'undo :advertised-binding [?\C-/])
358 @end smallexample
359
360 @noindent
361 The @code{:advertised-binding} property also affects the binding shown
362 in menu items (@pxref{Menu Bar}). The property is ignored if it
363 specifies a key binding that the command does not actually have.
364 @end defun
365
366 Here are examples of the special sequences:
367
368 @smallexample
369 @group
370 (substitute-command-keys
371 "To abort recursive edit, type: \\[abort-recursive-edit]")
372 @result{} "To abort recursive edit, type: C-]"
373 @end group
374
375 @group
376 (substitute-command-keys
377 "The keys that are defined for the minibuffer here are:
378 \\@{minibuffer-local-must-match-map@}")
379 @result{} "The keys that are defined for the minibuffer here are:
380 @end group
381
382 ? minibuffer-completion-help
383 SPC minibuffer-complete-word
384 TAB minibuffer-complete
385 C-j minibuffer-complete-and-exit
386 RET minibuffer-complete-and-exit
387 C-g abort-recursive-edit
388 "
389
390 @group
391 (substitute-command-keys
392 "To abort a recursive edit from the minibuffer, type\
393 \\<minibuffer-local-must-match-map>\\[abort-recursive-edit].")
394 @result{} "To abort a recursive edit from the minibuffer, type C-g."
395 @end group
396 @end smallexample
397
398 There are other special conventions for the text in documentation
399 strings---for instance, you can refer to functions, variables, and
400 sections of this manual. @xref{Documentation Tips}, for details.
401
402 @node Describing Characters
403 @section Describing Characters for Help Messages
404 @cindex describe characters and events
405
406 These functions convert events, key sequences, or characters to
407 textual descriptions. These descriptions are useful for including
408 arbitrary text characters or key sequences in messages, because they
409 convert non-printing and whitespace characters to sequences of printing
410 characters. The description of a non-whitespace printing character is
411 the character itself.
412
413 @defun key-description sequence &optional prefix
414 @cindex Emacs event standard notation
415 This function returns a string containing the Emacs standard notation
416 for the input events in @var{sequence}. If @var{prefix} is
417 non-@code{nil}, it is a sequence of input events leading up to
418 @var{sequence} and is included in the return value. Both arguments
419 may be strings, vectors or lists. @xref{Input Events}, for more
420 information about valid events.
421
422 @smallexample
423 @group
424 (key-description [?\M-3 delete])
425 @result{} "M-3 <delete>"
426 @end group
427 @group
428 (key-description [delete] "\M-3")
429 @result{} "M-3 <delete>"
430 @end group
431 @end smallexample
432
433 See also the examples for @code{single-key-description}, below.
434 @end defun
435
436 @defun single-key-description event &optional no-angles
437 @cindex event printing
438 @cindex character printing
439 @cindex control character printing
440 @cindex meta character printing
441 This function returns a string describing @var{event} in the standard
442 Emacs notation for keyboard input. A normal printing character
443 appears as itself, but a control character turns into a string
444 starting with @samp{C-}, a meta character turns into a string starting
445 with @samp{M-}, and space, tab, etc.@: appear as @samp{SPC},
446 @samp{TAB}, etc. A function key symbol appears inside angle brackets
447 @samp{<@dots{}>}. An event that is a list appears as the name of the
448 symbol in the @sc{car} of the list, inside angle brackets.
449
450 If the optional argument @var{no-angles} is non-@code{nil}, the angle
451 brackets around function keys and event symbols are omitted; this is
452 for compatibility with old versions of Emacs which didn't use the
453 brackets.
454
455 @smallexample
456 @group
457 (single-key-description ?\C-x)
458 @result{} "C-x"
459 @end group
460 @group
461 (key-description "\C-x \M-y \n \t \r \f123")
462 @result{} "C-x SPC M-y SPC C-j SPC TAB SPC RET SPC C-l 1 2 3"
463 @end group
464 @group
465 (single-key-description 'delete)
466 @result{} "<delete>"
467 @end group
468 @group
469 (single-key-description 'C-mouse-1)
470 @result{} "<C-mouse-1>"
471 @end group
472 @group
473 (single-key-description 'C-mouse-1 t)
474 @result{} "C-mouse-1"
475 @end group
476 @end smallexample
477 @end defun
478
479 @defun text-char-description character
480 This function returns a string describing @var{character} in the
481 standard Emacs notation for characters that appear in text---like
482 @code{single-key-description}, except that control characters are
483 represented with a leading caret (which is how control characters in
484 Emacs buffers are usually displayed). Another difference is that
485 @code{text-char-description} recognizes the 2**7 bit as the Meta
486 character, whereas @code{single-key-description} uses the 2**27 bit
487 for Meta.
488
489 @smallexample
490 @group
491 (text-char-description ?\C-c)
492 @result{} "^C"
493 @end group
494 @group
495 (text-char-description ?\M-m)
496 @result{} "\xed"
497 @end group
498 @group
499 (text-char-description ?\C-\M-m)
500 @result{} "\x8d"
501 @end group
502 @group
503 (text-char-description (+ 128 ?m))
504 @result{} "M-m"
505 @end group
506 @group
507 (text-char-description (+ 128 ?\C-m))
508 @result{} "M-^M"
509 @end group
510 @end smallexample
511 @end defun
512
513 @deffn Command read-kbd-macro string &optional need-vector
514 This function is used mainly for operating on keyboard macros, but it
515 can also be used as a rough inverse for @code{key-description}. You
516 call it with a string containing key descriptions, separated by spaces;
517 it returns a string or vector containing the corresponding events.
518 (This may or may not be a single valid key sequence, depending on what
519 events you use; @pxref{Key Sequences}.) If @var{need-vector} is
520 non-@code{nil}, the return value is always a vector.
521 @end deffn
522
523 @node Help Functions
524 @section Help Functions
525
526 Emacs provides a variety of on-line help functions, all accessible to
527 the user as subcommands of the prefix @kbd{C-h}. For more information
528 about them, see @ref{Help, , Help, emacs, The GNU Emacs Manual}. Here
529 we describe some program-level interfaces to the same information.
530
531 @deffn Command apropos pattern &optional do-all
532 This function finds all ``meaningful'' symbols whose names contain a
533 match for the apropos pattern @var{pattern}. An apropos pattern is
534 either a word to match, a space-separated list of words of which at
535 least two must match, or a regular expression (if any special regular
536 expression characters occur). A symbol is ``meaningful'' if it has a
537 definition as a function, variable, or face, or has properties.
538
539 The function returns a list of elements that look like this:
540
541 @example
542 (@var{symbol} @var{score} @var{function-doc} @var{variable-doc}
543 @var{plist-doc} @var{widget-doc} @var{face-doc} @var{group-doc})
544 @end example
545
546 Here, @var{score} is an integer measure of how important the symbol
547 seems to be as a match. Each of the remaining elements is a
548 documentation string, or @code{nil}, for @var{symbol} as a function,
549 variable, etc.
550
551 It also displays the symbols in a buffer named @file{*Apropos*}, each
552 with a one-line description taken from the beginning of its
553 documentation string.
554
555 If @var{do-all} is non-@code{nil}, or if the user option
556 @code{apropos-do-all} is non-@code{nil}, then @code{apropos} also
557 shows key bindings for the functions that are found; it also shows
558 @emph{all} interned symbols, not just meaningful ones (and it lists
559 them in the return value as well).
560 @end deffn
561
562 @defvar help-map
563 The value of this variable is a local keymap for characters following the
564 Help key, @kbd{C-h}.
565 @end defvar
566
567 @deffn {Prefix Command} help-command
568 This symbol is not a function; its function definition cell holds the
569 keymap known as @code{help-map}. It is defined in @file{help.el} as
570 follows:
571
572 @smallexample
573 @group
574 (define-key global-map (string help-char) 'help-command)
575 (fset 'help-command help-map)
576 @end group
577 @end smallexample
578 @end deffn
579
580 @defopt help-char
581 The value of this variable is the help character---the character that
582 Emacs recognizes as meaning Help. By default, its value is 8, which
583 stands for @kbd{C-h}. When Emacs reads this character, if
584 @code{help-form} is a non-@code{nil} Lisp expression, it evaluates that
585 expression, and displays the result in a window if it is a string.
586
587 Usually the value of @code{help-form} is @code{nil}. Then the
588 help character has no special meaning at the level of command input, and
589 it becomes part of a key sequence in the normal way. The standard key
590 binding of @kbd{C-h} is a prefix key for several general-purpose help
591 features.
592
593 The help character is special after prefix keys, too. If it has no
594 binding as a subcommand of the prefix key, it runs
595 @code{describe-prefix-bindings}, which displays a list of all the
596 subcommands of the prefix key.
597 @end defopt
598
599 @defopt help-event-list
600 The value of this variable is a list of event types that serve as
601 alternative ``help characters''. These events are handled just like the
602 event specified by @code{help-char}.
603 @end defopt
604
605 @defvar help-form
606 If this variable is non-@code{nil}, its value is a form to evaluate
607 whenever the character @code{help-char} is read. If evaluating the form
608 produces a string, that string is displayed.
609
610 A command that calls @code{read-event}, @code{read-char-choice}, or
611 @code{read-char} probably should bind @code{help-form} to a
612 non-@code{nil} expression while it does input. (The time when you
613 should not do this is when @kbd{C-h} has some other meaning.)
614 Evaluating this expression should result in a string that explains
615 what the input is for and how to enter it properly.
616
617 Entry to the minibuffer binds this variable to the value of
618 @code{minibuffer-help-form} (@pxref{Definition of minibuffer-help-form}).
619 @end defvar
620
621 @defvar prefix-help-command
622 This variable holds a function to print help for a prefix key. The
623 function is called when the user types a prefix key followed by the help
624 character, and the help character has no binding after that prefix. The
625 variable's default value is @code{describe-prefix-bindings}.
626 @end defvar
627
628 @deffn Command describe-prefix-bindings
629 This function calls @code{describe-bindings} to display a list of all
630 the subcommands of the prefix key of the most recent key sequence. The
631 prefix described consists of all but the last event of that key
632 sequence. (The last event is, presumably, the help character.)
633 @end deffn
634
635 The following two functions are meant for modes that want to provide
636 help without relinquishing control, such as the ``electric'' modes.
637 Their names begin with @samp{Helper} to distinguish them from the
638 ordinary help functions.
639
640 @deffn Command Helper-describe-bindings
641 This command pops up a window displaying a help buffer containing a
642 listing of all of the key bindings from both the local and global keymaps.
643 It works by calling @code{describe-bindings}.
644 @end deffn
645
646 @deffn Command Helper-help
647 This command provides help for the current mode. It prompts the user
648 in the minibuffer with the message @samp{Help (Type ? for further
649 options)}, and then provides assistance in finding out what the key
650 bindings are, and what the mode is intended for. It returns @code{nil}.
651
652 @vindex Helper-help-map
653 This can be customized by changing the map @code{Helper-help-map}.
654 @end deffn
655
656 @defvar data-directory
657 @anchor{Definition of data-directory}
658 This variable holds the name of the directory in which Emacs finds
659 certain documentation and text files that come with Emacs.
660 @end defvar
661
662 @defun help-buffer
663 This function returns the name of the help buffer, which is normally
664 @file{*Help*}; if such a buffer does not exist, it is first created.
665 @end defun
666
667 @defmac with-help-window buffer-name body@dots{}
668 This macro evaluates the @var{body} forms, inserting any output they
669 produce into a buffer named @var{buffer-name} like
670 @code{with-output-to-temp-buffer} (@pxref{Temporary Displays}).
671 (Usually, @var{buffer-name} should be the value returned by the
672 function @code{help-buffer}.) It also puts the specified buffer into
673 Help mode and displays a message telling the user how to quit and
674 scroll the help window.
675 @end defmac
676
677 @defun help-setup-xref item interactive-p
678 This function updates the cross reference data in the @file{*Help*}
679 buffer, which is used to regenerate the help information when the user
680 clicks on the @samp{Back} or @samp{Forward} buttons. Most commands
681 that use the @file{*Help*} buffer should invoke this function before
682 clearing the buffer. The @var{item} argument should have the form
683 @code{(@var{function} . @var{args})}, where @var{function} is a function
684 to call, with argument list @var{args}, to regenerate the help buffer.
685 The @var{interactive-p} argument is non-@code{nil} if the calling
686 command was invoked interactively; in that case, the stack of items
687 for the @file{*Help*} buffer's @samp{Back} buttons is cleared.
688 @end defun
689
690 @xref{describe-symbols example}, for an example of using
691 @code{help-buffer}, @code{with-help-window}, and
692 @code{help-setup-xref}.
693
694 @defmac make-help-screen fname help-line help-text help-map
695 This macro defines a help command named @var{fname} that acts like a
696 prefix key that shows a list of the subcommands it offers.
697
698 When invoked, @var{fname} displays @var{help-text} in a window, then
699 reads and executes a key sequence according to @var{help-map}. The
700 string @var{help-text} should describe the bindings available in
701 @var{help-map}.
702
703 The command @var{fname} is defined to handle a few events itself, by
704 scrolling the display of @var{help-text}. When @var{fname} reads one of
705 those special events, it does the scrolling and then reads another
706 event. When it reads an event that is not one of those few, and which
707 has a binding in @var{help-map}, it executes that key's binding and
708 then returns.
709
710 The argument @var{help-line} should be a single-line summary of the
711 alternatives in @var{help-map}. In the current version of Emacs, this
712 argument is used only if you set the option @code{three-step-help} to
713 @code{t}.
714
715 This macro is used in the command @code{help-for-help} which is the
716 binding of @kbd{C-h C-h}.
717 @end defmac
718
719 @defopt three-step-help
720 If this variable is non-@code{nil}, commands defined with
721 @code{make-help-screen} display their @var{help-line} strings in the
722 echo area at first, and display the longer @var{help-text} strings only
723 if the user types the help character again.
724 @end defopt
725