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