diff options
Diffstat (limited to 'devdocs/elisp/word-motion.html')
| -rw-r--r-- | devdocs/elisp/word-motion.html | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/devdocs/elisp/word-motion.html b/devdocs/elisp/word-motion.html new file mode 100644 index 00000000..dce8e36f --- /dev/null +++ b/devdocs/elisp/word-motion.html @@ -0,0 +1,21 @@ + <h4 class="subsection">Motion by Words</h4> <p>The functions for parsing words described below use the syntax table and <code>char-script-table</code> to decide whether a given character is part of a word. See <a href="syntax-tables">Syntax Tables</a>, and see <a href="character-properties">Character Properties</a>. </p> <dl> <dt id="forward-word">Command: <strong>forward-word</strong> <em>&optional count</em> +</dt> <dd> +<p>This function moves point forward <var>count</var> words (or backward if <var>count</var> is negative). If <var>count</var> is omitted or <code>nil</code>, it defaults to 1. In an interactive call, <var>count</var> is specified by the numeric prefix argument. </p> <p>“Moving one word” means moving until point crosses a word-constituent character, which indicates the beginning of a word, and then continue moving until the word ends. By default, characters that begin and end words, known as <em>word boundaries</em>, are defined by the current buffer’s syntax table (see <a href="syntax-class-table">Syntax Class Table</a>), but modes can override that by setting up a suitable <code>find-word-boundary-function-table</code>, described below. Characters that belong to different scripts (as defined by <code>char-script-table</code>), also define a word boundary (see <a href="character-properties">Character Properties</a>). In any case, this function cannot move point past the boundary of the accessible portion of the buffer, or across a field boundary (see <a href="fields">Fields</a>). The most common case of a field boundary is the end of the prompt in the minibuffer. </p> <p>If it is possible to move <var>count</var> words, without being stopped prematurely by the buffer boundary or a field boundary, the value is <code>t</code>. Otherwise, the return value is <code>nil</code> and point stops at the buffer boundary or field boundary. </p> <p>If <code>inhibit-field-text-motion</code> is non-<code>nil</code>, this function ignores field boundaries. </p> </dd> +</dl> <dl> <dt id="backward-word">Command: <strong>backward-word</strong> <em>&optional count</em> +</dt> <dd><p>This function is just like <code>forward-word</code>, except that it moves backward until encountering the front of a word, rather than forward. </p></dd> +</dl> <dl> <dt id="words-include-escapes">User Option: <strong>words-include-escapes</strong> +</dt> <dd><p>This variable affects the behavior of <code>forward-word</code> and <code>backward-word</code>, and everything that uses them. If it is non-<code>nil</code>, then characters in the escape and character-quote syntax classes count as part of words. Otherwise, they do not. </p></dd> +</dl> <dl> <dt id="inhibit-field-text-motion">Variable: <strong>inhibit-field-text-motion</strong> +</dt> <dd><p>If this variable is non-<code>nil</code>, certain motion functions including <code>forward-word</code>, <code>forward-sentence</code>, and <code>forward-paragraph</code> ignore field boundaries. </p></dd> +</dl> <dl> <dt id="find-word-boundary-function-table">Variable: <strong>find-word-boundary-function-table</strong> +</dt> <dd><p>This variable affects the behavior of <code>forward-word</code> and <code>backward-word</code>, and everything that uses them. Its value is a char-table (see <a href="char_002dtables">Char-Tables</a>) of functions to search for word boundaries. If a character has a non-<code>nil</code> entry in this table, then when a word starts or ends with that character, the corresponding function will be called with 2 arguments: <var>pos</var> and <var>limit</var>. The function should return the position of the other word boundary. Specifically, if <var>pos</var> is smaller than <var>limit</var>, then <var>pos</var> is at the beginning of a word, and the function should return the position after the last character of the word; otherwise, <var>pos</var> is at the last character of a word, and the function should return the position of that word’s first character. </p></dd> +</dl> <dl> <dt id="forward-word-strictly">Function: <strong>forward-word-strictly</strong> <em>&optional count</em> +</dt> <dd><p>This function is like <code>forward-word</code>, but it is not affected by <code>find-word-boundary-function-table</code>. Lisp programs that should not change behavior when word movement is modified by modes which set that table, such as <code>subword-mode</code>, should use this function instead of <code>forward-word</code>. </p></dd> +</dl> <dl> <dt id="backward-word-strictly">Function: <strong>backward-word-strictly</strong> <em>&optional count</em> +</dt> <dd><p>This function is like <code>backward-word</code>, but it is not affected by <code>find-word-boundary-function-table</code>. Like with <code>forward-word-strictly</code>, use this function instead of <code>backward-word</code> when movement by words should only consider syntax tables. </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/Word-Motion.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Word-Motion.html</a> + </p> +</div> |
