emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 30e6e55: Fix variables in C++ "for" statement not a


From: Alan Mackenzie
Subject: [Emacs-diffs] master 30e6e55: Fix variables in C++ "for" statement not always being fontified.
Date: Thu, 27 Jul 2017 13:09:33 -0400 (EDT)

branch: master
commit 30e6e558701ebc781cdca3b9d61d995004cfef7d
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Fix variables in C++ "for" statement not always being fontified.
    
    The error happened when there was a comma inside template delimiters.
    
    * lisp/progmodes/cc-fonts.el (c-get-fontification-context): In "for"
    statements, recognise template delimiters containing "," and "&".
---
 lisp/progmodes/cc-fonts.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 66f2575..e8552af 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1182,10 +1182,15 @@ casts and declarations are fontified.  Used on level 2 
and higher."
                  (goto-char match-pos)
                  (backward-char)
                  (c-backward-token-2)
-                 (or (looking-at c-block-stmt-2-key)
-                     (looking-at c-block-stmt-1-2-key)
-                     (looking-at c-typeof-key))))
-          (cons nil t))
+                 (cond
+                  ((looking-at c-paren-stmt-key)
+                   ;; Allow comma separated <> arglists in for statements.
+                   (cons nil nil))
+                  ((or (looking-at c-block-stmt-2-key)
+                       (looking-at c-block-stmt-1-2-key)
+                       (looking-at c-typeof-key))
+                   (cons nil t))
+                  (t nil)))))
          ;; Near BOB.
          ((<= match-pos (point-min))
           (cons 'arglist t))



reply via email to

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