[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Honesty with parse-partial-sexp

From: Stefan Monnier
Subject: Re: Honesty with parse-partial-sexp
Date: Sat, 09 Dec 2006 15:30:09 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

>     Finally, if you really want to document the 9th return value you should
>     talk about all its elements.

> Not necessarily.

> The really clean thing to do would be to store ONLY the position
> of the outermost paren in elt 9, and move the rest to a new elt 10.
> But I'd rather not do that at this late stage.

> For now, let's define a defsubst to access it.  Would someone please do so?

Would the definition below be good?


--- syntax.el   07 mai 2006 10:09:22 -0400      1.18
+++ syntax.el   09 déc 2006 15:28:50 -0500      
@@ -52,6 +52,14 @@
 (defsubst syntax-ppss-depth (ppss)
   (nth 0 ppss))
+(defun syntax-ppss-toplevel-pos (ppss)
+  "Return the closest 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)
    ((nth 3 ppss) 'string)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]