]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix variables in C++ "for" statement not always being fontified.
authorAlan Mackenzie <acm@muc.de>
Thu, 27 Jul 2017 17:05:53 +0000 (17:05 +0000)
committerAlan Mackenzie <acm@muc.de>
Thu, 27 Jul 2017 17:05:53 +0000 (17:05 +0000)
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

index 66f2575f49fdebad119c0a88b701228904a77fe9..e8552af8ed8c339f2eed3c894c503e487bc74f6e 100644 (file)
@@ -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))