summaryrefslogtreecommitdiff
path: root/devdocs/elisp/position-parse.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/position-parse.html
new repository
Diffstat (limited to 'devdocs/elisp/position-parse.html')
-rw-r--r--devdocs/elisp/position-parse.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/devdocs/elisp/position-parse.html b/devdocs/elisp/position-parse.html
new file mode 100644
index 00000000..1cdfe06f
--- /dev/null
+++ b/devdocs/elisp/position-parse.html
@@ -0,0 +1,12 @@
+ <h4 class="subsection">Finding the Parse State for a Position</h4> <p>For syntactic analysis, such as in indentation, often the useful thing is to compute the syntactic state corresponding to a given buffer position. This function does that conveniently. </p> <dl> <dt id="syntax-ppss">Function: <strong>syntax-ppss</strong> <em>&amp;optional pos</em>
+</dt> <dd>
+<p>This function returns the parser state that the parser would reach at position <var>pos</var> starting from the beginning of the visible portion of the buffer. See <a href="parser-state">Parser State</a>, for a description of the parser state. </p> <p>The return value is the same as if you call the low-level parsing function <code>parse-partial-sexp</code> to parse from the beginning of the visible portion of the buffer to <var>pos</var> (see <a href="low_002dlevel-parsing">Low-Level Parsing</a>). However, <code>syntax-ppss</code> uses caches to speed up the computation. Due to this optimization, the second value (previous complete subexpression) and sixth value (minimum parenthesis depth) in the returned parser state are not meaningful. </p> <p>This function has a side effect: it adds a buffer-local entry to <code>before-change-functions</code> (see <a href="change-hooks">Change Hooks</a>) for <code>syntax-ppss-flush-cache</code> (see below). This entry keeps the cache consistent as the buffer is modified. However, the cache might not be updated if <code>syntax-ppss</code> is called while <code>before-change-functions</code> is temporarily let-bound, or if the buffer is modified without running the hook, such as when using <code>inhibit-modification-hooks</code>. In those cases, it is necessary to call <code>syntax-ppss-flush-cache</code> explicitly. </p>
+</dd>
+</dl> <dl> <dt id="syntax-ppss-flush-cache">Function: <strong>syntax-ppss-flush-cache</strong> <em>beg &amp;rest ignored-args</em>
+</dt> <dd><p>This function flushes the cache used by <code>syntax-ppss</code>, starting at position <var>beg</var>. The remaining arguments, <var>ignored-args</var>, are ignored; this function accepts them so that it can be directly used on hooks such as <code>before-change-functions</code> (see <a href="change-hooks">Change Hooks</a>). </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/Position-Parse.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Position-Parse.html</a>
+ </p>
+</div>