summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/syntax.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/syntax.el')
-rw-r--r--lisp/emacs-lisp/syntax.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 695d7877b38..f290db42c04 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -52,6 +52,14 @@
(defsubst syntax-ppss-depth (ppss)
(nth 0 ppss))
+(defun syntax-ppss-toplevel-pos (ppss)
+ "Return the last preceding position at toplevel.
+\"At toplevel\" means that it is outside of any syntactic entity:
+outside of any parentheses, or comments, or strings.
+Returns nil iff PPSS itself corresponds to a toplevel position."
+ (or (car (nth 9 ppss))
+ (nth 8 ppss)))
+
(defsubst syntax-ppss-context (ppss)
(cond
((nth 3 ppss) 'string)