help-gnu-emacs
[Top][All Lists]
Advanced

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

Trouble with C++ mode fontification


From: Davin Pearson
Subject: Trouble with C++ mode fontification
Date: 8 Apr 2007 21:53:16 -0700
User-agent: G2/1.0

To: bug-gnu-
emacs@gnu.org
Subject:
afsadf
--text follows this
line--
This bug report will be sent to the Free Software
Foundation,
not to your local site
managers!
Please write in English, because the Emacs maintainers do not
have
translators to read other languages for
them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing
list,
and to the gnu.emacs.bug news
group.

In GNU Emacs 21.3.1 (i386-mingw-
nt5.1.2600)
 of 2004-03-11 on
NYAUMO
configured using `configure --with-gcc
(3.2)'
Important
settings:
  value of $LC_ALL:
nil
  value of $LC_COLLATE:
nil
  value of $LC_CTYPE:
nil
  value of $LC_MESSAGES:
nil
  value of $LC_MONETARY:
nil
  value of $LC_NUMERIC:
nil
  value of $LC_TIME:
nil
  value of $LANG:
ENZ
  locale-coding-system: iso-
latin-1
  default-enable-multibyte-characters:
t

Please describe exactly what actions triggered the
bug
and the precise symptoms of the
bug:

For a reason that is only known to me, I wish to add the
following
code to fontify c++-mode
buffers:

(add-hook 'font-lock-mode-hook 'my-special-font-lock-mode-
hook)

(make-face 'my-face-cc-illegal-
type)
(set-face-background 'my-face-cc-illegal-type
"#0ff")
(set-face-foreground 'my-face-cc-illegal-type
"#f00")

(defun my-special-font-lock-mode-hook
()
  (font-lock-add-keywords 'c++-
mode
 
'(
                            ("\\<[A-Z]+[a-z][a-zA-Z0-9_]*\\>" 0 'my-
face-cc-illegal-type nil)
                            )
 
nil
                          ))

The problem for me is that it also fontifies occurrences of
this
regexp in strings and comments when all I want it to fontify
are
occurrences in code
proper.

Does anyone know how I can achieve
this?

My hunch is that what I am trying to do is beyond the
functionality
that was written by the writers of the font locking code.
Please
correct me if I am
wrong.

If my desired feature is not supported then would one of
the
developers of Emacs consider implementing
it?

I considered replacing the "t" in the above code with "nil", but
then
occurences that are part of parameters are not fontified
correctly.

Recent
input:
<up> <return> C-y <return> <return> <S-down> <S-
down>
<S-down> <S-down> <S-down> <S-down> <S-down>
<down>
<end> <home> C-k C-l C-k C-k C-k C-k C-k C-k C-k C-
k
C-k C-k <up> <up> <up> <delete> <delete> <delete>
<f2>
<S-down> <S-down> <down> <down> <down> <down>
<down>
<down> <down> <down> <down> <home> <S-up> <S-up> <S-
up>
<S-up> <S-up> <S-up> <S-up> <f2> <up> <up> <up>
<up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up>
<up> <up> <up> <up> <up> <up> <up> <up> <up>
<delete>
<up> <up> <up> <up> <f2> <f2> <help-echo> <down-
mouse-1>
<mouse-1> <M-f1> <help-echo> <f2> M-x r e p <tab>
o
r <tab>
<return>

Recent
messages:
(No files need
saving)
Saving some
buffers
Wrote d:/home/text/gnu.emacs.star/for-a-
reason.txt
Saving some
buffers
(No files need
saving)
Copied buffer to
clipboard
Saving some
buffers
(No files need
saving)
Making completion
list...
Loading emacsbug...done



reply via email to

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