From e220d6e112e33f3f897c305d0d5d278d83191774 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 14 Dec 2017 21:04:39 +0000 Subject: [PATCH] Fix fontification of first declaration within a C++ lambda form. * lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): Cease spuriously recognizing the braces of a lambda form as a brace list when there is an "=" preceding the introductory brackets. --- lisp/progmodes/cc-engine.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 881209c286e..12ec8f74fea 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10440,7 +10440,7 @@ comment at the start of cc-engine.el for more info." c-decl-block-key)) (braceassignp 'dontknow) inexpr-brace-list bufpos macro-start res pos after-type-id-pos - in-paren) + in-paren parens-before-brace) (setq res (c-backward-token-2 1 t lim)) ;; Checks to do only on the first sexp before the brace. @@ -10458,6 +10458,9 @@ comment at the start of cc-engine.el for more info." ((and (looking-at c-symbol-start) (not (looking-at c-keywords-regexp))) (setq after-type-id-pos (point))) + ((eq (char-after) ?\() + (setq parens-before-brace t) + nil) (t nil)) (save-excursion (cond @@ -10506,6 +10509,14 @@ comment at the start of cc-engine.el for more info." ;; Single identifier between '(' and '{'. We have a bracelist. (cons after-type-id-pos 'in-paren)) + ;; Are we at the parens of a C++ lambda expression? + ((and parens-before-brace + (save-excursion + (and + (zerop (c-backward-token-2 1 t lim)) + (c-looking-at-c++-lambda-capture-list)))) + nil) ; a lambda expression isn't a brace list. + (t (goto-char pos) ;; Checks to do on all sexps before the brace, up to the -- 2.39.2