[Top][All Lists]

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

FW: about cc-mode bug

From: Marshall, Simon
Subject: FW: about cc-mode bug
Date: Wed, 1 Nov 2006 14:56:30 -0000

This patch (redone for cvs emacs and attached) works great for me, so I
suggest it is incorporated...

Many thanks to Feng Li!


-----Original Message-----
From: fengli [mailto:address@hidden 
Sent: 28 October 2006 11:10
To: Marshall, Simon
Subject: about cc-mode bug


this patch will fix the "variable instantiation fontified as function name"
bug.  I'm not sure if this hack will cause too much performance hit though
(because we have to look back at the context to decide if it is a variable
or a function anyway).

Index: cc-fonts.el
RCS file: /sources/emacs/emacs/lisp/progmodes/cc-fonts.el,v
retrieving revision 1.16
diff -c -r1.16 cc-fonts.el
*** cc-fonts.el    10 Jul 2006 13:17:09 -0000    1.16
--- cc-fonts.el    28 Oct 2006 09:49:23 -0000
*** 817,822 ****
--- 817,831 ----
        (goto-char pos)))))
+ (defun my-c-maybe-defun (location)
+   (condition-case nil
+       (save-excursion
+         (goto-char location)
+         (backward-up-list)
+         (c-beginning-of-statement 1)
+         (looking-at "\\(template[ \t]*<[^>*]>[
+     (error t)))
  (defun c-font-lock-declarators (limit list types)
    ;; Assuming the point is at the start of a declarator in a
    ;; declaration, fontify it.  If LIST is non-nil, fontify also all
*** 897,903 ****
           "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t))
        (setq next-pos (match-beginning 0)
!         id-face (if (eq (char-after next-pos) ?\()
          got-init (and (match-beginning 1)
--- 906,913 ----
           "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t))
        (setq next-pos (match-beginning 0)
!         id-face (if (and (eq (char-after next-pos) ?\()
!                          (my-c-maybe-defun next-pos))
          got-init (and (match-beginning 1)

Feng Li

Attachment: cc-fonts.diff
Description: Binary data

reply via email to

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