summaryrefslogtreecommitdiff
path: root/devdocs/elisp/skipping-characters.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/skipping-characters.html')
-rw-r--r--devdocs/elisp/skipping-characters.html27
1 files changed, 27 insertions, 0 deletions
diff --git a/devdocs/elisp/skipping-characters.html b/devdocs/elisp/skipping-characters.html
new file mode 100644
index 00000000..af77c1e3
--- /dev/null
+++ b/devdocs/elisp/skipping-characters.html
@@ -0,0 +1,27 @@
+ <h4 class="subsection">Skipping Characters</h4> <p>The following two functions move point over a specified set of characters. For example, they are often used to skip whitespace. For related functions, see <a href="motion-and-syntax">Motion and Syntax</a>. </p> <p>These functions convert the set string to multibyte if the buffer is multibyte, and they convert it to unibyte if the buffer is unibyte, as the search functions do (see <a href="searching-and-matching">Searching and Matching</a>). </p> <dl> <dt id="skip-chars-forward">Function: <strong>skip-chars-forward</strong> <em>character-set &amp;optional limit</em>
+</dt> <dd>
+<p>This function moves point in the current buffer forward, skipping over a given set of characters. It examines the character following point, then advances point if the character matches <var>character-set</var>. This continues until it reaches a character that does not match. The function returns the number of characters moved over. </p> <p>The argument <var>character-set</var> is a string, like the inside of a ‘<samp>[…]</samp>’ in a regular expression except that ‘<samp>]</samp>’ does not terminate it, and ‘<samp>\</samp>’ quotes ‘<samp>^</samp>’, ‘<samp>-</samp>’ or ‘<samp>\</samp>’. Thus, <code>"a-zA-Z"</code> skips over all letters, stopping before the first nonletter, and <code>"^a-zA-Z"</code> skips nonletters stopping before the first letter (see <a href="regular-expressions">Regular Expressions</a>). Character classes can also be used, e.g., <code>"[:alnum:]"</code> (see <a href="char-classes">Char Classes</a>). </p> <p>If <var>limit</var> is supplied (it must be a number or a marker), it specifies the maximum position in the buffer that point can be skipped to. Point will stop at or before <var>limit</var>. </p> <p>In the following example, point is initially located directly before the ‘<samp>T</samp>’. After the form is evaluated, point is located at the end of that line (between the ‘<samp>t</samp>’ of ‘<samp>hat</samp>’ and the newline). The function skips all letters and spaces, but not newlines. </p> <div class="example"> <pre class="example">---------- Buffer: foo ----------
+I read "∗The cat in the hat
+comes back" twice.
+---------- Buffer: foo ----------
+</pre>
+
+<pre class="example">(skip-chars-forward "a-zA-Z ")
+ ⇒ 18
+
+---------- Buffer: foo ----------
+I read "The cat in the hat∗
+comes back" twice.
+---------- Buffer: foo ----------
+</pre>
+</div> </dd>
+</dl> <dl> <dt id="skip-chars-backward">Function: <strong>skip-chars-backward</strong> <em>character-set &amp;optional limit</em>
+</dt> <dd>
+<p>This function moves point backward, skipping characters that match <var>character-set</var>, until <var>limit</var>. It is just like <code>skip-chars-forward</code> except for the direction of motion. </p> <p>The return value indicates the distance traveled. It is an integer that is zero or less. </p>
+</dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 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/Skipping-Characters.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Skipping-Characters.html</a>
+ </p>
+</div>