[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
font-lock-number-face
From: |
Ritchie |
Subject: |
font-lock-number-face |
Date: |
Wed, 08 Dec 2010 15:34:34 -0000 |
User-agent: |
G2/1.0 |
I'm trying to add a new face in my config file so that all the numbers
will have different color. Here is what I have:
(make-face 'font-lock-number-face)
(set-face-foreground 'font-lock-number-face "DodgerBlue4")
(setq font-lock-number-face 'font-lock-number-face)
(defvar font-lock-number "[0-9]+\\([eE][+-]?[0-9]*\\)?")
(defvar font-lock-hexnumber "0[xX][0-9a-fA-F]+")
(add-hook 'font-lock-mode-hook
#'(lambda ()
(setq font-lock-keywords
(append font-lock-keywords
(list
(list (concat "\\<\\(" font-lock-number "\
\)\\>" )
(list 0 font-lock-number-face))
(list (concat "\\<\\(" font-lock-
hexnumber "\\)\\>" )
(list 0 font-lock-number-face))
)))))
This works fine for most modes, except multi-term. When I startup
multi-term, the terminal text color will be all black and white. I can
turn terminal's color back to normal by turning off font-lock-mode
manually, but I couldn't find a way to turn it off automatically.
I tried this:
(add-hook 'term-mode-hook
#'(lambda ()
(font-lock-mode nil)))
it didn't work. I think I could try to add something in font-lock-mode-
hook to check if it is term-mode, but I don't know how to get current
mode name.
Anybody has any suggestions?
Thank you in advance
Ritchie
- font-lock-number-face,
Ritchie <=