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

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

symbols, operators highlighting (+, -, =, <, >, etc)


From: ex
Subject: symbols, operators highlighting (+, -, =, <, >, etc)
Date: Fri, 1 May 2009 23:43:32 -0700 (PDT)
User-agent: G2/1.0

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 via email to

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