[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: font-lock-number-face
From: |
Elena |
Subject: |
Re: font-lock-number-face |
Date: |
Fri, 17 Dec 2010 01:14:18 -0800 (PST) |
User-agent: |
G2/1.0 |
On Nov 5, 10:31 am, Sébastien Vauban <wxhgmqzgw...@spammotel.com>
wrote:
> Hi Ritchie,
>
>
>
> Ritchie wrote:
> > 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.
>
> This looks really nice. But, when enabling it, my Gnus buffer become black and
> white only. Not true: I see your blue face for the numbers, but every other
> color customization is gone.
>
> Some sort of conflict between the color-theme and this? Priority? Not
> cumulative?
>
> Best regards,
> Seb
>
> --
> Sébastien Vauban
You have to play with the HOW parameter of `font-lock-add-keywords'.
I have some highlighting which worked after setting HOW to t.