[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: When are the face text properties actually set?
From: |
Stefan Monnier |
Subject: |
Re: When are the face text properties actually set? |
Date: |
Wed, 13 Jun 2012 11:18:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) |
> Is this normal or is it a bug?
It's normal: this is handled by jit-lock which adds the property on the
fly before a chunk of text is displayed.
> If it's normal, is there any way to force the text properties to be
> set the way they will be set when the point is displayed?
Yes, you can use something like jit-lock-fontify-now.
> I mean: I just want (get-text-property 2400 'face) to return the text
> property whether it has already been displayed or not!
> I tried the following which works more or less:
> M-: (progn (goto-char 2400) (sit-for 0) (get-text-property
> 2400 'face))
> => font-lock-comment-face
Rather than check the `face' property for `font-lock-comment-face' you
should check the output of (syntax-ppss), which also has the advantage
of not depending on highlighting (so you don't need to fiddle with
jit-lock or worry about those users who disable font-lock).
Stefan