[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Individual character coloring
From: |
Fab |
Subject: |
Re: Individual character coloring |
Date: |
Wed, 30 May 2012 18:43:37 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
jpkotta <jpkotta@gmail.com> writes:
> 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.
cool! appreciated
Fab