[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replace regex strings with variables for font-lock
From: |
Lute Kamstra |
Subject: |
Re: Replace regex strings with variables for font-lock |
Date: |
Thu, 28 Apr 2005 18:31:02 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Ryan Bowman <ryanlbowman@yahoo.com> writes:
[...]
> (setq my-mode-font-lock-keywords
> (list
> '("^#.*$" 0 'bold)
> '("\\(foo\\)\\(bar\\)" ; the word foobar in two faces
> (1 'font-lock-warning-face)
> (2 'font-lock-type-face))))
>
> That second part, being able to font-lock with
> multiple faces is awesome.
> Anyway, I want to replace the regex strings with
> customizable variables, so I used defcustom to define
> a variable and then in place of '("&#.*S" 0 'bold) I
> tried '(my-var 0 'bold) but it didn't work, meaning to
> the face wasn't applied. I tried defining the
> variable with defcustom and defvar but neither had the
> effect I wanted. Is there a way to use defcustom to
> define a variable that contains a regex that will be
> recognized by font-lock?
(setq my-mode-font-lock-keywords
`((,my-var 0 'bold)
("\\(foo\\)\\(bar\\)"
(1 'font-lock-warning-face)
(2 'font-lock-type-face))))
Lute.
--
(spook) => "UOP Agfa computer terrorism"
(insert-file-contents "~/.signature") => (error "`~/.signature' too rude")