unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Gregory Heytings <gregory@heytings.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	"Paul W. Rankin" <pwr@bydasein.com>,
	emacs-devel@gnu.org
Subject: Re: master 2399541: Remove font-lock toggle from font-lock-update
Date: Thu, 25 Mar 2021 09:52:54 -0400	[thread overview]
Message-ID: <jwvr1k3e4iq.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8786a8e8fa96815c66e3@heytings.org> (Gregory Heytings's message of "Wed, 24 Mar 2021 22:27:13 +0000")

> Hmmm...  You said: "`font-lock-fontify-region` is an important function
> internally (it's the one and only function which performs font-locking,
> fundamentally)".  Is it wrong to use it nonetheless?

That's the wrong question, since my beef is about the definition of what
the function should do, as opposed to how it's implemented.
[ Tho maybe I'd prefer if it used `font-lock-flush` or
  `font-lock-ensure`.  ]

>> I'd much prefer a longer `font-lock-fontify-diwm` which tries to reproduce
>> more or less the same behavior as your favorite, but by explicitly testing
>> the different circumstances you care about.
> Could you perhaps give an example of such a circumstance and its
> corresponding action?

The main "circumstances" that matter are whether the font-lock machinery
is activated and whether font-lock-mode is nil or not.  The rest is more
"obvious" (like whether it should pay attention to an active region, or
only refresh the visible portion of the buffer, ...).

Currently, I've heard mention of two use cases for font-lock-fontify-block:

  ;; - Correct misfontification when fontification is highly context-dependent
  ;;   and has a bug (typically associated with multiline constructs).
  ;;   `font-lock-flush` should work as well in that case.
  ;; - Removing fontification, e.g. when yanking font-locked strings into
  ;;   a text-mode buffer.  Not sure if the intention would be to generalize
  ;;   this to all buffers with a nil `font-lock-keywords` or also to buffers
  ;;   where font-lock-mode is disabled.

Maybe the docstring should describe just those behaviors, and the
implementation could then implement them explicitly, rather than have
that grow accidentally as a result of the implementation.


        Stefan




  reply	other threads:[~2021-03-25 13:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210324143048.23515.75257@vcs0.savannah.gnu.org>
     [not found] ` <20210324143050.40C6E20D10@vcs0.savannah.gnu.org>
2021-03-24 15:23   ` master 2399541: Remove font-lock toggle from font-lock-update Stefan Monnier
2021-03-24 15:28     ` Lars Ingebrigtsen
2021-03-24 15:47       ` Stefan Monnier
2021-03-24 15:29     ` Paul W. Rankin via Emacs development discussions.
2021-03-24 15:32     ` Gregory Heytings
2021-03-24 15:43       ` Lars Ingebrigtsen
2021-03-24 16:03         ` Lars Ingebrigtsen
2021-03-24 17:43           ` Paul W. Rankin via Emacs development discussions.
2021-03-24 17:49             ` Lars Ingebrigtsen
2021-03-24 22:07               ` Stefan Monnier
2021-03-24 22:27                 ` Gregory Heytings
2021-03-25 13:52                   ` Stefan Monnier [this message]
2021-03-25 20:58                     ` Gregory Heytings
2021-03-25 22:39                       ` Stefan Monnier
2021-03-29  9:44                         ` Gregory Heytings
2021-03-29 13:00                           ` Stefan Monnier
2021-03-29 14:40                             ` Gregory Heytings
2021-03-29 15:50                               ` Stefan Monnier
2021-03-25  9:09                 ` Lars Ingebrigtsen
2021-03-25 10:14                   ` Gregory Heytings
2021-03-25 11:00                     ` Alan Mackenzie
2021-03-25  2:07               ` Paul W. Rankin via Emacs development discussions.

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=jwvr1k3e4iq.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.org \
    --cc=pwr@bydasein.com \
    /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).