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: address@hidden
Subject: Re: Font-lock seemingly interacting with insertion
Date: Tue, 15 May 2018 01:04:20 -0700 (PDT)
User-agent: G2/1.0

Hi!

You could add your own custom property to `char-property-alias-alist'. This 
will work regardless if font-lock is active or not. This is how font-lock 
implements `font-lock-face', so you might find that it has the same drawbacks 
as `font-lock-face'.

One drawback that I can see is that some packages that convert buffers with 
syntax highlighting to other formats might not take this into account.

    -- Anders

On Sunday, 25 March 2018 19:00:59 UTC+2, Marcin Borkowski  wrote:
> On 2018-03-22, at 01:39, Drew Adams <drew.adams@oracle.com> wrote:
> 
> >> > 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'.
> 
> font-lock-face won't work, but for different reasons.  As I mentioned in
> my previous message, I'll report back (in fact, I'll blog about it some
> day) when the issue is solved.  Most probably, I will have to use
> overlays.
> 
> > 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).
> 
> That is interesting - I even have that library because of
> `hlt-highlight-region' - but in this case I don't want any
> dependencies.  But thanks anyway!
> 
> > 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'.
> 
> Interesting, but again - external library.



reply via email to

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