all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: JD Smith <jdtsmith@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Yuan Fu <casouri@gmail.com>, 71384@debbugs.gnu.org
Subject: bug#71384: treesit-font-lock-fontify-region unnecessarily re-unfontify's
Date: Thu, 6 Jun 2024 07:35:03 -0400	[thread overview]
Message-ID: <693DAC6E-26B2-4BA1-BA04-9F8F6F5C14EB@gmail.com> (raw)
In-Reply-To: <86jzj2iqi2.fsf@gnu.org>



> On Jun 6, 2024, at 1:34 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: JD Smith <jdtsmith@gmail.com>
>> Date: Wed, 5 Jun 2024 18:06:54 -0400
>> 
>> The function treesit-font-lock-fontify-region in treesit.el calls (font-lock-unfontify-region start end) right away (see below).  But this function is called as the value of font-lock-fontify-syntactically-function from font-lock-default-fontify-region, which has just itself made the exact same call to font-lock-unfontify-region. I commented out that superfluous call in treesit-font-lock-fontify-region and noticed no ill effects.
> 
> Why is that duplicate call a problem?  

I don't know if it's ever really a problem, other than the small amount of time spent removing properties that have just been removed.

> We don't say that treesit-font-lock-fontify-region _must_ be called _only_ from
> font-lock-default-fontify-region, do we?


I presume the same logic would apply to font-lock-fontify-keywords-region, but that does not re-run unfontify (and is obviously much older code).   Maybe treesit reuses treesit-font-lock-fontify-region in non-font-lock contexts?  Feel free to close if Yuan concurs.






      reply	other threads:[~2024-06-06 11:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 22:06 bug#71384: treesit-font-lock-fontify-region unnecessarily re-unfontify's JD Smith
2024-06-06  5:34 ` Eli Zaretskii
2024-06-06 11:35   ` JD Smith [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

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

  git send-email \
    --in-reply-to=693DAC6E-26B2-4BA1-BA04-9F8F6F5C14EB@gmail.com \
    --to=jdtsmith@gmail.com \
    --cc=71384@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.