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

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

Re: Individual character coloring


From: jpkotta
Subject: Re: Individual character coloring
Date: Wed, 30 May 2012 08:07:57 -0700 (PDT)
User-agent: G2/1.0

On Wednesday, May 30, 2012 6:03:20 AM UTC-5, Fab wrote:
> Dear All,
> 
> I would like to highlight the semicolon with a different color in
> c++-mode and also matlab-mode.  I could not identify a special face of
> the semicolon with C-u C-x =, is there something like
> font-lock-comment-delimiter-face for a line terminator?  If not is there
> an easy way to accomplish my need?
> 
> Thanks
> Fab

I do something similar to this for most programming modes:

,----
| (defvar operators-regexp 
|   (regexp-opt '("+" "-" "*" "/" "%" "!"
|                 "&" "^" "~" "|"
|                 "=" "<" ">"
|                 "." "," ";" ":" "?"))
|   "Regexp matching symbols that are operators in most programming
|   languages.")
| 
| (setq operators-font-lock-spec
|       (cons operators-regexp
|             (list 
|              0 ;; use whole match
|              'font-lock-builtin-face
|              'keep ;; OVERRIDE
|              )))
| 
| (font-lock-add-keywords
|  'c++-mode
|  (list 
|   operators-font-lock-spec))
`----

Clearly you can use whatever face you want instead of font-lock-builtin-face.


reply via email to

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