emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling C++ hackers. Please try out the new handling of C++11 lambda


From: Alan Mackenzie
Subject: Re: Calling C++ hackers. Please try out the new handling of C++11 lambda functions in CC Mode.
Date: Wed, 24 Aug 2016 19:43:52 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Richard.

On Wed, Aug 24, 2016 at 08:27:58PM +0100, Richard Copley wrote:
> Hi Alan,

> Thanks for this!

> I encountered a problem while trying to come up with an
> example so I could suggest a different default indentation
> style for lambda bodies:

> int main ()
> {
>   std::cout << ([] (int x) -> int {
>     return 2 * x;
>   } (10)) << std::endl;
> }

> Never mind the default indentation style, life's too short!
> But here is the problem I mentioned. I just pulled from master
> and recompiled and the bug is still present (as of your
> commit 799a8a3338389013e8a76a70f507664ccb09a14f).

> >>From emacs -Q:

> C-x b x RET ; switch to a new buffer
> M-x c++-mode RET
> { } C-p ; insert a pair of braces and put point between them
> [ ; insert a left square bracket

> Emacs freezes. It can be woken up by holding down C-g
> for a few seconds, at which point the *Messages*
> buffer has this:

> Error during redisplay: (jit-lock-function 55) signaled (quit)
> Error during redisplay: (jit-lock-function 57) signaled (quit)
> Error during redisplay: (jit-lock-function 60) signaled (quit)
> Quit [7 times]

Thanks for taking the trouble to report this.  What appears to be the
same problem was reported by Yakov Markovitch on the CC Mode list
yesterday evening.  I've investigated this and prepared a putative fix.

That fix is in the patch below.  Could you please apply the patch,
recompile CC Mode and try it out in normal C++ code, then let me know (a
second opinion besides Yakov's) whether it fixes the problem completely.

Thanks!  At the moment, I'm trying to get everything tidied up to
release CC Mode 5.33, and I'm hoping that this is the _last_ "last
minute" bug.



diff -r f3c92d9e3424 cc-fonts.el
--- a/cc-fonts.el       Sun Aug 21 15:17:45 2016 +0000
+++ b/cc-fonts.el       Tue Aug 23 20:36:35 2016 +0000
@@ -1654,7 +1654,7 @@
            (c-backward-token-2)))
 
        ;; Go round the following loop once per captured item.
-       (while (and (not (eq (char-after) ?\]))
+       (while (and (not (looking-at "\\s)"))
                    (< (point) limit))
          (if (eq (char-after) ?&)
              (progn (setq mode ?&)
@@ -1703,7 +1703,7 @@
            (c-forward-syntactic-ws)))
 
        (setq capture-default nil)
-       (forward-char))))                       ; over the terminating "]".
+       (forward-char))))              ; over the terminating "]" or whatever.
   nil)
 
 

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]