all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ex <exeQtor@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: symbols, operators highlighting (+, -, =, <, >, etc)
Date: Fri, 1 May 2009 23:43:32 -0700 (PDT)	[thread overview]
Message-ID: <be4b86b5-61a0-436a-b433-100a4793f8a2@n4g2000vba.googlegroups.com> (raw)

Hi there!

I'm pretty new to emacs and I was wondering how to add highlighting to
symbols and operators in my code
(I' ve been really used to that in other editors), but I couldn't find
anything in the web or emacs-wiki

I could figure out the next kludge in my emacs file:

;;------------------------------------------------------------------------------
;; Highlight operators
(font-lock-add-keywords 'python-mode
  '(("\\." . font-lock-warning-face)
    ("else:" . font-lock-keyword-face)
    ("\\+" . font-lock-warning-face)
    ("\\-" . font-lock-warning-face)
    ("\=" . font-lock-warning-face)
    (":" . font-lock-warning-face)
    ("\\[" . font-lock-warning-face)
    ("\\]" . font-lock-warning-face)
    ("," . font-lock-warning-face)
    ("!" . font-lock-warning-face)
    ("(" . font-lock-warning-face)
    (")" . font-lock-warning-face)
    ("\<" . font-lock-warning-face)
    ("\>" . font-lock-warning-face)))

the problem is that this only works for python, and I don't want to
copy/paste this to other modes, there must be a more elegant
solution...
the other problem is that I'm abusing the warning face (because I
don't know how to create a face)

Any help or advice?

Many thanks.
Laurens


             reply	other threads:[~2009-05-02  6:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-02  6:43 ex [this message]
2009-05-02 10:58 ` symbols, operators highlighting (+, -, =, <, >, etc) Anselm Helbig

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=be4b86b5-61a0-436a-b433-100a4793f8a2@n4g2000vba.googlegroups.com \
    --to=exeqtor@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.