unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: martin rudalics <rudalics@gmx.at>, emacs-devel@gnu.org, acm@muc.de
Subject: Re: Honesty with parse-partial-sexp
Date: Sat, 09 Dec 2006 15:30:09 -0500	[thread overview]
Message-ID: <jwv3b7odd9u.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1Gt6ts-0006b9-Em@fencepost.gnu.org> (Richard Stallman's message of "Sat\, 09 Dec 2006 13\:26\:16 -0500")

>     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?


        Stefan


--- 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)
   (cond
    ((nth 3 ppss) 'string)

  reply	other threads:[~2006-12-09 20:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07 17:47 Honesty with parse-partial-sexp Alan Mackenzie
2006-12-09  1:26 ` Richard Stallman
2006-12-09  4:04   ` Stefan Monnier
2006-12-09 18:25     ` Richard Stallman
2006-12-09 20:20       ` Stefan Monnier
2006-12-09  9:47   ` martin rudalics
2006-12-09 12:56     ` Miles Bader
2006-12-09 18:26     ` Richard Stallman
2006-12-09 20:30       ` Stefan Monnier [this message]
2006-12-11  1:05         ` Richard Stallman
2006-12-12  2:41           ` Stefan Monnier
2006-12-12 19:01             ` Alan Mackenzie
2006-12-12 19:29               ` Stefan Monnier
2006-12-12 19:53                 ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv3b7odd9u.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).