unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Syntax highlighting of operators in C and C++ mode
@ 2007-04-17 14:23 Nordlöw
  2007-04-17 17:20 ` amit.patel
  0 siblings, 1 reply; 2+ messages in thread
From: Nordlöw @ 2007-04-17 14:23 UTC (permalink / raw)
  To: help-gnu-emacs

Hey there, Emacs users!

I am trying to get highlighting of operators to work on Emacs-CVS.
Instead the following code ruins most of default font-locking in c-
mode.

(defface font-lock-operator-face
  '((((class color))
     (:inherit font-lock-builtin-face :bold t)))
  "Font Lock mode face used to highlight operators..")

;; Adds fontification for operator += for C mode and modes derived
from C mode
(defun pnw-c-mode-extra-font-locking ()
  (font-lock-add-keywords
   nil
   (list
     (cons (concat "\\(" (regexp-opt (list "+=")) "\\)")
 	  '(1 font-lock-operator-face prepend))
    )))

(add-hook 'c-mode-hook 'pnw-c-mode-extra-font-locking)


What have done wrong?

Many thanks in advance,
Per Nordlöw

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

* Re: Syntax highlighting of operators in C and C++ mode
  2007-04-17 14:23 Syntax highlighting of operators in C and C++ mode Nordlöw
@ 2007-04-17 17:20 ` amit.patel
  0 siblings, 0 replies; 2+ messages in thread
From: amit.patel @ 2007-04-17 17:20 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 17, 7:23 am, Nordlöw <per.nord...@gmail.com> wrote:
> What have done wrong?

Check your *Messages* buffer. If you see a "no such face" error, try
changing font-lock-operator-face to 'font-lock-operator-face (i.e.,
add the quote character). Alternatively, (defvar font-lock-operator-
face 'font-lock-operator-face).

- Amit

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

end of thread, other threads:[~2007-04-17 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-17 14:23 Syntax highlighting of operators in C and C++ mode Nordlöw
2007-04-17 17:20 ` amit.patel

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).