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/completion-commands.html | |
new repository
Diffstat (limited to 'devdocs/elisp/completion-commands.html')
| -rw-r--r-- | devdocs/elisp/completion-commands.html | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/devdocs/elisp/completion-commands.html b/devdocs/elisp/completion-commands.html new file mode 100644 index 00000000..989fc764 --- /dev/null +++ b/devdocs/elisp/completion-commands.html @@ -0,0 +1,46 @@ + <h4 class="subsection">Minibuffer Commands that Do Completion</h4> <p>This section describes the keymaps, commands and user options used in the minibuffer to do completion. </p> <dl> <dt id="minibuffer-completion-table">Variable: <strong>minibuffer-completion-table</strong> +</dt> <dd><p>The value of this variable is the completion table (see <a href="basic-completion">Basic Completion</a>) used for completion in the minibuffer. This is the buffer-local variable that contains what <code>completing-read</code> passes to <code>try-completion</code>. It is used by minibuffer completion commands such as <code>minibuffer-complete</code>. </p></dd> +</dl> <dl> <dt id="minibuffer-completion-predicate">Variable: <strong>minibuffer-completion-predicate</strong> +</dt> <dd><p>This variable’s value is the predicate that <code>completing-read</code> passes to <code>try-completion</code>. The variable is also used by the other minibuffer completion functions. </p></dd> +</dl> <dl> <dt id="minibuffer-completion-confirm">Variable: <strong>minibuffer-completion-confirm</strong> +</dt> <dd><p>This variable determines whether Emacs asks for confirmation before exiting the minibuffer; <code>completing-read</code> sets this variable, and the function <code>minibuffer-complete-and-exit</code> checks the value before exiting. If the value is <code>nil</code>, confirmation is not required. If the value is <code>confirm</code>, the user may exit with an input that is not a valid completion alternative, but Emacs asks for confirmation. If the value is <code>confirm-after-completion</code>, the user may exit with an input that is not a valid completion alternative, but Emacs asks for confirmation if the user submitted the input right after any of the completion commands in <code>minibuffer-confirm-exit-commands</code>. </p></dd> +</dl> <dl> <dt id="minibuffer-confirm-exit-commands">Variable: <strong>minibuffer-confirm-exit-commands</strong> +</dt> <dd><p>This variable holds a list of commands that cause Emacs to ask for confirmation before exiting the minibuffer, if the <var>require-match</var> argument to <code>completing-read</code> is <code>confirm-after-completion</code>. The confirmation is requested if the user attempts to exit the minibuffer immediately after calling any command in this list. </p></dd> +</dl> <dl> <dt id="minibuffer-complete-word">Command: <strong>minibuffer-complete-word</strong> +</dt> <dd><p>This function completes the minibuffer contents by at most a single word. Even if the minibuffer contents have only one completion, <code>minibuffer-complete-word</code> does not add any characters beyond the first character that is not a word constituent. See <a href="syntax-tables">Syntax Tables</a>. </p></dd> +</dl> <dl> <dt id="minibuffer-complete">Command: <strong>minibuffer-complete</strong> +</dt> <dd><p>This function completes the minibuffer contents as far as possible. </p></dd> +</dl> <dl> <dt id="minibuffer-complete-and-exit">Command: <strong>minibuffer-complete-and-exit</strong> +</dt> <dd><p>This function completes the minibuffer contents, and exits if confirmation is not required, i.e., if <code>minibuffer-completion-confirm</code> is <code>nil</code>. If confirmation <em>is</em> required, it is given by repeating this command immediately—the command is programmed to work without confirmation when run twice in succession. </p></dd> +</dl> <dl> <dt id="minibuffer-completion-help">Command: <strong>minibuffer-completion-help</strong> +</dt> <dd><p>This function creates a list of the possible completions of the current minibuffer contents. It works by calling <code>all-completions</code> using the value of the variable <code>minibuffer-completion-table</code> as the <var>collection</var> argument, and the value of <code>minibuffer-completion-predicate</code> as the <var>predicate</var> argument. The list of completions is displayed as text in a buffer named <samp>*Completions*</samp>. </p></dd> +</dl> <dl> <dt id="display-completion-list">Function: <strong>display-completion-list</strong> <em>completions</em> +</dt> <dd> +<p>This function displays <var>completions</var> to the stream in <code>standard-output</code>, usually a buffer. (See <a href="read-and-print">Read and Print</a>, for more information about streams.) The argument <var>completions</var> is normally a list of completions just returned by <code>all-completions</code>, but it does not have to be. Each element may be a symbol or a string, either of which is simply printed. It can also be a list of two strings, which is printed as if the strings were concatenated. The first of the two strings is the actual completion, the second string serves as annotation. </p> <p>This function is called by <code>minibuffer-completion-help</code>. A common way to use it is together with <code>with-output-to-temp-buffer</code>, like this: </p> <div class="example"> <pre class="example">(with-output-to-temp-buffer "*Completions*" + (display-completion-list + (all-completions (buffer-string) my-alist))) +</pre> +</div> </dd> +</dl> <dl> <dt id="completion-auto-help">User Option: <strong>completion-auto-help</strong> +</dt> <dd><p>If this variable is non-<code>nil</code>, the completion commands automatically display a list of possible completions whenever nothing can be completed because the next character is not uniquely determined. </p></dd> +</dl> <dl> <dt id="minibuffer-local-completion-map">Variable: <strong>minibuffer-local-completion-map</strong> +</dt> <dd> +<p><code>completing-read</code> uses this value as the local keymap when an exact match of one of the completions is not required. By default, this keymap makes the following bindings: </p> <dl compact> <dt><kbd>?</kbd></dt> <dd> +<p><code>minibuffer-completion-help</code> </p> </dd> <dt><tt class="key">SPC</tt></dt> <dd> +<p><code>minibuffer-complete-word</code> </p> </dd> <dt><tt class="key">TAB</tt></dt> <dd><p><code>minibuffer-complete</code> </p></dd> </dl> <p>and uses <code>minibuffer-local-map</code> as its parent keymap (see <a href="text-from-minibuffer#Definition-of-minibuffer_002dlocal_002dmap">Definition of minibuffer-local-map</a>). </p> +</dd> +</dl> <dl> <dt id="minibuffer-local-must-match-map">Variable: <strong>minibuffer-local-must-match-map</strong> +</dt> <dd> +<p><code>completing-read</code> uses this value as the local keymap when an exact match of one of the completions is required. Therefore, no keys are bound to <code>exit-minibuffer</code>, the command that exits the minibuffer unconditionally. By default, this keymap makes the following bindings: </p> <dl compact> <dt><kbd>C-j</kbd></dt> <dd> +<p><code>minibuffer-complete-and-exit</code> </p> </dd> <dt><tt class="key">RET</tt></dt> <dd><p><code>minibuffer-complete-and-exit</code> </p></dd> </dl> <p>and uses <code>minibuffer-local-completion-map</code> as its parent keymap. </p> +</dd> +</dl> <dl> <dt id="minibuffer-local-filename-completion-map">Variable: <strong>minibuffer-local-filename-completion-map</strong> +</dt> <dd><p>This is a sparse keymap that simply unbinds <tt class="key">SPC</tt>; because filenames can contain spaces. The function <code>read-file-name</code> combines this keymap with either <code>minibuffer-local-completion-map</code> or <code>minibuffer-local-must-match-map</code>. </p></dd> +</dl> <dl> <dt id="minibuffer-beginning-of-buffer-movement">Variable: <strong>minibuffer-beginning-of-buffer-movement</strong> +</dt> <dd><p>If non-<code>nil</code>, the <kbd>M-<</kbd> command will move to the end of the prompt if point is after the end of the prompt. If point is at or before the end of the prompt, move to the start of the buffer. If this variable is <code>nil</code>, the command behaves like <code>beginning-of-buffer</code>. </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/Completion-Commands.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-Commands.html</a> + </p> +</div> |
