diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/help-functions.html | |
new repository
Diffstat (limited to 'devdocs/elisp/help-functions.html')
| -rw-r--r-- | devdocs/elisp/help-functions.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/devdocs/elisp/help-functions.html b/devdocs/elisp/help-functions.html new file mode 100644 index 00000000..2952ff76 --- /dev/null +++ b/devdocs/elisp/help-functions.html @@ -0,0 +1,57 @@ + <h3 class="section">Help Functions</h3> <p>Emacs provides a variety of built-in help functions, all accessible to the user as subcommands of the prefix <kbd>C-h</kbd>. For more information about them, see <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Help.html#Help">Help</a> in <cite>The GNU Emacs Manual</cite>. Here we describe some program-level interfaces to the same information. </p> <dl> <dt id="apropos">Command: <strong>apropos</strong> <em>pattern &optional do-all</em> +</dt> <dd> +<p>This function finds all meaningful symbols whose names contain a match for the apropos pattern <var>pattern</var>. An apropos pattern is either a word to match, a space-separated list of words of which at least two must match, or a regular expression (if any special regular expression characters occur). A symbol is meaningful if it has a definition as a function, variable, or face, or has properties. </p> <p>The function returns a list of elements that look like this: </p> <div class="example"> <pre class="example">(<var>symbol</var> <var>score</var> <var>function-doc</var> <var>variable-doc</var> + <var>plist-doc</var> <var>widget-doc</var> <var>face-doc</var> <var>group-doc</var>) +</pre> +</div> <p>Here, <var>score</var> is an integer measure of how important the symbol seems to be as a match. Each of the remaining elements is a documentation string, or <code>nil</code>, for <var>symbol</var> as a function, variable, etc. </p> <p>It also displays the symbols in a buffer named <samp>*Apropos*</samp>, each with a one-line description taken from the beginning of its documentation string. </p> <p>If <var>do-all</var> is non-<code>nil</code>, or if the user option <code>apropos-do-all</code> is non-<code>nil</code>, then <code>apropos</code> also shows key bindings for the functions that are found; it also shows <em>all</em> interned symbols, not just meaningful ones (and it lists them in the return value as well). </p> +</dd> +</dl> <dl> <dt id="help-map">Variable: <strong>help-map</strong> +</dt> <dd><p>The value of this variable is a local keymap for characters following the Help key, <kbd>C-h</kbd>. </p></dd> +</dl> <dl> <dt id="help-command">Prefix Command: <strong>help-command</strong> +</dt> <dd> +<p>This symbol is not a function; its function definition cell holds the keymap known as <code>help-map</code>. It is defined in <samp>help.el</samp> as follows: </p> <div class="example"> <pre class="example">(define-key global-map (string help-char) 'help-command) +(fset 'help-command help-map) +</pre> +</div> </dd> +</dl> <dl> <dt id="help-char">User Option: <strong>help-char</strong> +</dt> <dd> +<p>The value of this variable is the help character—the character that Emacs recognizes as meaning Help. By default, its value is 8, which stands for <kbd>C-h</kbd>. When Emacs reads this character, if <code>help-form</code> is a non-<code>nil</code> Lisp expression, it evaluates that expression, and displays the result in a window if it is a string. </p> <p>Usually the value of <code>help-form</code> is <code>nil</code>. Then the help character has no special meaning at the level of command input, and it becomes part of a key sequence in the normal way. The standard key binding of <kbd>C-h</kbd> is a prefix key for several general-purpose help features. </p> <p>The help character is special after prefix keys, too. If it has no binding as a subcommand of the prefix key, it runs <code>describe-prefix-bindings</code>, which displays a list of all the subcommands of the prefix key. </p> +</dd> +</dl> <dl> <dt id="help-event-list">User Option: <strong>help-event-list</strong> +</dt> <dd><p>The value of this variable is a list of event types that serve as alternative help characters. These events are handled just like the event specified by <code>help-char</code>. </p></dd> +</dl> <dl> <dt id="help-form">Variable: <strong>help-form</strong> +</dt> <dd> +<p>If this variable is non-<code>nil</code>, its value is a form to evaluate whenever the character <code>help-char</code> is read. If evaluating the form produces a string, that string is displayed. </p> <p>A command that calls <code>read-event</code>, <code>read-char-choice</code>, <code>read-char</code>, <code>read-char-from-minibuffer</code>, or <code>y-or-n-p</code> probably should bind <code>help-form</code> to a non-<code>nil</code> expression while it does input. (The time when you should not do this is when <kbd>C-h</kbd> has some other meaning.) Evaluating this expression should result in a string that explains what the input is for and how to enter it properly. </p> <p>Entry to the minibuffer binds this variable to the value of <code>minibuffer-help-form</code> (see <a href="minibuffer-misc#Definition-of-minibuffer_002dhelp_002dform">Definition of minibuffer-help-form</a>). </p> +</dd> +</dl> <dl> <dt id="prefix-help-command">Variable: <strong>prefix-help-command</strong> +</dt> <dd><p>This variable holds a function to print help for a prefix key. The function is called when the user types a prefix key followed by the help character, and the help character has no binding after that prefix. The variable’s default value is <code>describe-prefix-bindings</code>. </p></dd> +</dl> <dl> <dt id="describe-prefix-bindings">Command: <strong>describe-prefix-bindings</strong> +</dt> <dd><p>This function calls <code>describe-bindings</code> 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.) </p></dd> +</dl> <p>The following two functions are meant for modes that want to provide help without relinquishing control, such as the electric modes. Their names begin with ‘<samp>Helper</samp>’ to distinguish them from the ordinary help functions. </p> <dl> <dt id="Helper-describe-bindings">Command: <strong>Helper-describe-bindings</strong> +</dt> <dd><p>This command pops up a window displaying a help buffer containing a listing of all of the key bindings from both the local and global keymaps. It works by calling <code>describe-bindings</code>. </p></dd> +</dl> <dl> <dt id="Helper-help">Command: <strong>Helper-help</strong> +</dt> <dd> +<p>This command provides help for the current mode. It prompts the user in the minibuffer with the message ‘<samp>Help (Type ? for further options)</samp>’, and then provides assistance in finding out what the key bindings are, and what the mode is intended for. It returns <code>nil</code>. </p> <p>This can be customized by changing the map <code>Helper-help-map</code>. </p> +</dd> +</dl> <dl> <dt id="data-directory">Variable: <strong>data-directory</strong> +</dt> <dd> +<p>This variable holds the name of the directory in which Emacs finds certain documentation and text files that come with Emacs. </p> +</dd> +</dl> <dl> <dt id="help-buffer">Function: <strong>help-buffer</strong> +</dt> <dd><p>This function returns the name of the help buffer, which is normally <samp>*Help*</samp>; if such a buffer does not exist, it is first created. </p></dd> +</dl> <dl> <dt id="with-help-window">Macro: <strong>with-help-window</strong> <em>buffer-or-name body…</em> +</dt> <dd><p>This macro evaluates <var>body</var> like <code>with-output-to-temp-buffer</code> (see <a href="temporary-displays">Temporary Displays</a>), inserting any output produced by its forms into a buffer specified by <var>buffer-or-name</var>, which can be a buffer or the name of a buffer. (Frequently, <var>buffer-or-name</var> is the value returned by the function <code>help-buffer</code>.) This macro puts the specified buffer into Help mode and displays a message telling the user how to quit and scroll the help window. It selects the help window if the current value of the user option <code>help-window-select</code> has been set accordingly. It returns the last value in <var>body</var>. </p></dd> +</dl> <dl> <dt id="help-setup-xref">Function: <strong>help-setup-xref</strong> <em>item interactive-p</em> +</dt> <dd><p>This function updates the cross reference data in the <samp>*Help*</samp> buffer, which is used to regenerate the help information when the user clicks on the ‘<samp>Back</samp>’ or ‘<samp>Forward</samp>’ buttons. Most commands that use the <samp>*Help*</samp> buffer should invoke this function before clearing the buffer. The <var>item</var> argument should have the form <code>(<var>function</var> . <var>args</var>)</code>, where <var>function</var> is a function to call, with argument list <var>args</var>, to regenerate the help buffer. The <var>interactive-p</var> argument is non-<code>nil</code> if the calling command was invoked interactively; in that case, the stack of items for the <samp>*Help*</samp> buffer’s ‘<samp>Back</samp>’ buttons is cleared. </p></dd> +</dl> <p>See <a href="accessing-documentation#describe_002dsymbols-example">describe-symbols example</a>, for an example of using <code>help-buffer</code>, <code>with-help-window</code>, and <code>help-setup-xref</code>. </p> <dl> <dt id="make-help-screen">Macro: <strong>make-help-screen</strong> <em>fname help-line help-text help-map</em> +</dt> <dd> +<p>This macro defines a help command named <var>fname</var> that acts like a prefix key that shows a list of the subcommands it offers. </p> <p>When invoked, <var>fname</var> displays <var>help-text</var> in a window, then reads and executes a key sequence according to <var>help-map</var>. The string <var>help-text</var> should describe the bindings available in <var>help-map</var>. </p> <p>The command <var>fname</var> is defined to handle a few events itself, by scrolling the display of <var>help-text</var>. When <var>fname</var> reads one of those special events, it does the scrolling and then reads another event. When it reads an event that is not one of those few, and which has a binding in <var>help-map</var>, it executes that key’s binding and then returns. </p> <p>The argument <var>help-line</var> should be a single-line summary of the alternatives in <var>help-map</var>. In the current version of Emacs, this argument is used only if you set the option <code>three-step-help</code> to <code>t</code>. </p> <p>This macro is used in the command <code>help-for-help</code> which is the binding of <kbd>C-h C-h</kbd>. </p> +</dd> +</dl> <dl> <dt id="three-step-help">User Option: <strong>three-step-help</strong> +</dt> <dd><p>If this variable is non-<code>nil</code>, commands defined with <code>make-help-screen</code> display their <var>help-line</var> strings in the echo area at first, and display the longer <var>help-text</var> strings only if the user types the help character again. </p></dd> +</dl><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Help-Functions.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Help-Functions.html</a> + </p> +</div> |
