all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to prevent font-lock (& jit-lock etc.) from refontifying?
@ 2004-10-12 19:51 Drew Adams
  2004-10-12 20:27 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Drew Adams @ 2004-10-12 19:51 UTC (permalink / raw)


In Emacs 21, suppose that I apply a face to certain spans of text. Maybe the
buffer is already font-locked before doing this, maybe not. In either case,
I want these spans of text to show the face I apply, overriding any
font-lock highlighting that might be there.

However, font-lock (jit-lock, I believe) works behind the scene to refontify
things the way it thinks they should look. That is, it effectively _removes_
any highlighting I go to the trouble to add.

In Emacs 20, I only had to worry about lazy-lock doing this, and function
lazy-lock-after-fontify-buffer was available to convince lazy-lock not to
undo things behind my back. I could just call that function after
highlighting, to fool lazy-lock into thinking there was no need to
rehighlight. This function, lock-after-fontify-buffer, is still available in
Emacs 21.

However, in Emacs 21, I do not see an equivalent way (or any other way) to
prevent _jit-lock_ from undoing my highlighting changes.

Example:

(put-text-property start end 'face some-face), where start and end specify
the text span to be highlighted, and some-face is just what it says.

I can set the buffer read-only and modified-p states back to what they were
before my highlighting action, but jit-lock still refontifies behind the
scene, overriding the some-face highlighting I added.

I've checked the source code (font-lock.el, jit-lock.el) and the Elisp
manual, but I don't see how to deal with this.

Please don't reply that I should just use font-lock-keywords and let
font-lock do the highlighting. Assume that there is a reason I want to add
some-face as the 'face property using put-text-property. Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <mailman.3061.1097688611.2017.help-gnu-emacs@gnu.org>]
[parent not found: <mailman.2867.1097623015.2017.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2004-10-13 22:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-12 19:51 How to prevent font-lock (& jit-lock etc.) from refontifying? Drew Adams
2004-10-12 20:27 ` Drew Adams
2004-10-13 10:06 ` Sacha Chua
     [not found] ` <mailman.2950.1097663332.2017.help-gnu-emacs@gnu.org>
2004-10-13 15:23   ` Kevin Rodgers
2004-10-13 17:22     ` Drew Adams
     [not found] <mailman.3061.1097688611.2017.help-gnu-emacs@gnu.org>
2004-10-13 18:32 ` Oliver Scholz
     [not found] <mailman.2867.1097623015.2017.help-gnu-emacs@gnu.org>
2004-10-13 21:20 ` Stefan Monnier
2004-10-13 22:07   ` Drew Adams
2004-10-13 22:55     ` Stefan Monnier

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.