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