* FW: about cc-mode bug
@ 2006-11-01 14:56 Marshall, Simon
0 siblings, 0 replies; 4+ messages in thread
From: Marshall, Simon @ 2006-11-01 14:56 UTC (permalink / raw)
Cc: 'fengli@gmail.com'
[-- Attachment #1: Type: text/plain, Size: 2130 bytes --]
This patch (redone for cvs emacs and attached) works great for me, so I
suggest it is incorporated...
Many thanks to Feng Li!
Simon.
-----Original Message-----
From: fengli [mailto:fengli@gmail.com]
Sent: 28 October 2006 11:10
To: Marshall, Simon
Subject: about cc-mode bug
Hi,
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)))))
nil)
+ (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]*<[^>*]>[
\t\n]+\\)?\\(class\\|struct|\\interface\\|namespace\\)"))
+ (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) ?\()
'font-lock-function-name-face
'font-lock-variable-name-face)
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))
'font-lock-function-name-face
'font-lock-variable-name-face)
got-init (and (match-beginning 1)
--
Feng Li
[-- Attachment #2: cc-fonts.diff --]
[-- Type: application/octet-stream, Size: 671 bytes --]
Index: cc-fonts.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/cc-fonts.el,v
retrieving revision 1.16
diff -r1.16 cc-fonts.el
819a820,828
> (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]*<[^>*]>[\t\n]+\\)?\\(class\\|struct|\\interface\\|namespace\\)"))
> (error t)))
>
900c909,910
< id-face (if (eq (char-after next-pos) ?\()
---
> id-face (if (and (eq (char-after next-pos) ?\()
> (my-c-maybe-defun next-pos))
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: FW: about cc-mode bug
@ 2006-11-01 16:54 Marshall, Simon
2006-11-02 21:46 ` Richard Stallman
0 siblings, 1 reply; 4+ messages in thread
From: Marshall, Simon @ 2006-11-01 16:54 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 912 bytes --]
erm, ignore the recently emailed patch to cc-fonts.el. i misunderstood that
this had come from a cc-mode developer and this is not the case - i don't
even know if feng li has signed papers.
but it's given me an idea for where a simpler solution can be made and i
will email that shortly.
sorry about that, simon.
_____
From: Feng Li [mailto:fengli@gmail.com]
Sent: 01 November 2006 15:40
To: Marshall, Simon
Subject: Re: FW: about cc-mode bug
hi,
I'm glad to know that my patch is useful, But I'm not in the position to
decide if this should get into cc-mode because I'm just an user like you,
not a cc-mode developer.
And in the attachment is my latest version.
2006/11/1, Marshall, Simon <simon.marshall@misys.com
<mailto:simon.marshall@misys.com> >:
This patch (redone for cvs emacs and attached) works great for me, so I
suggest it is incorporated...
Many thanks to Feng Li!
Simon.
[-- Attachment #1.2: Type: text/html, Size: 2333 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FW: about cc-mode bug
2006-11-01 16:54 FW: about cc-mode bug Marshall, Simon
@ 2006-11-02 21:46 ` Richard Stallman
0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2006-11-02 21:46 UTC (permalink / raw)
Cc: emacs-devel
erm, ignore the recently emailed patch to cc-fonts.el. i misunderstood that
this had come from a cc-mode developer and this is not the case - i don't
even know if feng li has signed papers.
It is short enough that we can install it without papers.
The only question is whether it is correct. I asked bug-cc-mode
to look at it, and I hope that he will, but he has been rather
busy these days.
Could people try that patch and see if it breaks anything?
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: FW: about cc-mode bug
@ 2006-11-03 9:24 Marshall, Simon
0 siblings, 0 replies; 4+ messages in thread
From: Marshall, Simon @ 2006-11-03 9:24 UTC (permalink / raw)
Cc: 'emacs-devel@gnu.org'
> It is short enough that we can install it without papers.
> The only question is whether it is correct. I asked
> bug-cc-mode to look at it, and I hope that he will, but he
> has been rather busy these days.
>
> Could people try that patch and see if it breaks anything?
I posted a better patch as a reply to my original bug report "Font-lock
assumes C++ variables instantiated via ctor are functions". That patch
should be used instead.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-11-03 9:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-01 16:54 FW: about cc-mode bug Marshall, Simon
2006-11-02 21:46 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2006-11-03 9:24 Marshall, Simon
2006-11-01 14:56 Marshall, Simon
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.