From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/position-parse.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 devdocs/elisp/position-parse.html (limited to 'devdocs/elisp/position-parse.html') 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 @@ +

Finding the Parse State for a Position

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.

Function: syntax-ppss &optional pos +
+

This function returns the parser state that the parser would reach at position pos starting from the beginning of the visible portion of the buffer. See Parser State, for a description of the parser state.

The return value is the same as if you call the low-level parsing function parse-partial-sexp to parse from the beginning of the visible portion of the buffer to pos (see Low-Level Parsing). However, syntax-ppss 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.

This function has a side effect: it adds a buffer-local entry to before-change-functions (see Change Hooks) for syntax-ppss-flush-cache (see below). This entry keeps the cache consistent as the buffer is modified. However, the cache might not be updated if syntax-ppss is called while before-change-functions is temporarily let-bound, or if the buffer is modified without running the hook, such as when using inhibit-modification-hooks. In those cases, it is necessary to call syntax-ppss-flush-cache explicitly.

+
+
Function: syntax-ppss-flush-cache beg &rest ignored-args +

This function flushes the cache used by syntax-ppss, starting at position beg. The remaining arguments, ignored-args, are ignored; this function accepts them so that it can be directly used on hooks such as before-change-functions (see Change Hooks).

+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Position-Parse.html +

+
-- cgit v1.2.3