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: Mon, 26 Mar 2007 08:56:59 -0700

> > OK, here's another option: don't change anything to font-lock,
> > don't fiddle with it at all, just don't use text-properties to
> > add your special faces. Use overlays instead.
>
> Typical "highlighter" applications seem a bit more suited to overlays
> anyway (e.g., if I copy the text, I don't really expect the highlighting
> to come along...).

You know, you need not read my posts, but if you don't read them, then you
need not reply to them either.

I explicitly stated that my own highlighting library lets you use either
overlays or text properties, and that using overlays is the default
behavior.

Text properties and overlays act differently, and there can be advantages to
each in different contexts. One is not a replacement for the other, whether
for "typical" highlighting or anything else.

> I suppose if there's some reason to use text-properties, "hi-lock.el"
> (in the distribution) could be used as an example of one way to do that.
> [It actually _uses_ font-lock to do the highlighting which seems fairly
> clever -- e.g., if you type more text after having highlighted a phrase,
> the phrase gets automagically highlighted in the new text too!]

I'm well aware of hi-lock, and I use it. There are advantages and
disadvantage to tying user highlighting to the font-lock mechanism. With it,
you cannot view the highlighting without font-lock-mode being on. Here is
one comparison of some different highlighting approaches:
http://www.emacswiki.org/cgi-bin/wiki/HighlightTemporarily.

Nothing wrong with hi-lock. Nothing wrong with facemenu. Different
approaches have different advantages. Why not let highlighting approaches,
such as facemenu, that use the `face' text property independently of whether
font-lock highlighting is on, be able to prevent font lock from erasing
their highlighting?





reply via email to

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