Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[bpt/emacs.git] / doc / lispref / help.texi
index a98797f..9fe069b 100644 (file)
@@ -1,10 +1,9 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990-1995, 1998-1999, 2001-2012
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1990-1995, 1998-1999, 2001-2013 Free Software
+@c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/help
-@node Documentation, Files, Modes, Top
+@node Documentation
 @chapter Documentation
 @cindex documentation strings
 
@@ -35,7 +34,6 @@ Help, emacs, The GNU Emacs Manual}.
 @end menu
 
 @node Documentation Basics
-@comment  node-name,  next,  previous,  up
 @section Documentation Basics
 @cindex documentation conventions
 @cindex writing a documentation string
@@ -60,11 +58,17 @@ use @kbd{C-h f} (@code{describe-function}) or @kbd{C-h v}
 are many other conventions for documentation strings; see
 @ref{Documentation Tips}.
 
-  Documentation strings can contain several special substrings, which
-stand for key bindings to be looked up in the current keymaps when the
-documentation is displayed.  This allows documentation strings to refer
-to the keys for related commands and be accurate even when a user
-rearranges the key bindings.  (@xref{Keys in Documentation}.)
+  Documentation strings can contain several special text sequences,
+referring to key bindings which are looked up in the current keymaps
+when the user views the documentation.  This allows the help commands
+to display the correct keys even if a user rearranges the default key
+bindings.  @xref{Keys in Documentation}.
+
+  In the documentation string of an autoloaded command
+(@pxref{Autoload}), these special text sequences have an additional
+special effect: they cause @kbd{C-h f} (@code{describe-function}) on
+the command to trigger autoloading.  (This is needed for correctly
+setting up the hyperlinks in the @file{*Help*} buffer).
 
 @vindex emacs-lisp-docstring-fill-column
   Emacs Lisp mode fills documentation strings to the width
@@ -180,7 +184,7 @@ face.
 @c Wordy to prevent overfull hboxes.  --rjc 15mar92
 Here is an example of using the two functions, @code{documentation} and
 @code{documentation-property}, to display the documentation strings for
-several symbols in a @samp{*Help*} buffer.
+several symbols in a @file{*Help*} buffer.
 
 @anchor{describe-symbols example}
 @smallexample
@@ -218,7 +222,7 @@ in the `*Help*' buffer."
 @group
                 (princ
                  (format "%s\t%s\n%s\n\n" s
-                   (if (user-variable-p s)
+                   (if (custom-variable-p s)
                        "Option " "Variable")
 @end group
 @group
@@ -348,6 +352,21 @@ This function scans @var{string} for the above special sequences and
 replaces them by what they stand for, returning the result as a string.
 This permits display of documentation that refers accurately to the
 user's own customized key bindings.
+
+@cindex advertised binding
+If a command has multiple bindings, this function normally uses the
+first one it finds.  You can specify one particular key binding by
+assigning an @code{:advertised-binding} symbol property to the
+command, like this:
+
+@smallexample
+(put 'undo :advertised-binding [?\C-/])
+@end smallexample
+
+@noindent
+The @code{:advertised-binding} property also affects the binding shown
+in menu items (@pxref{Menu Bar}).  The property is ignored if it
+specifies a key binding that the command does not actually have.
 @end defun
 
   Here are examples of the special sequences:
@@ -429,7 +448,7 @@ This function returns a string describing @var{event} in the standard
 Emacs notation for keyboard input.  A normal printing character
 appears as itself, but a control character turns into a string
 starting with @samp{C-}, a meta character turns into a string starting
-with @samp{M-}, and space, tab, etc.@: appear as @samp{SPC},
+with @samp{M-}, and space, tab, etc., appear as @samp{SPC},
 @samp{TAB}, etc.  A function key symbol appears inside angle brackets
 @samp{<@dots{}>}.  An event that is a list appears as the name of the
 symbol in the @sc{car} of the list, inside angle brackets.
@@ -497,7 +516,7 @@ for Meta.
 @end smallexample
 @end defun
 
-@defun read-kbd-macro string &optional need-vector
+@deffn Command read-kbd-macro string &optional need-vector
 This function is used mainly for operating on keyboard macros, but it
 can also be used as a rough inverse for @code{key-description}.  You
 call it with a string containing key descriptions, separated by spaces;
@@ -505,7 +524,7 @@ it returns a string or vector containing the corresponding events.
 (This may or may not be a single valid key sequence, depending on what
 events you use; @pxref{Key Sequences}.)  If @var{need-vector} is
 non-@code{nil}, the return value is always a vector.
-@end defun
+@end deffn
 
 @node Help Functions
 @section Help Functions
@@ -535,7 +554,7 @@ seems to be as a match.  Each of the remaining elements is a
 documentation string, or @code{nil}, for @var{symbol} as a function,
 variable, etc.
 
-It also displays the symbols in a buffer named @samp{*Apropos*}, each
+It also displays the symbols in a buffer named @file{*Apropos*}, each
 with a one-line description taken from the beginning of its
 documentation string.
 
@@ -585,7 +604,7 @@ subcommands of the prefix key.
 
 @defopt help-event-list
 The value of this variable is a list of event types that serve as
-alternative ``help characters.''  These events are handled just like the
+alternative ``help characters''.  These events are handled just like the
 event specified by @code{help-char}.
 @end defopt
 
@@ -612,12 +631,12 @@ character, and the help character has no binding after that prefix.  The
 variable's default value is @code{describe-prefix-bindings}.
 @end defvar
 
-@defun describe-prefix-bindings
+@deffn Command describe-prefix-bindings
 This function calls @code{describe-bindings} to display a list of all
 the subcommands of the prefix key of the most recent key sequence.  The
 prefix described consists of all but the last event of that key
 sequence.  (The last event is, presumably, the help character.)
-@end defun
+@end deffn
 
   The following two functions are meant for modes that want to provide
 help without relinquishing control, such as the ``electric'' modes.
@@ -636,6 +655,7 @@ in the minibuffer with the message @samp{Help (Type ? for further
 options)}, and then provides assistance in finding out what the key
 bindings are, and what the mode is intended for.  It returns @code{nil}.
 
+@vindex Helper-help-map
 This can be customized by changing the map @code{Helper-help-map}.
 @end deffn
 
@@ -647,7 +667,7 @@ certain documentation and text files that come with Emacs.
 
 @defun help-buffer
 This function returns the name of the help buffer, which is normally
-@samp{*Help*}; if such a buffer does not exist, it is first created.
+@file{*Help*}; if such a buffer does not exist, it is first created.
 @end defun
 
 @defmac with-help-window buffer-name body@dots{}
@@ -661,16 +681,16 @@ scroll the help window.
 @end defmac
 
 @defun help-setup-xref item interactive-p
-This function updates the cross reference data in the @samp{*Help*}
+This function updates the cross reference data in the @file{*Help*}
 buffer, which is used to regenerate the help information when the user
 clicks on the @samp{Back} or @samp{Forward} buttons.  Most commands
-that use the @samp{*Help*} buffer should invoke this function before
+that use the @file{*Help*} buffer should invoke this function before
 clearing the buffer.  The @var{item} argument should have the form
 @code{(@var{function} . @var{args})}, where @var{function} is a function
 to call, with argument list @var{args}, to regenerate the help buffer.
 The @var{interactive-p} argument is non-@code{nil} if the calling
 command was invoked interactively; in that case, the stack of items
-for the @samp{*Help*} buffer's @samp{Back} buttons is cleared.
+for the @file{*Help*} buffer's @samp{Back} buttons is cleared.
 @end defun
 
 @xref{describe-symbols example}, for an example of using
@@ -708,4 +728,3 @@ If this variable is non-@code{nil}, commands defined with
 echo area at first, and display the longer @var{help-text} strings only
 if the user types the help character again.
 @end defopt
-