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

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

RE: Font-lock seemingly interacting with insertion


From: Drew Adams
Subject: RE: Font-lock seemingly interacting with insertion
Date: Wed, 21 Mar 2018 17:39:12 -0700 (PDT)

> > That's a possibility, but it will only work in modes/buffers that turn
> > on font-lock.  AFAIU, that was not OP's intent.
> 
> I wasn't sure about the actual use case.
> 
> If it should work for both font-lock on and off, would it make sense to
> add both a face and a font-lock-face property to the string to be
> inserted?

I haven't followed this, so the use case is not clear to me.

But if the OP wants highlighting that will be present whether
font-locking is on or off then font-lock is not the answer (!),
including its use of `font-lock-face'.

That text property just gives font-lock more control, not less.
And `hi-lock.el' just uses font-lock to do its job, so it too
is no escape from control by font-lock-mode.

If you want highlighting that is independent of font-lock then
you might give library `highlight.el' a try.  It lets you
highlight using text properties or overlay properties, and the
highlighting can be independent of font-lock (or not - au choix).

If you want to be able to tell font-lock "hands off", i.e., to
ignore particular text, you can alternatively use text property
`font-lock-ignore'.  For that, see library `font-lock+.el'.

See:
https://www.emacswiki.org/emacs/HighlightLibrary

See also this Emacs Dev discussion:
http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00540.html

http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00583.html



reply via email to

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