emacs-devel
[Top][All Lists]
Advanced

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

RE: [External] : Re: master 5c70ff9: New user option 'font-lock-ignore'


From: Drew Adams
Subject: RE: [External] : Re: master 5c70ff9: New user option 'font-lock-ignore'
Date: Sat, 2 Apr 2022 18:45:30 +0000

> > FWIW, I proposed a related feature back in 2007,
> > and again in 2014 (both here and with a patch in
> > bug #18367 - see links below).
> >
> > It lets you use text-property `font-lock-ignore'
> > (same name - surprise! ;-)) to make font-lock
> > ignore text with that property - "Hands off!".
> 
> From what I can tell this is only vaguely related.  The
> 'font-lock-ignore' user option is really meant for the
> end-user, and it allows to remove some fontification
> rules that might hurt his or her sensibilities.

If you say so.  You also said:

  the user has to interact to some degree with the
  font-lock internals to make any meaningful use of it.

Your "end user" needs to know which font-lock rules
are causing the bother, in order to inactivate them.

To make use of what I proposed, a user doesn't need
to interact with any font-lock internals.  So yeah,
the two features are not related in that sense.

They're related in that each lets you tell font-lock
not to manage particular bits of text.  (IIUC)

Your feature (IIUC) lets you do that by inhibiting
particular font-lock rules.  So you need to identify
which rules are bothering you and know how to turn
only those off (and you have to do that with a user
option, for individual modes or sets of modes).

My feature lets you do it anywhere, anytime, in any
mode/context, by specifying the bits of text any way
you want.  And it applies to any and all font-lock
rules whatsoever.  It doesn't care, and you needn't
know, how or why font-lock is bothering that text.
It directly prevents font-lock from doing that.

As I see it, both features can be useful.

Your feature wouldn't help for the uses I make of
my feature.  Libraries that use my feature can, and
do, remain 100% ignorant of what font-lock tries to
do to the text in question - how or why it messes
with it.  They just stop it from doing so by making
that text off limits to font-lock.

My feature is particularly useful for ad hoc
highlighting that you want to be independent of
font-lock: not overridden by font-lock highlighting,
and not affected by turning font-lock off/on.
___

As a demonstration of direct "end-user" use, I just
added a simple command to toggle font-lock for text
you select with the mouse.  E.g., bind it to, say,
`M-down-mouse-2' or `C-x down-mouse-1', then select
some text to toggle font-lock on/off only there.

It doesn't matter how you apply text property
`font-lock-ignore', whether by code or interactively
in some way.  It's simple to define commands that
handle particular text (e.g. prompt for a regexp to
match, or apply to the active region).

https://www.emacswiki.org/emacs/download/font-lock%2b.el



reply via email to

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