all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: Huge {...} blocks in C/C++ again
Date: Sat, 9 Aug 2014 21:03:08 +0000	[thread overview]
Message-ID: <20140809210308.GA3438@acm.acm> (raw)
In-Reply-To: <20131023210008.GC4175@acm.acm>

Hello, Dmitry.

I've installed this patch in the trunk, revision #117676.

On Wed, Oct 23, 2013 at 09:00:09PM +0000, Alan Mackenzie wrote:
> 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).



      reply	other threads:[~2014-08-09 21:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14 16:57 Huge {...} blocks in C/C++ again Dmitry Antipov
2013-10-18 20:18 ` Alan Mackenzie
2013-10-23 21:00 ` Alan Mackenzie
2014-08-09 21:03   ` Alan Mackenzie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140809210308.GA3438@acm.acm \
    --to=acm@muc.de \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.