From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: When are the face text properties actually set? Date: Wed, 13 Jun 2012 18:39:58 +0300 Message-ID: <834nqfz0dt.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1339602006 23042 80.91.229.3 (13 Jun 2012 15:40:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 13 Jun 2012 15:40:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 13 17:40:05 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sepfo-0003jB-PP for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jun 2012 17:39:56 +0200 Original-Received: from localhost ([::1]:52730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sepfo-00068F-MU for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jun 2012 11:39:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sepfi-00067w-RN for help-gnu-emacs@gnu.org; Wed, 13 Jun 2012 11:39:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sepfe-0006xL-39 for help-gnu-emacs@gnu.org; Wed, 13 Jun 2012 11:39:50 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:53023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sepfd-0006wr-RP for help-gnu-emacs@gnu.org; Wed, 13 Jun 2012 11:39:46 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M5K00L00BGD4500@a-mtaout22.012.net.il> for help-gnu-emacs@gnu.org; Wed, 13 Jun 2012 18:39:44 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M5K00L2DBI70530@a-mtaout22.012.net.il> for help-gnu-emacs@gnu.org; Wed, 13 Jun 2012 18:39:44 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.172 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85230 Archived-At: > From: jack-mac > 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?