From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Huge {...} blocks in C/C++ again Date: Wed, 23 Oct 2013 21:00:09 +0000 Message-ID: <20131023210008.GC4175@acm.acm> References: <525C2291.40607@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1382562146 31241 80.91.229.3 (23 Oct 2013 21:02:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2013 21:02:26 +0000 (UTC) Cc: Emacs development discussions To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 23 23:02:31 2013 Return-path: Envelope-to: ged-emacs-devel@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 1VZ5ZU-0002Nm-Ke for ged-emacs-devel@m.gmane.org; Wed, 23 Oct 2013 23:02:28 +0200 Original-Received: from localhost ([::1]:51427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZ5ZU-0005TB-91 for ged-emacs-devel@m.gmane.org; Wed, 23 Oct 2013 17:02:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZ5ZL-0005KX-96 for emacs-devel@gnu.org; Wed, 23 Oct 2013 17:02:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZ5ZE-0001sT-Pa for emacs-devel@gnu.org; Wed, 23 Oct 2013 17:02:19 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:49632 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZ5ZE-0001sA-K2 for emacs-devel@gnu.org; Wed, 23 Oct 2013 17:02:12 -0400 Original-Received: (qmail 35825 invoked by uid 3782); 23 Oct 2013 21:02:10 -0000 Original-Received: from acm.muc.de (p5492CAD2.dip0.t-ipconnect.de [84.146.202.210]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 23 Oct 2013 23:02:09 +0200 Original-Received: (qmail 4522 invoked by uid 1000); 23 Oct 2013 21:00:09 -0000 Content-Disposition: inline In-Reply-To: <525C2291.40607@yandex.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164491 Archived-At: Hello again, Dmitry. On Mon, Oct 14, 2013 at 08:57:53PM +0400, Dmitry Antipov wrote: > An issue from: > https://lists.gnu.org/archive/html/emacs-devel/2012-12/msg00483.html > is exactly reproduced on this header from LLVM project, most probably > due to huge > #ifdef __cplusplus <=============================== > extern "C" { > #endif > /* a lot of things */ > #ifdef __cplusplus > } // extern "C" > #endif > block - a lot of things between top-level { and } hangs everything, > without a chance to quit with C-g. This isn't quite the cause. What is actually happening is that CC Mode is repeatedly searching backwards from the first "#ifdef" line for almost any punctuation character which isn't in "syntactic whitespace" (i.e. in a comment or macro). Those 845 #defines take a lot of searching over. This is a tricky one to fix, since I don't quite understand why the critical bit of code is there. It was inserted into the source in 2006, but isn't itself buggy. It is `c-at-toplevel-p' which is buggy. But in the meantime, the following temporary patch should get your C Mode scrolling again: *** cc-fonts.el 2013-10-20 14:21:58.000000000 +0000 --- cc-fonts.el.temp 2013-10-23 20:36:31.000000000 +0000 *************** *** 1116,1126 **** "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t)) (setq next-pos (match-beginning 0) ! id-face (if (and (eq (char-after next-pos) ?\() ! (let (c-last-identifier-range) ! (save-excursion ! (goto-char next-pos) ! (c-at-toplevel-p)))) 'font-lock-function-name-face 'font-lock-variable-name-face) got-init (and (match-beginning 1) --- 1116,1122 ---- "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t)) (setq next-pos (match-beginning 0) ! id-face (if (eq (char-after next-pos) ?\() 'font-lock-function-name-face 'font-lock-variable-name-face) got-init (and (match-beginning 1) Thanks for the bug report. > Dmitry -- Alan Mackenzie (Nuremberg, Germany).