[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 89d1776: Fix spurious fontification of "for (; a *
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master 89d1776: Fix spurious fontification of "for (; a * b; )" in CC Mode. |
Date: |
Mon, 25 Apr 2016 18:04:08 +0000 |
branch: master
commit 89d1776b81ab552192ee41f13ce84ff86bda4556
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
Fix spurious fontification of "for (; a * b;)" in CC Mode.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Check for being
inside the parens of a for statement and after a semicolon near the
beginning
of the lambda form.
---
lisp/progmodes/cc-fonts.el | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index e171b20..6c34851 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1205,8 +1205,20 @@ casts and declarations are fontified. Used on level 2
and higher."
'font-lock-keyword-face)
(looking-at c-not-decl-init-keywords))
(and c-macro-with-semi-re
- (looking-at c-macro-with-semi-re))) ; 2008-11-04
- ;; Don't do anything more if we're looking at a keyword that
+ (looking-at c-macro-with-semi-re)) ; 2008-11-04
+ (save-excursion ; A construct after a ; in a `for' statement
+ ; can't be a declaration.
+ (and (c-go-up-list-backward)
+ (eq (char-after) ?\()
+ (progn (c-backward-syntactic-ws)
+ (c-simple-skip-symbol-backward))
+ (looking-at c-paren-stmt-key)
+ (progn (goto-char match-pos)
+ (while (and (eq (char-before) ?\))
+ (c-go-list-backward))
+ (c-backward-syntactic-ws))
+ (eq (char-before) ?\;)))))
+ ;; Don't do anything more if we're looking at something that
;; can't start a declaration.
t
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 89d1776: Fix spurious fontification of "for (; a * b; )" in CC Mode.,
Alan Mackenzie <=