changeset 74600:ab428131b528

(syntax-ppss-toplevel-pos): New fun.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 12 Dec 2006 02:36:38 +0000
parents 37d6b6cd4b63
children 72706da497c8
files lisp/ChangeLog lisp/emacs-lisp/syntax.el
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Dec 11 16:44:53 2006 +0000
+++ b/lisp/ChangeLog	Tue Dec 12 02:36:38 2006 +0000
@@ -1,3 +1,7 @@
+2006-12-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/syntax.el (syntax-ppss-toplevel-pos): New fun.
+
 2006-12-11  Juanma Barranquero  <lekktu@gmail.com>
 
 	* subr.el (unread-command-char): Reformat obsolescence info.
--- a/lisp/emacs-lisp/syntax.el	Mon Dec 11 16:44:53 2006 +0000
+++ b/lisp/emacs-lisp/syntax.el	Tue Dec 12 02:36:38 2006 +0000
@@ -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)