From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#16526: 24.3.50; scroll-conservatively & c-mode regression Date: Fri, 4 Jul 2014 19:29:02 +0000 Message-ID: <20140704192902.GB3535@acm.acm> References: <20140629091757.GA2948@acm.acm> <53AFE536.7010407@gmx.at> <20140629124829.GC2948@acm.acm> <53B02042.1050107@gmx.at> <20140629144151.GD2948@acm.acm> <53B03876.9070307@gmx.at> <20140629174953.GE2948@acm.acm> <53B117D6.1050306@gmx.at> <20140702200522.GB3823@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1404502483 17621 80.91.229.3 (4 Jul 2014 19:34:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Jul 2014 19:34:43 +0000 (UTC) Cc: 16526-done@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 04 21:34:31 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X39Fe-0003yW-5M for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Jul 2014 21:34:30 +0200 Original-Received: from localhost ([::1]:37857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X39Fd-0006Mn-P7 for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Jul 2014 15:34:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X39FR-0006Ma-Qa for bug-gnu-emacs@gnu.org; Fri, 04 Jul 2014 15:34:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X39FK-00068s-AJ for bug-gnu-emacs@gnu.org; Fri, 04 Jul 2014 15:34:17 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X39FC-00068M-Dv; Fri, 04 Jul 2014 15:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X39FC-0001r2-1B; Fri, 04 Jul 2014 15:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Fri, 04 Jul 2014 19:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16526 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 16526-done@debbugs.gnu.org id=D16526.14045024227087 (code D ref 16526); Fri, 04 Jul 2014 19:34:01 +0000 Original-Received: (at 16526-done) by debbugs.gnu.org; 4 Jul 2014 19:33:42 +0000 Original-Received: from localhost ([127.0.0.1]:43131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X39Er-0001qE-QV for submit@debbugs.gnu.org; Fri, 04 Jul 2014 15:33:42 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:46177 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X39Ep-0001q3-2E for 16526-done@debbugs.gnu.org; Fri, 04 Jul 2014 15:33:40 -0400 Original-Received: (qmail 47651 invoked by uid 3782); 4 Jul 2014 19:33:37 -0000 Original-Received: from acm.muc.de (pD951A878.dip0.t-ipconnect.de [217.81.168.120]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 04 Jul 2014 21:33:36 +0200 Original-Received: (qmail 4098 invoked by uid 1000); 4 Jul 2014 19:29:02 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91190 Archived-At: Hi, Stefan. On Wed, Jul 02, 2014 at 09:57:23PM -0400, Stefan Monnier wrote: > > No. The particular rogue invocation of scan-lists which caused this > > (sub-)thread scans from BOB to near EOB 29 times. Inside scan-lists, > > _NO_ changes to syntax-tables, s-t text properties etc. are possible. > > What I'm suggesting is that cacheing that first scan from BOB will be a > > big win for many time-consuming scan-listses. > Here's the situation: we can add some special code to handle your case. > But adding code which will use syntax-ppss would be more beneficial for > 99% of the major modes. My suggestion is less radical, in that it leaves the functionality of scan-lists unchanged. It's speedup may be indistinguishable from the strategy of simply using syntax-ppss. > Adding a cache that only works within a single scan-lists instance is > too much trouble for too little gain. Modulo a binding to nil (or two), it could be the same code as that which simply uses the existing syntax-ppss cache. Without trying it, we don't know how big or little the gain is. > Adding a cache that is flushed less often means either it will suffer > from the same limitations as syntax-ppss (so we may as well use > syntax-ppss), or it needs to additionally hook into the text-property > and set-syntax-table code to be flushed in those extra corner cases, > and there again these extra checks will be only useful for those rare > modes like CC-mode and will be at best harmless and in some cases > detrimental to performance compared to simply using syntax-ppss. Yes, to all of that, except I doubt the performance penalty in the last bit would be noticeable (it'd be in C code, surely?). > IOW, using syntax-ppss for find_defun_start is The Right Thing to do. It is the route of least effort, perhaps, which is important. It will give suboptimal results for modes where syntax-ppss's basic assumptions don't hold. But this is also true of the exising scan-lists, so isn't, perhaps, too important. As a matter of interest, is there an existing mechanism for calling lisp from random bits of the C code? > And CC-mode should then be fixed to take advantage of it. It being syntax-ppss. What CC Mode frequently needs to know is whether a given position is in a comment, string, preprocessor construct, or other code. parse-partial-sexp and syntax-ppss don't give enough information for this, hence aren't used for this directly. A long term solution may be to enhance the syntax bits of Emacs to recognise "syntactic islands" (e.g. C preprocessor construct, shell script "here documents" or literate programming chunks) somehow. > Stefan -- Alan Mackenzie (Nuremberg, Germany).