all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: jpkotta <jpkotta@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Individual character coloring
Date: Wed, 30 May 2012 08:07:57 -0700 (PDT)	[thread overview]
Message-ID: <10c50e7c-79fd-495b-aeaf-560f3078df42@googlegroups.com> (raw)
In-Reply-To: <87sjei3p8n.fsf@gmail.com>

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.


  parent reply	other threads:[~2012-05-30 15:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30 11:03 Individual character coloring Fab
2012-05-30 15:05 ` Thamer Mahmoud
2012-05-30 15:07 ` jpkotta [this message]
2012-05-30 16:43   ` Fab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10c50e7c-79fd-495b-aeaf-560f3078df42@googlegroups.com \
    --to=jpkotta@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.