all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Subject: Suboptimal documentation of and handling of the 'fontified text property.
Date: Thu, 16 Mar 2006 12:34:08 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.3.96.1060316113003.351A-100000@acm.acm> (raw)

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  <acm@muc.de>

	* 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)

             reply	other threads:[~2006-03-16 12:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-16 12:34 Alan Mackenzie [this message]
2006-03-17  6:33 ` Suboptimal documentation of and handling of the 'fontified text property Richard Stallman
2006-03-20  6:45 ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=Pine.LNX.3.96.1060316113003.351A-100000@acm.acm \
    --to=acm@muc.de \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.