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#11749: Acknowledgement (24.1; C-mode indentation gives wrong-type-argument error.) Date: Wed, 10 Oct 2012 20:00:25 +0000 Message-ID: <20121010200025.GA3449@acm.acm> References: <20120902211620.GA3824@acm.acm> <50447C94.2040402@cua.dk> <20120905204821.GA3620@acm.acm> <87ipbqpkb7.fsf@maru.md5i.com> <20120908211451.GA22477@acm.acm> <20121007105951.GA3194@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1349899606 10344 80.91.229.3 (10 Oct 2012 20:06:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Oct 2012 20:06:46 +0000 (UTC) Cc: "11749@debbugs.gnu.org" <11749@debbugs.gnu.org>, Kim Storm To: Michael Welsh Duggan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 10 22:06:52 2012 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 1TM2YM-0004fm-VD for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Oct 2012 22:06:51 +0200 Original-Received: from localhost ([::1]:48806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TM2YG-0002bQ-K0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Oct 2012 16:06:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TM2YA-0002Xw-3o for bug-gnu-emacs@gnu.org; Wed, 10 Oct 2012 16:06:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TM2Y4-00065j-Qd for bug-gnu-emacs@gnu.org; Wed, 10 Oct 2012 16:06:38 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TM2Xu-0005wy-9t; Wed, 10 Oct 2012 16:06:22 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TM2YY-0003dn-FZ; Wed, 10 Oct 2012 16:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 10 Oct 2012 20:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11749 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 11749-submit@debbugs.gnu.org id=B11749.134989959213958 (code B ref 11749); Wed, 10 Oct 2012 20:07:02 +0000 Original-Received: (at 11749) by debbugs.gnu.org; 10 Oct 2012 20:06:32 +0000 Original-Received: from localhost ([127.0.0.1]:38087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TM2Y4-0003d5-04 for submit@debbugs.gnu.org; Wed, 10 Oct 2012 16:06:32 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:54654 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TM2Y0-0003cw-HK for 11749@debbugs.gnu.org; Wed, 10 Oct 2012 16:06:30 -0400 Original-Received: (qmail 74136 invoked by uid 3782); 10 Oct 2012 20:05:46 -0000 Original-Received: from acm.muc.de (pD9519D8F.dip.t-dialin.net [217.81.157.143]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 10 Oct 2012 22:05:38 +0200 Original-Received: (qmail 3803 invoked by uid 1000); 10 Oct 2012 20:00:25 -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.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:65471 Archived-At: Hi, Michael, On Tue, Oct 09, 2012 at 10:05:07AM -0400, Michael Welsh Duggan wrote: > Alan Mackenzie writes: [ .... ] > >> >>> M-x c-toggle-parse-state-debug > >> >>> It works by calculating c-parse-state twice for each call - The first > >> >>> time normally, then again with the internal state bound to "newly > >> >>> initialised". If the the two results differ, they are printed to > >> >>> *Messages*, together with the saved previous state. If this does > >> >>> trigger, please note any recent buffer changes. It may make editing > >> >>> intolerably slow. > >> >> I will turn this on. > >> I turned this on, and inserted a (ding) where cc-mode outputs an > >> inconsistency message. I can barely stand to edit code now, due to > >> what seem to be almost every key press causing a beep. Have you made > >> any progress here, or do you need more data? > > I have found the bug which is causing (most of) these dings, though I > > don't think it is the one which caused Kim's original bug. Could you try > > out the patch below, please. (I have also enhanced/corrected the > > debugging routines a bit, too.) > Still doesn't seem to help much here. I have attached a file which > reliably causes a cache failure. I have attached the smallest file of > the set of files I am working on that causes this particular problem. > Load the attached file and toggle on parse state debugging. Then scroll > to the bottom of the file. (Use C-v multiple times, or just M->.) One > reason I have attached this file is that it only triggers the warning > message once. Most of my larger files cause this to happen quite a lot. What is happening in this file is another bug, arising from historical assumptions which are no longer valid. The "from scratch" calculation notes that the starting scanning position would be a long way (>5000) back, hence it tries going back to the second "beginning-of-defun" to get a top-level starting point. This "beginning-of-defun" is a pure "brace in column zero" test. This doesn't work in C++ when constructs inside a namespace have braces at column zero, something I believe has become very common in recent years. Namespaces didn't exist in C++ when c-parse-state was originally written. Obviously this optimisation is no longer valid. I wouldn't be surprised if it has caused quite a bit of buggy behaviour. I'll need to think it over for a few days to decide what to do. Again, thanks for taking so much trouble in submitting these bug reports. > -- > Michael Welsh Duggan > (mwd@cert.org) -- Alan Mackenzie (Nuremberg, Germany).