unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: When are the face text properties actually set?
Date: Wed, 13 Jun 2012 18:39:58 +0300	[thread overview]
Message-ID: <834nqfz0dt.fsf@gnu.org> (raw)
In-Reply-To: <d2887a54-bb65-4a0f-9e4c-205ab31b4f93@k5g2000vbf.googlegroups.com>

> From: jack-mac <duthen.mac@gmail.com>
> Date: Wed, 13 Jun 2012 07:32:31 -0700 (PDT)
> 
> I start "emacs -Q", open any emacs-lisp file which containing more
> than
> one page of text.  I choose a point (e.g. 2400) which is beyond the
> first page and type the following:
> 
> 	M-: (get-text-property 2400 'face) RET
>         => nil
> 
>         M-: (progn (goto-char 2400) (get-text-property 2400 'face))
>         => nil
> 
> Now, point 2400 is visible.
> 
> 	M-: (get-text-property 2400 'face) RET
>         => font-lock-comment-face
> 
> The function get-text-property returns nil only when the point given
> as argument has not yet been displayed.
> 
> So, I can reproduce it each time I close and reopen the file. (C-x C-v
> RET)
> 
> Is this normal or is it a bug?

Normal.

> 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, but it's slow: you need to get the whole buffer fontified by
font-lock.  Normally, Emacs only fontifies the portion of text that is
about to be displayed.

> 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

Yes, because sit-for causes Emacs to prepare the text for display.

Why do you need that?



      parent reply	other threads:[~2012-06-13 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 14:32 When are the face text properties actually set? jack-mac
2012-06-13 15:18 ` Stefan Monnier
2012-06-14  7:43   ` jack-mac
2012-06-14  8:40   ` jack-mac
2012-06-14 19:16     ` Stefan Monnier
2012-06-18  9:17       ` jack-mac
2012-06-13 15:39 ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834nqfz0dt.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).