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 Motion and Syntax.
This function moves point in buffer forward, skipping over a given set of characters. It examines the character following point, then advances point if the character matches character-set. This continues until it reaches a character that does not match. The function returns
nil. buffer defaults to the current buffer if omitted.The argument character-set is like the inside of a ‘[...]’ in a regular expression except that ‘]’ is never special and ‘\’ quotes ‘^’, ‘-’ or ‘\’. Thus,
"a-zA-Z"skips over all letters, stopping before the first non-letter, and"^a-zA-Z" skips non-letters stopping before the first letter. See Regular Expressions.If limit 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 limit.
In the following example, point is initially located directly before the ‘T’. After the form is evaluated, point is located at the end of that line (between the ‘t’ of ‘hat’ and the newline). The function skips all letters and spaces, but not newlines.
---------- Buffer: foo ---------- I read "-!-The cat in the hat comes back" twice. ---------- Buffer: foo ---------- (skip-chars-forward "a-zA-Z ") ⇒ nil ---------- Buffer: foo ---------- I read "The cat in the hat-!- comes back" twice. ---------- Buffer: foo ----------