From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Problems with syntax-ppss
Date: Fri, 04 Apr 2008 19:29:48 +0200 [thread overview]
Message-ID: <47F6658C.2010703@gmail.com> (raw)
In-Reply-To: <20080404172627.GB4804@muc.de>
Alan Mackenzie wrote:
> Hi, Emacs!
>
> I've just encountered a rather knotty problem in CC Mode for which
> syntax-ppss ought to be a solution; I need to find out, RAPIDLY, whether
> a particular buffer position is inside a string or comment.
> Unfortunately (for me), ......
>
> syntax-ppss does it's parsing from (point-min), not from BOB.
>
> So if the buffer is currently narrowed, this function will return an
> meaningless value for the envisaged use.
>
> But if I widen the buffer first, what happens to syntax-ppss's cache?
> Is this just discarded, or are perhaps two caches maintained (one from
> BOB, the other from the current (or most recent) (point-min)?
I believe nothing happens to the cache. The cache is just a list of
position + state. There is no reason to change this when widening the
buffer.
The cache is flushed in before-change-hook. All entries after first
changed position are removed.
> Advice, please!
>
> Forgive me at this point for not reading the fine source code - it's
> over 150 lines and looks rather forbidding.
>
> It would be nice if the the Elisp manual could be more explicit on such
> points. (Hey, tell me how it is, and I'll expand the manual!)
>
> I think the doc-string for the function is inadequate - it fails to
> state that parsing starts at (point-min) rather than BOB.
>
> Thanks in advance!
>
next prev parent reply other threads:[~2008-04-04 17:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-04 17:26 Problems with syntax-ppss Alan Mackenzie
2008-04-04 17:29 ` Lennart Borgman (gmail) [this message]
2008-04-04 20:24 ` Stefan Monnier
2008-04-04 21:14 ` martin rudalics
2008-04-05 14:46 ` Alan Mackenzie
2008-04-05 18:37 ` Stefan Monnier
2008-04-06 14:07 ` Alan Mackenzie
2008-04-07 14:57 ` Stefan Monnier
2008-04-07 15:14 ` Lennart Borgman (gmail)
2008-04-07 16:43 ` Stefan Monnier
2008-04-07 14:59 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47F6658C.2010703@gmail.com \
--to=lennart.borgman@gmail.com \
--cc=acm@muc.de \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.