all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Idea for syntax-ppss.  Is it new?  Could it be any good?
Date: Sun, 27 Jul 2008 02:36:26 +0200	[thread overview]
Message-ID: <488BC30A.7010009@gmail.com> (raw)
In-Reply-To: <20080726214429.GB3623@muc.de>

Alan Mackenzie wrote:
> Hi, Emacs,
> 
> Looking at the doc string for syntax-ppss, it seems this could be _very_
> useful in a certain body of code I'm responsible for.  That body of code
> has a lot of heuristics that determine whether point is within a
> string/comment, and some of these are not watertight (such as hard-coded
> limits on comment sizes to achieve speed).  Basically, they're a PITA.
> syntax-ppss, if it was guaranteed watertight, could remove the gnawing
> uncertainty from much of the code.
> 
> However, the manual documents limitations on syntax-ppss's functionality.
> 
> How about reimplementing it thusly?:  The current syntax would be cached
> for positions at every N bytes (where N would be, perhaps 1024, possibly
> 8192).  A call to syntax-ppss would simply call parse-partial-sexp from
> the latest valid cached position, filling out the cache as it goes.  Any
> buffer change would invalidate cached values for N > POS.

There are some defadvices for syntax-ppss and cousins in mumamo.el that 
does something like this. This is needed in multi major mode buffers if 
the normal font lock routines is used there.

I do not exactly do what you propose and a bit more is needed (for 
mumamo). I think however that any solution should take the need for 
multi major modes into account.

> I envisage coding this in C rather than Lisp.  There would be some
> complications to do with making sure the syntax table isn't tampered
> with, and so on.  This code would surely be fast and reliable.
> 
> Obviously I'm not proposing this for the pending release, but what do
> people think about the idea?
> 




  reply	other threads:[~2008-07-27  0:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-26 21:44 Idea for syntax-ppss. Is it new? Could it be any good? Alan Mackenzie
2008-07-27  0:36 ` Lennart Borgman (gmail) [this message]
2008-07-27  1:34 ` Stefan Monnier
2008-07-27 14:50   ` Alan Mackenzie
2008-07-27 15:51     ` Stefan Monnier
2008-07-27 19:20       ` Alan Mackenzie
2008-07-27 20:17         ` Stefan Monnier
2008-07-28  2:27     ` Richard M Stallman
2008-07-28  4:08       ` Stefan Monnier
2008-07-28 21:47         ` Richard M Stallman
2008-08-31  8:37     ` Better parse-partial-sexp; multiple major modes (was: Idea for syntax-ppss) Daniel Colascione
2008-08-31 15:02       ` Better parse-partial-sexp; multiple major modes Lennart Borgman (gmail)
2008-09-01  6:10       ` Better parse-partial-sexp; multiple major modes (was: Idea for syntax-ppss) Richard M. Stallman

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=488BC30A.7010009@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.