help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: font-lock on variables


From: Drew Adams
Subject: RE: font-lock on variables
Date: Sun, 26 Jul 2009 07:51:15 -0700

> > Hi-lock is only one library that offers such highlighting. 
> > See the generic wiki page for this topic: 
> > http://www.emacswiki.org/emacs/HighlightTemporarily.
> > That page compares the various highlighting libraries,
> > including hi-lock, listing what each is good for.
> 
> As I just said in an earlier post, hi-lock is not yet working 
> for me.  I have managed, however, to highlight text with
> other packages in the page you mentioned
> (such as highlight.el).  So, if anything else works, at
> least I have now a solution.
> 
> However, it seems that using this procedure is not ideal.  
> highlight.el does not work in connection with font-lock-mode.
> It seems to me that it would be desirable that, when one
> turned font-lock-mode off, all the fontified text was
> unfontified.  However, using packets such as highlight.el
> entails using two modes to fontify, and therefore the
> fontification would not be unified.  

Decoupling such highlighting from font-lock is a feature (deliberate), not a bug
(missing feature). The problem you ran into with hi-lock is one of the main
reasons: coupling the two means mixing them up - you must take other
font-locking into account at the same time, and each mode defines its own
font-locking. See
http://www.emacswiki.org/emacs/HighLight#PreservingHighlighting.

You can "turn off" highlighting by highlight.el in several ways, depending on
what is meant. Command `hlt-unhighlight-region' turns off all such highlighting
in the buffer, but you can also turn it off selectively: for given faces, a
region, only overlays, or only text-properties.

If you really need to couple turning off highlighting and font-lock for some
reason, just write a function that does both: turn off `font-lock mode' and call
`hlt-unhighlight-region'. Or advise `font-lock-mode' so that it also turns off
highlighting when you turn it off.

Finally, highlight.el and hi-lock.el are complementary - you can use them
together.





reply via email to

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