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