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/motion-via-parsing.html | |
new repository
Diffstat (limited to 'devdocs/elisp/motion-via-parsing.html')
| -rw-r--r-- | devdocs/elisp/motion-via-parsing.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/elisp/motion-via-parsing.html b/devdocs/elisp/motion-via-parsing.html new file mode 100644 index 00000000..4388f6f5 --- /dev/null +++ b/devdocs/elisp/motion-via-parsing.html @@ -0,0 +1,18 @@ + <h4 class="subsection">Motion Commands Based on Parsing</h4> <p>This section describes simple point-motion functions that operate based on parsing expressions. </p> <dl> <dt id="scan-lists">Function: <strong>scan-lists</strong> <em>from count depth</em> +</dt> <dd> +<p>This function scans forward <var>count</var> balanced parenthetical groupings from position <var>from</var>. It returns the position where the scan stops. If <var>count</var> is negative, the scan moves backwards. </p> <p>If <var>depth</var> is nonzero, treat the starting position as being <var>depth</var> parentheses deep. The scanner moves forward or backward through the buffer until the depth changes to zero <var>count</var> times. Hence, a positive value for <var>depth</var> has the effect of moving out <var>depth</var> levels of parenthesis from the starting position, while a negative <var>depth</var> has the effect of moving deeper by <var>-depth</var> levels of parenthesis. </p> <p>Scanning ignores comments if <code>parse-sexp-ignore-comments</code> is non-<code>nil</code>. </p> <p>If the scan reaches the beginning or end of the accessible part of the buffer before it has scanned over <var>count</var> parenthetical groupings, the return value is <code>nil</code> if the depth at that point is zero; if the depth is non-zero, a <code>scan-error</code> error is signaled. </p> +</dd> +</dl> <dl> <dt id="scan-sexps">Function: <strong>scan-sexps</strong> <em>from count</em> +</dt> <dd> +<p>This function scans forward <var>count</var> sexps from position <var>from</var>. It returns the position where the scan stops. If <var>count</var> is negative, the scan moves backwards. </p> <p>Scanning ignores comments if <code>parse-sexp-ignore-comments</code> is non-<code>nil</code>. </p> <p>If the scan reaches the beginning or end of (the accessible part of) the buffer while in the middle of a parenthetical grouping, an error is signaled. If it reaches the beginning or end between groupings but before count is used up, <code>nil</code> is returned. </p> +</dd> +</dl> <dl> <dt id="forward-comment">Function: <strong>forward-comment</strong> <em>count</em> +</dt> <dd> +<p>This function moves point forward across <var>count</var> complete comments (that is, including the starting delimiter and the terminating delimiter if any), plus any whitespace encountered on the way. It moves backward if <var>count</var> is negative. If it encounters anything other than a comment or whitespace, it stops, leaving point at the place where it stopped. This includes (for instance) finding the end of a comment when moving forward and expecting the beginning of one. The function also stops immediately after moving over the specified number of complete comments. If <var>count</var> comments are found as expected, with nothing except whitespace between them, it returns <code>t</code>; otherwise it returns <code>nil</code>. </p> <p>This function cannot tell whether the comments it traverses are embedded within a string. If they look like comments, it treats them as comments. </p> <p>To move forward over all comments and whitespace following point, use <code>(forward-comment (buffer-size))</code>. <code>(buffer-size)</code> is a good argument to use, because the number of comments in the buffer cannot exceed that many. </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/Motion-via-Parsing.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Motion-via-Parsing.html</a> + </p> +</div> |
