From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Suboptimal documentation of and handling of the 'fontified text property. Date: Thu, 16 Mar 2006 12:34:08 +0000 (GMT) Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1142512912 7633 80.91.229.2 (16 Mar 2006 12:41:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Mar 2006 12:41:52 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 16 13:41:49 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FJrnW-0003BU-9l for ged-emacs-devel@m.gmane.org; Thu, 16 Mar 2006 13:41:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FJrnV-0001Wl-JD for ged-emacs-devel@m.gmane.org; Thu, 16 Mar 2006 07:41:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FJrnI-0001Tt-6g for emacs-devel@gnu.org; Thu, 16 Mar 2006 07:41:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FJrnF-0001QC-6T for emacs-devel@gnu.org; Thu, 16 Mar 2006 07:41:31 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FJrnE-0001Pt-Tj for emacs-devel@gnu.org; Thu, 16 Mar 2006 07:41:28 -0500 Original-Received: from [193.149.49.134] (helo=acm.acm) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FJrrr-00027a-WD for emacs-devel@gnu.org; Thu, 16 Mar 2006 07:46:17 -0500 Original-Received: from localhost (root@localhost) by acm.acm (8.8.8/8.8.8) with SMTP id MAA00511 for ; Thu, 16 Mar 2006 12:34:09 GMT X-Sender: root@acm.acm Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51702 Archived-At: The text property 'fontified is supposed to indicate that the text it is attached to has valid font-lock faces. It is defined (in elisp's text.texi, in a maddeningly imprecise fashion) to have the values nil and non-nil. It Would Be Nice for random.el to be able to test this property to see whether the font-locking is up to date. However: (i) jit-lock-mode additionally uses the special value 'defer. (ii) When no support mode is active, 'fontified doesn't get set. (iii) When font-lock-mode is disabled, the 'fontified text property doesn't get cleared. (iv) The file replace.el tests explicitly for the value t. These things are inconsistent. To amend this, it seems that 'fontified should be restricted (in text.texi) to the three values nil, t, and 'defer. Additionally, the following alternatives suggest themselves: (i) State that 'fontified is only meaningful when jit-lock is enabled. (ii) State that 'fontified is only meaningful when (some sort) of font-lock is enabled, fixing font-\(lock\|core\).el to set and clear the text property. (iii) State that 'fontified is meaningful at all times, and set and clear it when no support-mode is enabled, and clear it totally when font-lock is disabled. [Incidentally, ...../progmodes/cperl-mode.el uses the text-property 'lazy-lock to inhibit fontification. This surely needs fixing.] I think alternative (iii) is the best one. Here is a proposed patch for text.texi which documents this: 2006-03-16 Alan Mackenzie * text.texi (Special Properties): Clarify the definition of 'fontified. Index: text.texi =================================================================== RCS file: /cvsroot/emacs/emacs/lispref/text.texi,v retrieving revision 1.113 diff -c -r1.113 text.texi *** text.texi 6 Feb 2006 11:55:10 -0000 1.113 --- text.texi 16 Mar 2006 12:15:21 -0000 *************** *** 2994,3002 **** @item fontified @kindex fontified @r{(text property)} ! This property, if non-@code{nil}, says that text in the buffer has ! had faces assigned automatically by a feature such as Font-Lock mode. ! @xref{Auto Faces}. @item display @kindex display @r{(text property)} --- 2994,3017 ---- @item fontified @kindex fontified @r{(text property)} ! This property says whether the text has had faces assigned to it by ! Font Lock mode. @xref{Auto Faces}. It takes one of these three ! values---other values are invalid: ! ! @table @asis ! @item @code{nil} ! Font locking is disabled, or the @code{face} properties on the text, ! if any, are invalid. ! ! @item The symbol @code{defer} ! This value states that the text's @code{face} properties are invalid ! and marks it for deferred fontification. It is used only when ``just ! in time'' font locking is enabled. ! ! @item @code{t} ! The @code{face} properties, or lack of them, on the text are currently ! valid. ! @end table @item display @kindex display @r{(text property)} -- Alan Mackenzie (Munich, Germany)