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

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

Re: C++ syntax coloring.


From: Marius Ologesa
Subject: Re: C++ syntax coloring.
Date: Wed, 19 Dec 2001 15:00:40 +0200

On Wed, 19 Dec 2001 04:03:18 -0800 (PST)
Subhakar K S <address@hidden> wrote the immortal words:

> I am new user of xemacs.
> 
> Is it possible with emacs/xemacs to highlight the
> C++ syntax with different colours.
> 
> ( like many of the the windows editors do. eg: vc++
> editor).
> 
> What I mean is I want to highlight C++ keywords 
> like  class, public, private, protected, friend,
> virtual, if, else, etc with a specific color.
> 
> I want C++ comments // in a different color.
> 
> Please let me know, if this is possible with emacs
> and any add-on packages required to do this.
> 
Well, it seems that you don't have/set the c++ mode.
Try 
M-x c++-mode
M-x font-lock-fontify-buffer

If it loads it than is ok, you have a problem with setting the right mode,
and you need something like
(setq auto-mode-alist
      (cons '("\\.\\([ch]\\|cc\\|cpp\\)$" . c++-mode)
                  auto-mode-alist)
      )

Second, if you are using xemacs (as I do now) than class, friend, virtual
are considered types not keywords; I had to modify font-lock.el by hand
and make them keywords. Could be another way, but i don't know it.
goodf luck
-- 
                      The Marius



reply via email to

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