help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Best way to detect font-lock mode is on?


From: Tim X
Subject: Re: Best way to detect font-lock mode is on?
Date: Fri, 14 Jan 2011 17:59:53 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

> On 2011-01-13, Tim X <timx@nospam.dev.null> wrote:
>>>> As you can see, I'm using font-lock-defaults to test whether font-lock
>>>> is enabled.
>>>
>>> No matter what is the test, your logic is not enough.  In cperl-mode,
>>> I pepper all such functions with
>>>    (cperl-update-fontification pos)
>>> (sp?) so that lazy-locking is not playing time-sensitive tricks with
>>> your logic.
>>>
>>
>> Thanks. Will have to give it some thought. The functions I showed above
>> are not used to control font-locking - in fact, I'm using them to
>> determine indentation information. The mode is derived from another mode
>> that takescare of the font locking side of things. If I assume that mode
>> has taken care of the font-lock issues, I expect the above would be
>> sufficient. 
>
> Irrelevant.
>
> AFAIU, you think that the logic of delegation
>
>   your mode --> some-other-mode --> text-property(font)-ification
>
> is somehow sufficient to free you from caring about time-related
> issues.  Wrong.  Given that WHATEVER-ication would usually (or often?)
> run in a time-delayed hook can't be ignored.
>

I understand that. However, the test is being applied to earlier points
in the file, not to the current text being inserted. Theoretically, I
guess there could be a very small chance of the text not having being
fontified, but in practice, this does not appear to be the case. Timing
could well be an issue if I wanted to use this information on the text
as it is being inserted, but I'm not testing the current text. If it
does turn out to be an issue, then I will just use syntax-ppss. 

Tim



-- 
tcross (at) rapttech dot com dot au


reply via email to

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