From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Idea for syntax-ppss. Is it new? Could it be any good? Date: Sun, 27 Jul 2008 02:36:26 +0200 Message-ID: <488BC30A.7010009@gmail.com> References: <20080726214429.GB3623@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1217119009 8444 80.91.229.12 (27 Jul 2008 00:36:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Jul 2008 00:36:49 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 27 02:37:38 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KMuGY-0005m9-29 for ged-emacs-devel@m.gmane.org; Sun, 27 Jul 2008 02:37:38 +0200 Original-Received: from localhost ([127.0.0.1]:53835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KMuFe-0003My-1q for ged-emacs-devel@m.gmane.org; Sat, 26 Jul 2008 20:36:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KMuFX-0003Lx-Bh for emacs-devel@gnu.org; Sat, 26 Jul 2008 20:36:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KMuFV-0003LG-8X for emacs-devel@gnu.org; Sat, 26 Jul 2008 20:36:34 -0400 Original-Received: from [199.232.76.173] (port=58557 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KMuFV-0003LC-1x for emacs-devel@gnu.org; Sat, 26 Jul 2008 20:36:33 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]:53150) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KMuFU-0006lv-HM for emacs-devel@gnu.org; Sat, 26 Jul 2008 20:36:32 -0400 Original-Received: from c83-254-151-176.bredband.comhem.se ([83.254.151.176]:61971 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1KMuFS-0000y7-9N; Sun, 27 Jul 2008 02:36:31 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: <20080726214429.GB3623@muc.de> X-Antivirus: avast! (VPS 080726-1, 2008-07-26), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.151.176 X-Scan-Result: No virus found in message 1KMuFS-0000y7-9N. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1KMuFS-0000y7-9N a888ddde1e6cbf0cc8223bc6704979dc X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:101569 Archived-At: 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? >