Ryan Bowman <[EMAIL PROTECTED]> 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")
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to