* Individual character coloring
@ 2012-05-30 11:03 Fab
2012-05-30 15:05 ` Thamer Mahmoud
2012-05-30 15:07 ` jpkotta
0 siblings, 2 replies; 4+ messages in thread
From: Fab @ 2012-05-30 11:03 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Individual character coloring
2012-05-30 11:03 Individual character coloring Fab
@ 2012-05-30 15:05 ` Thamer Mahmoud
2012-05-30 15:07 ` jpkotta
1 sibling, 0 replies; 4+ messages in thread
From: Thamer Mahmoud @ 2012-05-30 15:05 UTC (permalink / raw)
To: help-gnu-emacs
Fab <fab4100@gmail.com> writes:
> 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?
>
This should do it:
(font-lock-add-keywords 'c++-mode '(("\\(;\\)" 1 font-lock-warning-face)))
--
Thamer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Individual character coloring
2012-05-30 11:03 Individual character coloring Fab
2012-05-30 15:05 ` Thamer Mahmoud
@ 2012-05-30 15:07 ` jpkotta
2012-05-30 16:43 ` Fab
1 sibling, 1 reply; 4+ messages in thread
From: jpkotta @ 2012-05-30 15:07 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Individual character coloring
2012-05-30 15:07 ` jpkotta
@ 2012-05-30 16:43 ` Fab
0 siblings, 0 replies; 4+ messages in thread
From: Fab @ 2012-05-30 16:43 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-30 16:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-30 11:03 Individual character coloring Fab
2012-05-30 15:05 ` Thamer Mahmoud
2012-05-30 15:07 ` jpkotta
2012-05-30 16:43 ` Fab
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.