[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Best way to detect font-lock mode is on?
From: |
Stefan Monnier |
Subject: |
Re: Best way to detect font-lock mode is on? |
Date: |
Mon, 10 Jan 2011 12:40:59 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>> > Yes, that is how I plan to do it if font-lock is not enabled. I'm
>> > currently experimenting with syntax-ppss and parse-partial-sexp to see
>> > if the cached version can be used reliably or if the uncaching variant
>> > is required and if this has too high a penalty. I have found that with
>> > syntax-ppss, I do get false positives fairly frequently if I don't first
>> > call syntax-pps-flush-cache, which would seem to defeat its benefits
>> > over parse-partial-sexp.
>> font-lock uses syntax-ppss, so if syntax-ppss is wrong, font-lock should
>> be wrong as well.
> syntax-ppss -> Parse-Partial-Sexp State
> Isn't syntax-ppss Lisp-specific?
Yes/no: it includes a rudimentary parser which can't be claimed to
handle anything more than Lisp (even its handling of Lisp is limited),
but it does handle strings and comment of (almost) all languages.
> What about text highlighted by font-lock-add-keywords?
Unrelated: we're talking about strings and comments which are normally
not highlighted (by font-lock) via font-lock-keywords but via
syntax-tables.
Stefan
Re: Best way to detect font-lock mode is on?, Ilya Zakharevich, 2011/01/11