From: Ritchie <ritchiecai@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: font-lock-number-face
Date: Thu, 4 Nov 2010 11:19:23 -0700 (PDT) [thread overview]
Message-ID: <f39d4f23-5df1-49da-87de-a36d34115351@x7g2000prj.googlegroups.com> (raw)
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
next reply other threads:[~2010-11-04 18:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-04 18:19 Ritchie [this message]
2010-11-05 10:31 ` font-lock-number-face Sébastien Vauban
[not found] ` <6571e80e-43d2-4f68-9f78-be1d02d1dcab@o11g2000prf.googlegroups.com>
2010-12-17 4:56 ` font-lock-number-face Ritchie
2010-12-17 9:14 ` font-lock-number-face Elena
2010-12-17 22:24 ` font-lock-number-face Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f39d4f23-5df1-49da-87de-a36d34115351@x7g2000prj.googlegroups.com \
--to=ritchiecai@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).