aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2017-07-27 17:05:53 +0000
committerAlan Mackenzie2017-07-27 17:05:53 +0000
commit30e6e558701ebc781cdca3b9d61d995004cfef7d (patch)
treef2f190c4ddc3d5aabbe6fb06962827d1b6fa2bca
parent82583d4dde465c0d923eec306d0f9c5d671955bc (diff)
downloademacs-30e6e558701ebc781cdca3b9d61d995004cfef7d.tar.gz
emacs-30e6e558701ebc781cdca3b9d61d995004cfef7d.zip
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 "&".
-rw-r--r--lisp/progmodes/cc-fonts.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 66f2575f49f..e8552af8ed8 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."
1182 (goto-char match-pos) 1182 (goto-char match-pos)
1183 (backward-char) 1183 (backward-char)
1184 (c-backward-token-2) 1184 (c-backward-token-2)
1185 (or (looking-at c-block-stmt-2-key) 1185 (cond
1186 (looking-at c-block-stmt-1-2-key) 1186 ((looking-at c-paren-stmt-key)
1187 (looking-at c-typeof-key)))) 1187 ;; Allow comma separated <> arglists in for statements.
1188 (cons nil t)) 1188 (cons nil nil))
1189 ((or (looking-at c-block-stmt-2-key)
1190 (looking-at c-block-stmt-1-2-key)
1191 (looking-at c-typeof-key))
1192 (cons nil t))
1193 (t nil)))))
1189 ;; Near BOB. 1194 ;; Near BOB.
1190 ((<= match-pos (point-min)) 1195 ((<= match-pos (point-min))
1191 (cons 'arglist t)) 1196 (cons 'arglist t))