unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* font-lock-add-keywords problem
@ 2006-03-05 15:41 Stefan Bienert
  2006-03-09 21:57 ` ken
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Bienert @ 2006-03-05 15:41 UTC (permalink / raw)


Hi there,

I have a problem with the adding of own types to the c-mode in emacs. I have used:

(font-lock-add-keywords
 'c-mode
 '(("\\<\\(Shortint\\)\\>" 1 font-lock-type-face t)))

to make emacs highlighting the type "Shortint". But now its also highlighted in comments /* Shortint */.
What can I do to unhighlight it in comments?

-- 
mit freundlichen Gruessen

Stefan Bienert

The box said,
                     -----------------------------
                     |Requires Windows 98|
                     |         or better.          |
                     -----------------------------

                     SO I INSTALLED LINUX.
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: font-lock-add-keywords problem
       [not found] <mailman.74.1141573314.21065.help-gnu-emacs@gnu.org>
@ 2006-03-05 18:48 ` Johan Bockgård
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Bockgård @ 2006-03-05 18:48 UTC (permalink / raw)


Stefan Bienert <stefanbienert@web.de> writes:

> I have a problem with the adding of own types to the c-mode in
> emacs. I have used:
>
> (font-lock-add-keywords
>  'c-mode
>  '(("\\<\\(Shortint\\)\\>" 1 font-lock-type-face t)))
                                                   
Remove the `t' ------------------------------------^

> to make emacs highlighting the type "Shortint". But now its also
> highlighted in comments /* Shortint */. What can I do to unhighlight
> it in comments?

,----[ C-h v font-lock-keywords RET ]
| [...]
|
| MATCH-HIGHLIGHT should be of the form:
| 
|  (SUBEXP FACENAME [OVERRIDE [LAXMATCH]])
|
| [...]
|
| If OVERRIDE is t, existing fontification can be overwritten. [...]
`----

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: font-lock-add-keywords problem
  2006-03-05 15:41 font-lock-add-keywords problem Stefan Bienert
@ 2006-03-09 21:57 ` ken
  0 siblings, 0 replies; 3+ messages in thread
From: ken @ 2006-03-09 21:57 UTC (permalink / raw)
  Cc: help-gnu-emacs



Stefan Bienert wrote:
> Hi there,
> 
> I have a problem with the adding of own types to the c-mode in emacs. I have used:
> 
> (font-lock-add-keywords
>  'c-mode
>  '(("\\<\\(Shortint\\)\\>" 1 font-lock-type-face t)))
> 
> to make emacs highlighting the type "Shortint". But now its also highlighted in comments /* Shortint */.
> What can I do to unhighlight it in comments?
> 

>From "C-h f font-lock-add-keywords":

"For example:

 (font-lock-add-keywords 'c-mode
  '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
    ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))

adds two fontification patterns for C mode, to fontify `FIXME:' words,
even in comments, and to fontify `and', `or' and `not' words as
keywords...."

I'm no elisp programmer at all, but since no one else seems to know, I'm
guessing that you need to employ the syntax in the third line of the
example.  As a sidenote though, I tried the snippet of code above, only
changing "c-mode" to "html-helper-mode" and didn't get any highlighting
at all (this in a buffer which has html tags already highlighted).  The
help page didn't say anything about bat wings or eye of newt, but I
think you need those too.

hth,
ken
-- 
"This world ain't big enough for the both of us,"
said the big noema to the little noema.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-09 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-05 15:41 font-lock-add-keywords problem Stefan Bienert
2006-03-09 21:57 ` ken
     [not found] <mailman.74.1141573314.21065.help-gnu-emacs@gnu.org>
2006-03-05 18:48 ` Johan Bockgård

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).