emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: how to prevent font-lock from messing with a portion of text?


From: Drew Adams
Subject: RE: how to prevent font-lock from messing with a portion of text?
Date: Thu, 22 Mar 2007 12:20:05 -0700

> > How can one prevent font-lock from changing the text properties
> > of a given portion of text? I tried (put-text-property start end
> > 'fontified t), but C-x C-s just re-font-lock fontifies the text
> > in question.  I also tried binding `inhibit-modification-hooks'
> > to t, with the same result.
>
> There are many different ways, each one with advantages and quirks,
> I can't recommend any without knowing more of what you're trying to do,

Use put-text-property to add a face to some text using the `face' property.
Prevent subsequent "erasure" of that highlighting by font-lock.

I would like to be able to, say, set a particular text property on the same
text, which would cause font-lock to ignore that text (skip over it, as if
it weren't there).

I thought that's what property `fontified' (= t) would do, but that seems
not to be the case. The Elisp manual says this about `fontified':

     This property says whether the character has a face assigned to it
     by font locking.  The display engine tests it to decide whether a
     buffer portion needs refontifying before display.  *Note Auto
     Faces::.  It takes one of three values:

    `nil'
          Font locking is disabled, or the character's `face' property,
          if any, is invalid.

    `defer'
          This value is only used when "just in time" font locking is
          enabled and it means that the character's `face' property is
          invalid and needs deferred fontification.

    `t'
          The character's `face' property, or absence of one, is valid.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]