From 0e6c966c96290f53f281016c6e40c7404daf759b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 12 Dec 2006 02:36:38 +0000 Subject: (syntax-ppss-toplevel-pos): New fun. --- lisp/emacs-lisp/syntax.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lisp/emacs-lisp') 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) -- cgit v1.2.3