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: Wed, 29 Jan 2014 22:36:27 +0000 Message-ID: <20140129223626.GD3092__20926.8436687582$1391035246$gmane$org@acm.acm> References: <83r47wausm.fsf@gnu.org> <52E3EAC2.2040100@gmx.at> <83lhy4as2l.fsf@gnu.org> <52E4019C.5080905@gmx.at> <83k3dnc3rl.fsf@gnu.org> <83iot7c3bq.fsf@gnu.org> <52E4EF61.3050404@gmx.at> <831tzubqxw.fsf@gnu.org> <20140126204310.GA3937@acm.acm> <52E61704.6050807@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1391035233 26898 80.91.229.3 (29 Jan 2014 22:40:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Jan 2014 22:40:33 +0000 (UTC) Cc: 16526@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 29 23:40:40 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 1W8doE-0005m2-6D for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Jan 2014 23:40:38 +0100 Original-Received: from localhost ([::1]:45523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8doD-0003pE-Qi for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Jan 2014 17:40:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8dnu-0003mK-0v for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2014 17:40:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8dnm-0000c7-MD for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2014 17:40:17 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8dne-0000Nb-Rl; Wed, 29 Jan 2014 17:40:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W8dne-0003hf-32; Wed, 29 Jan 2014 17:40:02 -0500 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: Wed, 29 Jan 2014 22:40:02 +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-submit@debbugs.gnu.org id=B16526.139103518714211 (code B ref 16526); Wed, 29 Jan 2014 22:40:02 +0000 Original-Received: (at 16526) by debbugs.gnu.org; 29 Jan 2014 22:39:47 +0000 Original-Received: from localhost ([127.0.0.1]:40728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W8dnO-0003h8-UE for submit@debbugs.gnu.org; Wed, 29 Jan 2014 17:39:47 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:28872 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W8dnL-0003gx-Fu for 16526@debbugs.gnu.org; Wed, 29 Jan 2014 17:39:44 -0500 Original-Received: (qmail 19912 invoked by uid 3782); 29 Jan 2014 22:39:42 -0000 Original-Received: from acm.muc.de (pD95197D0.dip0.t-ipconnect.de [217.81.151.208]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 29 Jan 2014 23:39:41 +0100 Original-Received: (qmail 4718 invoked by uid 1000); 29 Jan 2014 22:36:27 -0000 Content-Disposition: inline In-Reply-To: <52E61704.6050807@gmx.at> 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:84230 Archived-At: Hi, Martin. On Mon, Jan 27, 2014 at 09:21:24AM +0100, martin rudalics wrote: > > The @dfn{state cache}, a list of certain brace/paren/bracket positions > > around some position, is set for a position near EOB. With the switch to > > a different position, CC Mode tweaks the state cache rather than > > calculating it anew starting at BOB. When the new position is nearer > > BOB, the code searches backwards for the appropriate braces. However, it > > shouldn't be scanning the entire buffer backwards. There is clearly a > > bug here. > In my scenario `end-of-buffer' should already have produced the complete > state cache. How else would you have been able to fontify code near EOB > correctly? The state cache contains not only a list of enclosing braces/brackets/parentheses but also any brace pair immediately preceding one of these things. So a typical state cache looks like: (4532 (4284 . 4526) 4278 (4131 . 4248)) (with a detailed explanation in cc-engine.el in the comment for `c-parse-state-1'). When c-parse-state is called at a position somewhat distant from the previous call, it modifies the state cache by crawling through the buffer rather than recalculating it from scratch. > > The backward scan-lists calls will be causing continual forward searches > > from BOB in syntax.c, every time the backward scan hits a comment ender. > IIUC now any call to `forward-comment' with a negative argument will > automatically go to BOB unless it's already there. How else could it > determine that it's not called from a position within a comment? I don't think this happens. back_comment (in syntax.c) assumes it starts outside a comment. > So if you decide to bind `open-paren-in-column-0-is-defun-start' to > nil, then why don't you build the state cache anew from BOB? The state cache has different values for different buffer positions. > In any case, please provide an option say > `c-open-paren-in-column-0-is-defun-start' which people can set to > avoid those scans. The doc-string should mention that things like > Michael's commented out code are handled correctly iff this option is > nil and that long delays while working with c-mode can be sometimes > avoided by setting this option to t. The default value could be > obviously nil. I'm hoping that the (rough) patch in one of my other emails from this evening will have solved the bug, so that playing around with open-paren-in-column-0-etc. won't be needed. As a matter of interest, with my patch applied, running your recipe on xdisp.c took me 4.4 seconds (including the (sit-for 3)). > martin -- Alan Mackenzie (Nuremberg, Germany).