[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Case insensitive font-lock

From: Kevin Rodgers
Subject: Re: Case insensitive font-lock
Date: Mon, 22 Aug 2005 13:09:24 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Bert Geens wrote:
> Thanks a lot, i had looked at font-lock-defaults but apparently not hard
> enough...
> So I tried this:
> (set (make-local-variable 'font-lock-defaults) '(fvwm-font-lock-keywords
> nil fvwm-keywords-ignore-case))
> But that apparently didn't  work, I wonder why?

Because the CASE-FOLD entry is not like the KEYWORDS entry.  To cite the
doc string again:

        KEYWORDS may be a symbol (a variable or function whose value is
        the keywords to use for fontification) or a list of symbols.

But no similar statement is made about CASE-FOLD, so you want the actual
value of fvwm-keywords-ignore-case:

(set (make-local-variable 'font-lock-defaults)
     (list 'fvwm-font-lock-keywords nil fvwm-keywords-ignore-case))


(set (make-local-variable 'font-lock-defaults)
     `(fvwm-font-lock-keywords nil ,fvwm-keywords-ignore-case))

That being said, using any non-nil object for CASE-FOLD (such as the
fvwm-keywords-ignore-case symbol) should result in case-insensitive

> I now use this, which does work though, but the above solution would be
> cleaner imho...
>   (if fvwm-keywords-ignore-case
> (set (make-local-variable 'font-lock-defaults) '(fvwm-font-lock-keywords))
>     (set (make-local-variable 'font-lock-defaults)
>     '(fvwm-font-lock-keywords nil t)))

That looks backwards.  If fvwm-keywords-ignore-case is set, I'd expect
you to specify CASE-FOLD as non-nil.  But you are specifying CASE-FOLD
as t when fvwm-keywords-ignore-case is nil.

Kevin Rodgers

reply via email to

[Prev in Thread] Current Thread [Next in Thread]