]> git.eshelyaron.com Git - emacs.git/commitdiff
(syntax-ppss-toplevel-pos): New fun.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 12 Dec 2006 02:36:38 +0000 (02:36 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 12 Dec 2006 02:36:38 +0000 (02:36 +0000)
lisp/ChangeLog
lisp/emacs-lisp/syntax.el

index 0b5cdc4a2fe3da81d9533a1e553c33cbffa3cc66..a75bfaf9191532cb1bbe53d2fbbf9faa2ffe7eb6 100644 (file)
@@ -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.
index 695d7877b38a53d9bee23632e39095cffa644a49..f290db42c04900ead4a32930f09ac4a8e597c501 100644 (file)
 (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)