unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Augusto Stoffel <arstoffel@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: master 5c70ff9: New user option 'font-lock-ignore'
Date: Sat, 2 Apr 2022 18:45:30 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488DE477C857DF2C237B171F3E39@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87y20nmoyw.fsf@gmail.com>

> > 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	other threads:[~2022-04-02 18:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-02  6:36 master 5c70ff9: New user option 'font-lock-ignore' Eli Zaretskii
2022-04-02  7:34 ` Augusto Stoffel
2022-04-02 10:01   ` Eli Zaretskii
2022-04-02 11:18     ` Augusto Stoffel
2022-04-02 11:58       ` Eli Zaretskii
2022-04-02 12:08         ` Augusto Stoffel
2022-04-02 13:52           ` Eli Zaretskii
2022-04-02 16:25             ` Augusto Stoffel
2022-04-02 16:44               ` Eli Zaretskii
2022-04-02 16:52                 ` Augusto Stoffel
2022-04-02 14:06 ` Stefan Monnier
2022-04-02 15:28 ` [External] : " Drew Adams
2022-04-02 16:25   ` Augusto Stoffel
2022-04-02 18:45     ` Drew Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488DE477C857DF2C237B171F3E39@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=arstoffel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).