GNU bug report logs - #81879
32.0.50; treesit: cache failed language lookups too

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Rahul Martim Juliato <rahuljuliato@HIDDEN>; Done: Eli Zaretskii <eliz@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 81879-done <at> debbugs.gnu.org:


Received: (at 81879-done) by debbugs.gnu.org; 13 Oct 2026 11:32:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 13 07:32:00 2026
Received: from localhost ([127.0.0.1]:51299 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xGajc-000696-AC
	for submit <at> debbugs.gnu.org; Tue, 13 Oct 2026 07:31:59 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46530)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1xGajU-00063f-Dv
 for 81879-done <at> debbugs.gnu.org; Tue, 13 Oct 2026 07:31:51 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1xGajO-0004x9-Nb; Tue, 13 Oct 2026 07:31:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=DyKHb76C5N7FL9KDx9nOaZjK4myN1eZelK9M16gesMo=; b=D3HCWcNcwy+hETA8uoIs
 wOtw6Bv25NVelhzTyD758Q/QKJvCHVMUUTW800yK3k4FTBD8gtxbcZYEdz6XBSidy0v4TfnlbX7lv
 dOinVSEW7LjwlK+7EUfr5mRTraW/he/X+9cqSl/qEjlVMcNciQ1BH812qsX8KQk/xclwL9SHyDs3C
 7rzcpYISZOaIQEBCImrXODQ3TM3qdkI73CUG7D2YAKhMbtHWRt6SapH0Br6mSoPs/1KbYW4BlBHUw
 XUGMaxPyvhu0icti6ebbR3/5dZKJR6nX94lvO8KBHNV7Q56j2VRRHy0tDCKVVGvTwDzYGTyg/WxWW
 li1XFI3w4yFeFw==;
Date: Tue, 13 Oct 2026 14:31:39 +0300
Message-Id: <864iephm5g.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <9DB2D3C5-0AE9-4C89-BEAF-D9643203D873@HIDDEN> (message from
 Yuan Fu on Mon, 12 Oct 2026 11:47:16 -0700)
Subject: Re: bug#81879: 32.0.50; treesit: cache failed language lookups too
References: <m27bkkkcuc.fsf@HIDDEN>
 <C92AF15E-B01C-4369-8864-5787CCAB7176@HIDDEN> <86tsmuj8vf.fsf@HIDDEN>
 <D94869EE-9A65-46B2-A039-BFB0FEC2E26B@HIDDEN> <865wz7i0qg.fsf@HIDDEN>
 <9DB2D3C5-0AE9-4C89-BEAF-D9643203D873@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 81879-done
Cc: rahuljuliato@HIDDEN, 81879-done <at> debbugs.gnu.org, shipmints@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Yuan Fu <casouri@HIDDEN>
> Date: Mon, 12 Oct 2026 11:47:16 -0700
> Cc: rahuljuliato@HIDDEN,
>  81879 <at> debbugs.gnu.org,
>  shipmints@HIDDEN
> 
> 
> 
> > On Oct 12, 2026, at 5:04 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
> > 
> >> From: Yuan Fu <casouri@HIDDEN>
> >> Date: Sun, 11 Oct 2026 21:14:39 -0700
> >> Cc: rahuljuliato@HIDDEN,
> >> 81879 <at> debbugs.gnu.org,
> >> shipmints@HIDDEN
> >> 
> >> 
> >> 
> >>> On Oct 10, 2026, at 12:46 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
> >>> 
> >>> Ping!  Yuan, could you please answer my question, so we could make
> >>> further progress here?
> >> 
> >> I didn’t find any messages from you, so I guess you mean Rahul answering my questions? ;)
> > 
> > Are you okay with closing this bug?
> 
> I’m ok closing this since, as I mentioned earlier, the fix is fairly complex and there’s no real known problem with the current implementation.

OK, closing.




Notification sent to Rahul Martim Juliato <rahuljuliato@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Eli Zaretskii <eliz@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 81879 <at> debbugs.gnu.org:


Received: (at 81879) by debbugs.gnu.org; 12 Oct 2026 18:47:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 12 14:47:57 2026
Received: from localhost ([127.0.0.1]:46018 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xGL41-0008Oz-6q
	for submit <at> debbugs.gnu.org; Mon, 12 Oct 2026 14:47:57 -0400
Received: from mail-dy1-x1332.google.com ([2607:f8b0:4864:20::1332]:50417)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1xGL3y-0008O6-Ns
 for 81879 <at> debbugs.gnu.org; Mon, 12 Oct 2026 14:47:55 -0400
Received: by mail-dy1-x1332.google.com with SMTP id
 5a478bee46e88-35834f72d94so3755131eec.0
 for <81879 <at> debbugs.gnu.org>; Mon, 12 Oct 2026 11:47:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1791830868; x=1792435668; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:content-type:from:to:cc
 :subject:date:message-id:reply-to:content-type;
 bh=9cohvWj4wNH8rvXKblC8yLGuO11yXRsbnTTVSkbQv3U=;
 b=FpmxwLitPPen6/OMxbhhJ8S+nux5F25kbmxkPlEBLpsuwofWZmVKczyuHZxHCQrUQG
 +j9It1wdUny1Ybo8/TIyqLkcymIy5w36sFEefxL7jo9tjeUBptysYc6F6Za5MMjy1cXy
 UXtzZIVkL36vZPGlQ7qnNVF/Nf0rs6l++6baf81Cwdm5v6M3YyD0G88/e6O6li14Xw9g
 PM4yzAMCbrvmDvlv1HOmZgMN0OgxCwXWUBWmaw0nEANqyM+1/4Mk8yLCH8gLggKaQpaz
 Q3oPrFgsZ6a42VpyuLkxofKtsPusDgJOetRPAxb6Q+pLuQ9rqecLX0sMNqa0ra2xRhyl
 SakQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20260707; t=1791830868; x=1792435668;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:content-type:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
 :content-type;
 bh=9cohvWj4wNH8rvXKblC8yLGuO11yXRsbnTTVSkbQv3U=;
 b=TksF7xN2J7P9TIyj/q9pkl49fXMeemAGVBlhD/tQMiDK9nkS6ag95SEWqWk1VmL6wP
 14Mepovd6BHZQJYmT5Nmqp0yzJnG3BEorFeepALtuSFsZUbRdKeLmkweCl2dukWc0lY8
 ajLonBtB/C9cx4SL/B4bJarSpW+PR9iJzYpHqN22LKcVJ3h/yRdY2v88iNnu/dWXLXuH
 nOOAjkPannu7yQyqIWxL3D9Aq9EWrWms+lPucmhxTlQHa6TqFd3iMEgPTm1q1aEUltDr
 kCW/0vsOBb8IUgJlvN72Ug9kWBU/MMivUkr03mIvtUuTVI+RyUjZTtahN/DzHe1+dIZL
 UD1A==
X-Forwarded-Encrypted: i=1;
 AKwUvBx+nENBbaTZMbLEC8LvebT5C+D3ZOiANeyRAFWMg/FXbCeyeuPY84Vabw1/3Wcidx116Bbdyw==@debbugs.gnu.org
X-Gm-Message-State: AFq9FYIBVwoK8HBvVvCNhD2Vwx6vp4guZaGIL2YoYrSUBkNl6NK+7zh/
 7Ad6Aq8q1Xb99sNzbbpkSVtx899CuduzEWFY9v1vsN/rYbUGlr8k3LFR
X-Gm-Gg: AYBFou1SpkJIerm/Omh7Q4KJFY2DJbPaU+a8gBtSa23VBF6jDxyVwD3jhAbR96DgYbL
 8DpXhIULuMLV8mg9syexvXFP76QD0xm/uoyjghb2C8INgjJDAKkgkUHFwy7kXHxNXJsHLFRpCqm
 I83UIriZpj+RT938znqzTzwxHLAkX2P2U79t3Btnr2uwZqg140z8LVSAq/aWnL1uvKeYXWVdSil
 uyrR6ZlbXhiKFogltqXENYL0XKQ6tSHfj9P94vjHO9YDw2mlbxRZ/VimT/KnpxtOeKAMpJXSqgH
 na7YyavNAnhuOXjjVgMjThLSNlyCv7LUQZ3jdOWMutyQd4aNG1ensGLB+W60n4SLD8AEukaVu/z
 F6Bqqy/qjZ5NdXp0Srsy5kae03zvYDRmhjWJWL76sZcRYfUQ/TJGcv+8vRSFfXErVVEvc9fgVxe
 tzkPTkwcRCK98QzUQHYZlo+wrqVNqAM3mvIRzI8Nj0yW84fOz2dH3RELzo0vAiAAZp25Y4oMwjT
 OrHC5SUlZn4MA2iFcm6VA==
X-Received: by 2002:a05:7301:fc08:b0:351:4d2d:af26 with SMTP id
 5a478bee46e88-3537ddd6633mr13529597eec.2.1791830868323; 
 Mon, 12 Oct 2026 11:47:48 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c688:3880:f0ad:5cf7:c477:e906])
 by smtp.gmail.com with ESMTPSA id
 5a478bee46e88-359789fde97sm20485707eec.20.2026.10.12.11.47.47
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 12 Oct 2026 11:47:47 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#81879: 32.0.50; treesit: cache failed language lookups too
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <865wz7i0qg.fsf@HIDDEN>
Date: Mon, 12 Oct 2026 11:47:16 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <9DB2D3C5-0AE9-4C89-BEAF-D9643203D873@HIDDEN>
References: <m27bkkkcuc.fsf@HIDDEN>
 <C92AF15E-B01C-4369-8864-5787CCAB7176@HIDDEN> <86tsmuj8vf.fsf@HIDDEN>
 <D94869EE-9A65-46B2-A039-BFB0FEC2E26B@HIDDEN> <865wz7i0qg.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  > On Oct 12, 2026, at 5:04 AM, Eli Zaretskii wrote: > >>
    From: Yuan Fu >> Date: Sun, 11 Oct 2026 21:14:39 -0700 >> Cc: rahuljuliato@HIDDEN,
    >> 81879 <at> debbugs.gnu.org, >> shipmints@HIDDEN >> [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  1.0 FORGED_GMAIL_RCVD      'From' gmail.com does not match 'Received'
                             headers
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (casouri[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2607:f8b0:4864:20:0:0:0:1332 listed in]
                             [list.dnswl.org]
  1.0 FREEMAIL_REPLY         From and body contain different freemails
X-Debbugs-Envelope-To: 81879
Cc: rahuljuliato@HIDDEN, 81879 <at> debbugs.gnu.org, shipmints@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)



> On Oct 12, 2026, at 5:04=E2=80=AFAM, Eli Zaretskii <eliz@HIDDEN> =
wrote:
>=20
>> From: Yuan Fu <casouri@HIDDEN>
>> Date: Sun, 11 Oct 2026 21:14:39 -0700
>> Cc: rahuljuliato@HIDDEN,
>> 81879 <at> debbugs.gnu.org,
>> shipmints@HIDDEN
>>=20
>>=20
>>=20
>>> On Oct 10, 2026, at 12:46=E2=80=AFAM, Eli Zaretskii <eliz@HIDDEN> =
wrote:
>>>=20
>>> Ping!  Yuan, could you please answer my question, so we could make
>>> further progress here?
>>=20
>> I didn=E2=80=99t find any messages from you, so I guess you mean =
Rahul answering my questions? ;)
>=20
> Are you okay with closing this bug?

I=E2=80=99m ok closing this since, as I mentioned earlier, the fix is =
fairly complex and there=E2=80=99s no real known problem with the =
current implementation.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81879; Package emacs. Full text available.

Message received at 81879 <at> debbugs.gnu.org:


Received: (at 81879) by debbugs.gnu.org; 12 Oct 2026 12:04:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 12 08:04:35 2026
Received: from localhost ([127.0.0.1]:44868 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xGEle-0002yx-Vu
	for submit <at> debbugs.gnu.org; Mon, 12 Oct 2026 08:04:35 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39954)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1xGElc-0002yD-Mp
 for 81879 <at> debbugs.gnu.org; Mon, 12 Oct 2026 08:04:33 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1xGElX-0003fT-C8; Mon, 12 Oct 2026 08:04:27 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=CDeQl8tH/NEj2NaQCFabUxFLb7c55zhyTKJf9MiO+bQ=; b=fqlaHeH5Cwkfn2Qt332A
 VQeYF3zLm3O6DG7BmnHk4cMUHVLzUW1Pghm7Agyvr70/bWcaKRW48KWUrwtr+WtLWhoeGRmKzcY5F
 dU3bYDCpXUvki7FgPf1czJaCVH+5xcoOlCDyvADcO7NUjfQmJsBRimreNfDbA6nyNbydR/MdOVH2A
 CA3xiPP8KWU4eMO39Wl0elHAGFs+4JO9qlmoZRY7t6r05OZXogdMbl+iTBtNpiD8WCvolAFG9rKck
 pKmlWi6zpdhicPZnxBkhVblMo4HxkfzYPycESsN2swxnRJLn7vY/MhbgWr2GmJKs6lC746BXNpeVu
 mEUKcT8oWzCMBA==;
Date: Mon, 12 Oct 2026 15:04:23 +0300
Message-Id: <865wz7i0qg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <D94869EE-9A65-46B2-A039-BFB0FEC2E26B@HIDDEN> (message from
 Yuan Fu on Sun, 11 Oct 2026 21:14:39 -0700)
Subject: Re: bug#81879: 32.0.50; treesit: cache failed language lookups too
References: <m27bkkkcuc.fsf@HIDDEN>
 <C92AF15E-B01C-4369-8864-5787CCAB7176@HIDDEN> <86tsmuj8vf.fsf@HIDDEN>
 <D94869EE-9A65-46B2-A039-BFB0FEC2E26B@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 81879
Cc: rahuljuliato@HIDDEN, 81879 <at> debbugs.gnu.org, shipmints@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Yuan Fu <casouri@HIDDEN>
> Date: Sun, 11 Oct 2026 21:14:39 -0700
> Cc: rahuljuliato@HIDDEN,
>  81879 <at> debbugs.gnu.org,
>  shipmints@HIDDEN
> 
> 
> 
> > On Oct 10, 2026, at 12:46 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
> > 
> > Ping!  Yuan, could you please answer my question, so we could make
> > further progress here?
> 
> I didn’t find any messages from you, so I guess you mean Rahul answering my questions? ;)

Are you okay with closing this bug?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81879; Package emacs. Full text available.

Message received at 81879 <at> debbugs.gnu.org:


Received: (at 81879) by debbugs.gnu.org; 12 Oct 2026 04:15:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 12 00:15:00 2026
Received: from localhost ([127.0.0.1]:44179 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xG7RE-000872-63
	for submit <at> debbugs.gnu.org; Mon, 12 Oct 2026 00:15:00 -0400
Received: from mail-dy1-x132b.google.com ([2607:f8b0:4864:20::132b]:48632)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1xG7RB-00086Z-Pv
 for 81879 <at> debbugs.gnu.org; Mon, 12 Oct 2026 00:14:58 -0400
Received: by mail-dy1-x132b.google.com with SMTP id
 5a478bee46e88-33c2520ad38so3283245eec.1
 for <81879 <at> debbugs.gnu.org>; Sun, 11 Oct 2026 21:14:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1791778491; x=1792383291; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:content-type:from:to:cc
 :subject:date:message-id:reply-to:content-type;
 bh=KWkW46EJBYe3jX6XmdQL46CkKFSHRSeXoICA2hf8wLw=;
 b=YIkZE4IApsoyCxN2W8ZuY/ZLvsqz6yeJ9VR6/gCfyOnkQOj5ZZryXHNAwZL2tVjcqo
 dGqlqBT06gP5NFO3SpNqnh4UDYyEkPikoYqXQOgkwCUEV/U/3cujg5w8488l2bjdG20D
 nQD6uFmoxUdUQy4wduXQ9Rxe9XbCezfJIoAVky2zR0zjEE+BZK0hn7k6U61Ms1X/3Y29
 CH6dCNi7Bay4NHySYZPF/2Y3GPEt4evD2iZpKePXxkTYs9033SYQ1LJhMTVlYx/aaIPt
 EChXMy+EcDZ7CT7Imrn2ni9LYgo6WfNhr7xeMDkGXZ6/pN1NYVENHGyLktNliMwnPsUp
 1Gug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20260707; t=1791778491; x=1792383291;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:content-type:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
 :content-type;
 bh=KWkW46EJBYe3jX6XmdQL46CkKFSHRSeXoICA2hf8wLw=;
 b=BnhZTl3o5zIzsh6azev06qB5mASt6S2zTXYCSxmkHHbMSamz2zTSGNe3VxnQaPY2cW
 n1t3oj80KkZ8zLJZByyMgd3iUeAOzLbt53TNgHYmgV9/H8yKTW0rZkH90QGgm2QGAY9J
 rV8Yr4SpMdoKbb+8YFeCLwn6laZlH8842R7edJq0mUFn7e9xbU86XPj1fLIp2ZveIC0W
 EyTqaPwyeTEkXXAZ051tOAYt7GD9lOviPKoDw4eH8t5O7Hlp9bx+2kbYNEZvhmjKUPSi
 izrK9BcEmur+OkDkHnNz3Vooaf88y1f+0fATcVfmKd4kDAhX4n7pMlQhE8ajVPOZEOhW
 GgGg==
X-Forwarded-Encrypted: i=1;
 AKwUvBy0cVZjzYGdYO48Inso4em02OiH7jAFwIcnJcm7O82hmqdPRFHsrYfoBmrkDjxMJadjVA4SEA==@debbugs.gnu.org
X-Gm-Message-State: AFq9FYLGyCdywSVa2YwJA7JBRNLrmXJqBgEKa8zlpy6MaZmsceCuqzMr
 6Iq4RTDvUFdoYA/BYMncci3MUJ/yjjYcqIVH6aA2343QVuejATOIItaY
X-Gm-Gg: AYBFou0b+Hfqim51nlZymc0H/zOIAqjx8Ga1HLrzQpy1pJMvj+fr2pABioxhXcXk222
 pbh0hATITcamOUHDUk6diyfOP1K1U06GbEK2WT3ZT7zuWPRuulJnkXTMQ+KsFmMJBvtEb9EYcxJ
 gEZPOZEzk8/xqm0cRDi+5UG9YMfANW/8nOMWsO8lCfkBHIv1PoZCa5oZ3yCNLsIpw2sT18hpvPH
 zICB167bQXaJ3rx2L9ux4auCYFhehYyb8YHLbeC/E72ein+XTG3zAAPcd8kaJA+zzaZVhPmFtfe
 Yjkmppw0BZTNYDPWGEnsAv8nkM0z0us1Q97TjmyPv5OW1nyHSZDuOK5AYFDur8v7uLqUb9cdz2o
 BYaloWEsa5aGlJurIdCAn9UcqLGEKFU+kQsEXZBfIAgJHY8ghGC8zs7LKBIwT8Fpcf7pBwb1V0g
 g/yTZHG6/axrI0aQNu4BE+gvn2H9B6HV4eEzfWXiAI9XtD56GGxr4zAWqrfaL3H49Vcob/O5lI3
 KeogJtiqPo0lsEebvhQwg==
X-Received: by 2002:a05:7301:53c9:b0:359:d4c9:6081 with SMTP id
 5a478bee46e88-359d4c96379mr4341101eec.12.1791778491260; 
 Sun, 11 Oct 2026 21:14:51 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c688:3880:f0ad:5cf7:c477:e906])
 by smtp.gmail.com with ESMTPSA id
 5a478bee46e88-3595e0858c6sm13678222eec.22.2026.10.11.21.14.50
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 11 Oct 2026 21:14:50 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#81879: 32.0.50; treesit: cache failed language lookups too
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <86tsmuj8vf.fsf@HIDDEN>
Date: Sun, 11 Oct 2026 21:14:39 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <D94869EE-9A65-46B2-A039-BFB0FEC2E26B@HIDDEN>
References: <m27bkkkcuc.fsf@HIDDEN>
 <C92AF15E-B01C-4369-8864-5787CCAB7176@HIDDEN> <86tsmuj8vf.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81879
Cc: rahuljuliato@HIDDEN, 81879 <at> debbugs.gnu.org, shipmints@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)



> On Oct 10, 2026, at 12:46=E2=80=AFAM, Eli Zaretskii <eliz@HIDDEN> =
wrote:
>=20
> Ping!  Yuan, could you please answer my question, so we could make
> further progress here?

I didn=E2=80=99t find any messages from you, so I guess you mean Rahul =
answering my questions? ;)





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81879; Package emacs. Full text available.

Message received at 81879 <at> debbugs.gnu.org:


Received: (at 81879) by debbugs.gnu.org; 10 Oct 2026 14:20:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 10 10:20:37 2026
Received: from localhost ([127.0.0.1]:37031 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xFXwD-0001J4-85
	for submit <at> debbugs.gnu.org; Sat, 10 Oct 2026 10:20:37 -0400
Received: from mail-vk1-xa2e.google.com ([2607:f8b0:4864:20::a2e]:49491)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <rahuljuliato@HIDDEN>)
 id 1xFXwA-0001IF-Gj
 for 81879 <at> debbugs.gnu.org; Sat, 10 Oct 2026 10:20:35 -0400
Received: by mail-vk1-xa2e.google.com with SMTP id
 71dfb90a1353d-5d7daf06158so194653e0c.3
 for <81879 <at> debbugs.gnu.org>; Sat, 10 Oct 2026 07:20:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1791642029; x=1792246829; darn=debbugs.gnu.org;
 h=content-transfer-encoding:content-type:mime-version:user-agent
 :message-id:date:face:references:in-reply-to:subject:cc:to:from:from
 :to:cc:subject:date:message-id:reply-to:content-type;
 bh=gaMisrwsipwm/F+HXMbA+lzCGzZd3OrdCWdgLm7RwgE=;
 b=ScRtftbi/Cn+ExavZ00C8lfMUKJJcfJpSsW0ax5lQ0HkbAuP1/2QbVBnR07+ym/uSR
 z1eFKZgH0ZrYKlHnypsJ8WzC6IHYi/MGhQo8h9BMJrOtFrZkj4Zip2F8oOg5M+SIisLc
 a0IkrIEV/dFH/k0qifZ1YhD1E2048qkhXefu0vNQ96qUyIcQVpmHC+KpLvDbYcBsmhJc
 mkfg6VrROsECfAe4Bu9p4r+2bLF70iiZQk24xI8+0FWvkRgzHJOHz4+gJjpMChHTQZib
 rO6sWoPmz/W5BZup/Y8NI+EpMBWb2bCrTluJGbvlKp4EuDQ9TFR+eMZQrmvbYLdSVbEy
 x86g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20260707; t=1791642029; x=1792246829;
 h=content-transfer-encoding:content-type:mime-version:user-agent
 :message-id:date:face:references:in-reply-to:subject:cc:to:from
 :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to:content-type;
 bh=gaMisrwsipwm/F+HXMbA+lzCGzZd3OrdCWdgLm7RwgE=;
 b=IVJKxBNxlQB5UHm3wiwH2puQZ3f6d90b4kYUEXke4gxntBKFlC6JqGNvdijGBf9c+1
 z9lEvnRQSfqo0SxDwEIeBCfj6tl6Jz1bDrJlAyWeHDGwbeAWUAkjlCNpBE7Ttj8xl//r
 XrZIrwpuHQm6h5rOc6sgc2eiCGiVb77Avm3CF1GDh9plQkxoZOcftuOqUiJe/20B2FtB
 NTDwmeOeTpMDRf5w08lH5U3zjeeiyGMrCwHsV2nSnFj/1QWtjNJ2lWHyiGr+rgD7X94a
 YoelS407TQRO2il8M3DZeCrDhuaTahyUzeqTY4J04QYj4kL8ipWM3wluhzph+LLMzgIk
 2m/Q==
X-Forwarded-Encrypted: i=1;
 AKwUvBypOUmzBTSuGbMQQ58ytCwWHEkoH4Yfhkcp5BD1pd9irsmAB0llIPkU1Uie0UCwsuRJMxqQBw==@debbugs.gnu.org
X-Gm-Message-State: AFq9FYJKOu5d7Hrw/UGNu/bD5dOgqrzkTweCyvGLeiHdkgf0ZvvZorlg
 yfbUemuRzODh+YNWHT8CmxGIPkmZG/wtcYO5oNM39Gdy9GoH0THUkCWJ
X-Gm-Gg: AYBFou2qTQHrG934tRGOKcPLx8Rx8Fxjmdka8vSluBtaWk3V30Qb/yhtD5PZbGfVNU/
 0saIL8dlOy9Q3iiwkYrxb0w/dkzEilGB+SkFApKzQ0zkWZJEFdLA++p6YqY4pmmIIDlvrVkMYGo
 +V/O2GkCRC8bCQoknW6Zy8tnhCiFdeZgQLtRMculLCH15z0vn8P6hQDOtEaCorNte124sIgEEMf
 b2bSudHHaxqgdsJrt/REQV3HZtt40Otx4SWMBCUvp5Dsg4ukAKAcucGnlXSJMG0CwdGXQj//ozO
 6epv/hGR4cWDJxE+RS/LlS74E/hNh+hvLzTT86u6vPOeap8FzPFrInVGmfG9KIYrBYqyD1AjHfj
 /bGvaEbIVANRMwuABYFvHH9ceStrWJt13TKJO7aUcNCRSdd7BwkcyRE1rF924CVbPUUdrfbXpEY
 jZsRLHHpEw3upYXDIGwtu9/aHxdU6ALDlY475UtaR1zE7a+a3Mhy/nBEQ3UMxwXChMHjGRtl5um
 nX1Y4pwcVe+3g6uH9G343rppiUxz02BhRKOx+qyaUgqtIutOmNJ6/RQE+AMLPpEReLOHFLyp3pi
 e5Z5jg==
X-Received: by 2002:a05:6122:1d94:b0:5ce:b65d:22b8 with SMTP id
 71dfb90a1353d-5e91f54906bmr1705025e0c.19.1791642028536; 
 Sat, 10 Oct 2026 07:20:28 -0700 (PDT)
Received: from construct (201-93-59-44.dial-up.telesp.net.br. [201.93.59.44])
 by smtp.gmail.com with ESMTPSA id
 71dfb90a1353d-5e91cbf5d1fsm3921729e0c.14.2026.10.10.07.20.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 10 Oct 2026 07:20:27 -0700 (PDT)
From: Rahul Martim Juliato <rahuljuliato@HIDDEN>
X-Google-Original-From: Rahul Martim Juliato <rahul.juliato@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#81879: 32.0.50; treesit: cache failed language lookups too
In-Reply-To: <86tsmuj8vf.fsf@HIDDEN>
References: <m27bkkkcuc.fsf@HIDDEN>
 <C92AF15E-B01C-4369-8864-5787CCAB7176@HIDDEN> <86tsmuj8vf.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IB2cksfwAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAABhQTFRFDxIfFR9FMD+RM2CBkZPbZKPEn+Xt////lKVMgwAAAAFiS0dEAIgFHUgAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfqAhsDFwcfcr7WAAACY0lEQVRIx7VVWbLbMAwzBZG6/41LcJHXpl/Vm/G8OADBBWKOo44c//mM2yeoH7go/kqQG3zlucDxgwTzkwz9XVl+K8Z8igL5p4KYKbApCHDC5aGXn7EcD1KCkUl9154EtSJUJWwWIIJbZyLVIIgTguGdCobxQ4nLI3gRLECO9axcwgNYQi81yH5KhGXZ1oU7XSH3YUnQ488YsesOCWrwxYOAgAtW1ZCEZKxoNR4TCILXGnPbjJ65v8ZrbB4fbI02pUaelSjuDKboCS1LifMEg1HwaOpRvV/2Ylja5ekjafyFYU2AnGOTMagh5Qbrs6OngFxTkhFPxUYUZePl3iQnSB7Y+3gcvQocDSYeWOuDYorXZagzhioeqWVSH3ivfvS54/EcW8LvB2eTSJDtbtkJXeGTD/1FwCbMNI/pnC0CjYi3ej2HhDvOD121dGzGFyHgM+5DUnhLNc0lKm0OYptQsWPTJKPMMuil0rhU6+E51th4obJqinOMntOBM59pzlg0wmICoRc3ML5tgpzpODRdk02MQmaEL8YIhdEElJniQbvDRSh7DicV9qjmQFeFHA3mosS8EU6+8g2jV8dzc3jpTK0ZFwWObITvpXZv1MRJXDSOs6WskFcxVKqIlKPMJpzxp9I+udrjLx3tKfB9unHslNi/Wj9AZt8+mGEnnTmPIzMYM5ZENgp1XVghv+uN4/ZE7sf4gXJV9yvHJp1/7EvJlTlz
 pUspOFJt723pVYz9c2cpgHYfKSMXVz72TvL/rJqxL92+D2cGuelri9Nkc5wX6Hjf6cqEsoPptle/Vtllqb3eEPkHU2QXL+sLC8kAAAAASUVORK5CYII=
X-PGP-Key: https://www.rahuljuliato.com/rahul_pub_key.asc
Date: Sat, 10 Oct 2026 11:20:24 -0300
Message-ID: <m2h5itr61j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81879
Cc: Yuan Fu <casouri@HIDDEN>, rahuljuliato@HIDDEN, 81879 <at> debbugs.gnu.org,
 shipmints@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

> Ping!  Yuan, could you please answer my question, so we could make
> further progress here?
>
>> Cc: 81879 <at> debbugs.gnu.org,
>>  St=C3=A9phane Marks <shipmints@HIDDEN>
>> From: Yuan Fu <casouri@HIDDEN>
>> Date: Tue, 22 Sep 2026 20:16:32 -0700
>>=20
>>=20
>>=20
>> > On Sep 16, 2026, at 4:15=E2=80=AFPM, Rahul Martim Juliato <rahuljuliat=
o@HIDDEN> wrote:
>> >=20
>> > Hi Yuan,
>> >=20
>> > This is a a follow-up to bug#81334.  The language cache we installed
>> > there (commit 7eb0fd17e36) removes the repeated dlopen/dlsym and the A=
BI
>> > version check for languages that *are* installed, and it does that wel=
l.
>> > But it only caches successes: when a grammar is not installed,
>> > treesit_load_language walks the whole candidate list again on every
>> > single call, so code that asks about a missing language in a loop gets
>> > none of the benefit.
>> >=20
>> > The cost of a miss is not small.  On master (5c91443e85c7, macOS,
>> > tree-sitter with ABI 13-15, treesit-extra-load-path nil):
>> >=20
>> >  emacs -Q --batch --eval '(progn
>> >    (require (quote treesit))
>> >    (dolist (lang (quote (markdown nosuchlang)))
>> >      (let ((t0 (float-time)))
>> >        (dotimes (_ 1000) (treesit-language-available-p lang))
>> >        (message "%s: %.4fs" lang (- (float-time) t0)))))'
>> >=20
>> >  markdown:   0.0001s / 1000 calls   (cached hit)
>> >  nosuchlang: 1.7857s / 1000 calls   (~1.8 ms per call)
>> >=20
>> > As you already know, the reason is the candidate list built in
>> > treesit_load_language_push_for_each_suffix: per load directory and per
>> > entry of dynamic-library-suffixes it tries the plain name, the ".0" and
>> > ".0.0" variants, and one name per supported ABI version.  Here that is=
 6
>> > names x 2 suffixes x 2 directories =3D 24 failing dynlib_open calls per
>> > query, each one also consing an error string for the error list.  Every
>> > element of treesit-extra-load-path adds 12 more.
>> >=20
>> > Where this shows up in practice: a major mode that has to decide per
>> > range, per redisplay or per parser creation whether an embedded langua=
ge
>> > is available.  I am about to work around it by hand in markdown-ts-mode
>> > (bug#81150) by caching treesit-language-available-p results in the mod=
e,
>> > but the problem is not specific to that mode, and every mode that embe=
ds
>> > optional languages will need the same workaround.  It seems better to
>> > solve it once in treesit.c.
>> >=20
>> > What I would like to propose:
>> >=20
>> >  - Cache negative results as well, keyed by the language symbol,
>> >    alongside the existing positive entries.  treesit-language-
>> >    available-p with DETAIL also needs the signal data, so the cached
>> >    failure has to carry signal_symbol/signal_data; those are Lisp
>> >    objects that would need to be protected from GC, unlike the interned
>> >    symbols the current cache stores.
>> >=20
>> >  - Unlike the positive entries, negative ones must be invalidatable,
>> >    since a grammar can appear during the session.  The points I can
>> >    see:
>> >=20
>> >      * treesit-install-language-grammar, which should flush the entry
>> >        (or the whole negative cache) after a successful install;
>> >      * treesit-extra-load-path being changed, which could be handled by
>> >        a variable watcher, or by making the path list part of the cache
>> >        key;
>> >      * user-emacs-directory being changed, same idea.
>> >=20
>> >    A Lisp-visible flush function would also be useful on its own, for
>> >    users who drop a grammar into place by hand, and for tests.
>> >=20
>> > Positive entries can stay as they are, since we never unload a languag=
e.
>> >=20
>> > Does this look like the right direction to you?  If so, I can prepare a
>> > patch.  I would like your opinion on two points before writing it:
>> > whether the negative cache should be keyed on the language symbol alone
>> > plus a watcher on treesit-extra-load-path, or on the symbol plus the
>> > effective search path, and whether you want the flush exposed as a
>> > public function (treesit-forget-language?) or kept internal and called
>> > only from treesit-install-language-grammar.
>>=20
>> What=E2=80=99s the user-noticeable impact of this shortcoming? As you no=
ted, caching negative results is complicated and brittle, so I don=E2=80=99=
t want to do it unless we have to.
>>=20
>> Yuan
>>=20

Hi Eli, Yuan,

Sorry for the delay, I missed Yuan's question.

> What's the user-noticeable impact of this shortcoming?

Honestly, none that I can point to right now.  The only case I hit was
markdown-ts-mode querying optional embedded languages repeatedly, and
that is handled inside the mode, by caching the results of
treesit-language-available-p, in the performance patch we are discussing
in bug#81150.  I don't know of another mode or a user report where the
cost of a failed lookup is noticeable.

Given that, I agree the complexity and the risk of stale entries might
not be worth it.  I'm fine with closing this as wontfix.  If another
case shows up, we can revisit it with concrete numbers.

Thanks,

--=20
Rahul Martim Juliato




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81879; Package emacs. Full text available.

Message received at 81879 <at> debbugs.gnu.org:


Received: (at 81879) by debbugs.gnu.org; 10 Oct 2026 07:46:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 10 03:46:44 2026
Received: from localhost ([127.0.0.1]:38865 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xFRn0-0002Uh-3r
	for submit <at> debbugs.gnu.org; Sat, 10 Oct 2026 03:46:44 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47986)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1xFRmv-0002Nd-LW
 for 81879 <at> debbugs.gnu.org; Sat, 10 Oct 2026 03:46:39 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1xFRmq-0004uF-3v; Sat, 10 Oct 2026 03:46:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=ADDRNlBjJQcs6ERhoB7GQh4m9r2HJpu9z/3XPeV/GY0=; b=nIy5dvA9LIo+RxRdMpYY
 YKjlkkvwNBrHfiucIWdNnft62nGqU8kgb7t1IwwX4a33qQASozjCUbnDMhu9z2K3OYzcKKiSIm217
 uTddlkKuaOkeNKvk5lhlJ2Ml3hfPaic+7oRBbSPeoslfjWgQ2Z300v+REYSzSM4AWu8RhR/4oR3TT
 0xuFcLaQbnWKZPjh5Rx9qC92uNMcXDv5h5rHQsxDN+gg66FEkt87fAAIJZrNNdkLOckTPk9ovoukk
 2kRBTRCpx6b/XcBUMwGklFaPr/ymH1X4H1517XPIcz2tOj316lidH0JPXP5hyDjl70vZTbSM/Q8wI
 NvS7DPMZkOjzeQ==;
Date: Sat, 10 Oct 2026 10:46:28 +0300
Message-Id: <86tsmuj8vf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <C92AF15E-B01C-4369-8864-5787CCAB7176@HIDDEN> (message from
 Yuan Fu on Tue, 22 Sep 2026 20:16:32 -0700)
Subject: Re: bug#81879: 32.0.50; treesit: cache failed language lookups too
References: <m27bkkkcuc.fsf@HIDDEN>
 <C92AF15E-B01C-4369-8864-5787CCAB7176@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 81879
Cc: rahuljuliato@HIDDEN, 81879 <at> debbugs.gnu.org, shipmints@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping!  Yuan, could you please answer my question, so we could make
further progress here?

> Cc: 81879 <at> debbugs.gnu.org,
>  Stéphane Marks <shipmints@HIDDEN>
> From: Yuan Fu <casouri@HIDDEN>
> Date: Tue, 22 Sep 2026 20:16:32 -0700
> 
> 
> 
> > On Sep 16, 2026, at 4:15 PM, Rahul Martim Juliato <rahuljuliato@HIDDEN> wrote:
> > 
> > Hi Yuan,
> > 
> > This is a a follow-up to bug#81334.  The language cache we installed
> > there (commit 7eb0fd17e36) removes the repeated dlopen/dlsym and the ABI
> > version check for languages that *are* installed, and it does that well.
> > But it only caches successes: when a grammar is not installed,
> > treesit_load_language walks the whole candidate list again on every
> > single call, so code that asks about a missing language in a loop gets
> > none of the benefit.
> > 
> > The cost of a miss is not small.  On master (5c91443e85c7, macOS,
> > tree-sitter with ABI 13-15, treesit-extra-load-path nil):
> > 
> >  emacs -Q --batch --eval '(progn
> >    (require (quote treesit))
> >    (dolist (lang (quote (markdown nosuchlang)))
> >      (let ((t0 (float-time)))
> >        (dotimes (_ 1000) (treesit-language-available-p lang))
> >        (message "%s: %.4fs" lang (- (float-time) t0)))))'
> > 
> >  markdown:   0.0001s / 1000 calls   (cached hit)
> >  nosuchlang: 1.7857s / 1000 calls   (~1.8 ms per call)
> > 
> > As you already know, the reason is the candidate list built in
> > treesit_load_language_push_for_each_suffix: per load directory and per
> > entry of dynamic-library-suffixes it tries the plain name, the ".0" and
> > ".0.0" variants, and one name per supported ABI version.  Here that is 6
> > names x 2 suffixes x 2 directories = 24 failing dynlib_open calls per
> > query, each one also consing an error string for the error list.  Every
> > element of treesit-extra-load-path adds 12 more.
> > 
> > Where this shows up in practice: a major mode that has to decide per
> > range, per redisplay or per parser creation whether an embedded language
> > is available.  I am about to work around it by hand in markdown-ts-mode
> > (bug#81150) by caching treesit-language-available-p results in the mode,
> > but the problem is not specific to that mode, and every mode that embeds
> > optional languages will need the same workaround.  It seems better to
> > solve it once in treesit.c.
> > 
> > What I would like to propose:
> > 
> >  - Cache negative results as well, keyed by the language symbol,
> >    alongside the existing positive entries.  treesit-language-
> >    available-p with DETAIL also needs the signal data, so the cached
> >    failure has to carry signal_symbol/signal_data; those are Lisp
> >    objects that would need to be protected from GC, unlike the interned
> >    symbols the current cache stores.
> > 
> >  - Unlike the positive entries, negative ones must be invalidatable,
> >    since a grammar can appear during the session.  The points I can
> >    see:
> > 
> >      * treesit-install-language-grammar, which should flush the entry
> >        (or the whole negative cache) after a successful install;
> >      * treesit-extra-load-path being changed, which could be handled by
> >        a variable watcher, or by making the path list part of the cache
> >        key;
> >      * user-emacs-directory being changed, same idea.
> > 
> >    A Lisp-visible flush function would also be useful on its own, for
> >    users who drop a grammar into place by hand, and for tests.
> > 
> > Positive entries can stay as they are, since we never unload a language.
> > 
> > Does this look like the right direction to you?  If so, I can prepare a
> > patch.  I would like your opinion on two points before writing it:
> > whether the negative cache should be keyed on the language symbol alone
> > plus a watcher on treesit-extra-load-path, or on the symbol plus the
> > effective search path, and whether you want the flush exposed as a
> > public function (treesit-forget-language?) or kept internal and called
> > only from treesit-install-language-grammar.
> 
> What’s the user-noticeable impact of this shortcoming? As you noted, caching negative results is complicated and brittle, so I don’t want to do it unless we have to.
> 
> Yuan
> 
> 
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81879; Package emacs. Full text available.

Message received at 81879 <at> debbugs.gnu.org:


Received: (at 81879) by debbugs.gnu.org; 23 Sep 2026 03:17:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 22 23:17:00 2026
Received: from localhost ([127.0.0.1]:44459 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1x9DTc-0002oz-D8
	for submit <at> debbugs.gnu.org; Tue, 22 Sep 2026 23:17:00 -0400
Received: from mail-dy2-x10.google.com ([2607:f8b0:4864:36::10]:56396)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1x9DTX-0002nC-1H
 for 81879 <at> debbugs.gnu.org; Tue, 22 Sep 2026 23:16:54 -0400
Received: by mail-dy2-x10.google.com with SMTP id
 5a478bee46e88-328664d340aso262256eec.0
 for <81879 <at> debbugs.gnu.org>; Tue, 22 Sep 2026 20:16:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1790133405; x=1790738205; darn=debbugs.gnu.org;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:content-type:from:to:cc
 :subject:date:message-id:reply-to:content-type;
 bh=OP+z+Jn8sHbKKWc2FdQLNU1HEcFhvEw6TiEtZ8a4vj0=;
 b=CA+AUDySx/Jjq6NGLDtiH1xA+Apt03qAV5c19nU1l02yHhxwC5/4kzYt7e7b7/v31I
 d3fg+rEfS5gUqF3/JPF+dLJGQy7jbTERqUw27o8B4mCXvIGiPkVGI88Pz6tifGNksgmp
 TpZuWUujrq+ARQGzbxJzjVaziGOjurGmnMWhAPZGrXqC736ThQq8ryR2DfSEGZVb/E9o
 jtIwVsn+B1dWvmQm25pg4FJM4z2rb9J9GvkiHs0V4zinURLiBQs6/y06QhGynVrO74rG
 9tEQeJ4BdQviMd8QnyKmVwzLqYi/xrTaoql8EvZM6zTAZ1ZwWs1ymbwGa5mFNggyjVcA
 oEuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20260707; t=1790133405; x=1790738205;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:content-type:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
 :content-type;
 bh=OP+z+Jn8sHbKKWc2FdQLNU1HEcFhvEw6TiEtZ8a4vj0=;
 b=jgU3lq73nd+/RHLrVT9lZndCRf4bdCNAWTsW0OzQfmuYKWhiiHi+egpUyb3QV5mByU
 phOpImotNjp4qJn4T3Zky1K75hVi3MnUdPOrrZA2uzBtJ6SsihAId1j27f4d10BrauvT
 RAVTMoKy3q3tsOJQQEWaCaXaOKk27c6wk/u+ZJNaABAxk2ZWpFLYVqymoYAlbC2r8wep
 004FALm8cZSgBgopEsgUCQdxfUgAhopcJD9H50cC47P/+SQHfUdY6sOft/dgP8/UWKkk
 HBNB+LT4157Y70ZpzYeGLNZKG6h3hY8tKSvJWDvSABf0I+lXqMEMUCnuOcZsE59h7Slo
 eUqg==
X-Gm-Message-State: AFuF++lcPkFXy5k1u+6JL+qwnwn/pnlaeZOmxkjOOk8ALB17F8WfFHKt
 Fq3+EDm5d5mFU1u80/6G9S/78Mc9a5AnhCdF5iYNnm/w1GppI/uoqyEz
X-Gm-Gg: AYBFou3w2gGqA/ovZHwpOOcAXgbBV3hLlQfVhKXNj9WZBrP/lBTStzPRVoE+aUu4WCZ
 rinMSFGloTgL9Sq82FL9RbGk/B7VACy3TYKzO73SZCK1wPR42XVsCHWoUh2iF5ppidJrQAT3tJ3
 aZCRfUK7goDP3LKbtSf3xkyk1kIVg/CUBeJOd+mOM5t2RyXr4MwIoSufYE4h/s0pn8FBN0Yqasm
 DezNQ9s0Lf88axWCqHIKI7/QPsDu2N2mU9D5lHnxE8Wp97VaF8DaOU/jpmUj4yXUybwQutudYC/
 Q2hKH/ypeBs3tXeNspfrLNfLzRQdiR98Yw11fR6M88eq4e42A0Yn5cb/lXPZuUYcEKgRbCNs9vD
 IPM9jI4u3wQzTmguUmn4yyRrI81A7F2dYV9TEZp9IxALWdb8NdjU98C608e5CZbCv3TgpU4CBdX
 vmUnit5Boj/sElEWSMXckGrT39+SJZIoyqN8WFcFHyOgEV5HojuA2IeRffVRAabPJVDKGL0TWPM
 GgzRcZ6wcgqT2CqBXFmeg5wFS5+pjtc
X-Received: by 2002:a05:693c:8950:20b0:314:75d9:4751 with SMTP id
 5a478bee46e88-33e8d9c90e0mr1297038eec.20.1790133404471; 
 Tue, 22 Sep 2026 20:16:44 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c688:3880:f06f:7e88:bc94:1865])
 by smtp.gmail.com with ESMTPSA id
 5a478bee46e88-33e9625825asm2304250eec.13.2026.09.22.20.16.43
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 22 Sep 2026 20:16:43 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#81879: 32.0.50; treesit: cache failed language lookups too
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <m27bkkkcuc.fsf@HIDDEN>
Date: Tue, 22 Sep 2026 20:16:32 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <C92AF15E-B01C-4369-8864-5787CCAB7176@HIDDEN>
References: <m27bkkkcuc.fsf@HIDDEN>
To: Rahul Martim Juliato <rahuljuliato@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81879
Cc: 81879 <at> debbugs.gnu.org,
 =?utf-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)



> On Sep 16, 2026, at 4:15=E2=80=AFPM, Rahul Martim Juliato =
<rahuljuliato@HIDDEN> wrote:
>=20
> Hi Yuan,
>=20
> This is a a follow-up to bug#81334.  The language cache we installed
> there (commit 7eb0fd17e36) removes the repeated dlopen/dlsym and the =
ABI
> version check for languages that *are* installed, and it does that =
well.
> But it only caches successes: when a grammar is not installed,
> treesit_load_language walks the whole candidate list again on every
> single call, so code that asks about a missing language in a loop gets
> none of the benefit.
>=20
> The cost of a miss is not small.  On master (5c91443e85c7, macOS,
> tree-sitter with ABI 13-15, treesit-extra-load-path nil):
>=20
>  emacs -Q --batch --eval '(progn
>    (require (quote treesit))
>    (dolist (lang (quote (markdown nosuchlang)))
>      (let ((t0 (float-time)))
>        (dotimes (_ 1000) (treesit-language-available-p lang))
>        (message "%s: %.4fs" lang (- (float-time) t0)))))'
>=20
>  markdown:   0.0001s / 1000 calls   (cached hit)
>  nosuchlang: 1.7857s / 1000 calls   (~1.8 ms per call)
>=20
> As you already know, the reason is the candidate list built in
> treesit_load_language_push_for_each_suffix: per load directory and per
> entry of dynamic-library-suffixes it tries the plain name, the ".0" =
and
> ".0.0" variants, and one name per supported ABI version.  Here that is =
6
> names x 2 suffixes x 2 directories =3D 24 failing dynlib_open calls =
per
> query, each one also consing an error string for the error list.  =
Every
> element of treesit-extra-load-path adds 12 more.
>=20
> Where this shows up in practice: a major mode that has to decide per
> range, per redisplay or per parser creation whether an embedded =
language
> is available.  I am about to work around it by hand in =
markdown-ts-mode
> (bug#81150) by caching treesit-language-available-p results in the =
mode,
> but the problem is not specific to that mode, and every mode that =
embeds
> optional languages will need the same workaround.  It seems better to
> solve it once in treesit.c.
>=20
> What I would like to propose:
>=20
>  - Cache negative results as well, keyed by the language symbol,
>    alongside the existing positive entries.  treesit-language-
>    available-p with DETAIL also needs the signal data, so the cached
>    failure has to carry signal_symbol/signal_data; those are Lisp
>    objects that would need to be protected from GC, unlike the =
interned
>    symbols the current cache stores.
>=20
>  - Unlike the positive entries, negative ones must be invalidatable,
>    since a grammar can appear during the session.  The points I can
>    see:
>=20
>      * treesit-install-language-grammar, which should flush the entry
>        (or the whole negative cache) after a successful install;
>      * treesit-extra-load-path being changed, which could be handled =
by
>        a variable watcher, or by making the path list part of the =
cache
>        key;
>      * user-emacs-directory being changed, same idea.
>=20
>    A Lisp-visible flush function would also be useful on its own, for
>    users who drop a grammar into place by hand, and for tests.
>=20
> Positive entries can stay as they are, since we never unload a =
language.
>=20
> Does this look like the right direction to you?  If so, I can prepare =
a
> patch.  I would like your opinion on two points before writing it:
> whether the negative cache should be keyed on the language symbol =
alone
> plus a watcher on treesit-extra-load-path, or on the symbol plus the
> effective search path, and whether you want the flush exposed as a
> public function (treesit-forget-language?) or kept internal and called
> only from treesit-install-language-grammar.

What=E2=80=99s the user-noticeable impact of this shortcoming? As you =
noted, caching negative results is complicated and brittle, so I don=E2=80=
=99t want to do it unless we have to.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81879; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 Sep 2026 23:15:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 16 19:15:33 2026
Received: from localhost ([127.0.0.1]:59865 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1x6yqj-0008GG-Du
	for submit <at> debbugs.gnu.org; Wed, 16 Sep 2026 19:15:33 -0400
Received: from lists1p.gnu.org ([2001:470:142::17]:57938)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rahuljuliato@HIDDEN>)
 id 1x6yqe-0008ES-6f
 for submit <at> debbugs.gnu.org; Wed, 16 Sep 2026 19:15:32 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rahuljuliato@HIDDEN>)
 id 1x6yqS-00081N-NM
 for bug-gnu-emacs@HIDDEN; Wed, 16 Sep 2026 19:15:16 -0400
Received: from mail-vs2-x0d.google.com ([2a00:1450:4864:3a::d])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <rahuljuliato@HIDDEN>)
 id 1x6yqP-0002c5-JL
 for bug-gnu-emacs@HIDDEN; Wed, 16 Sep 2026 19:15:15 -0400
Received: by mail-vs2-x0d.google.com with SMTP id
 71dfb90a1353d-5c963a787c9so73987e0c.2
 for <bug-gnu-emacs@HIDDEN>; Wed, 16 Sep 2026 16:15:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1789600511; x=1790205311; darn=gnu.org;
 h=content-type:mime-version:user-agent:message-id:date:face:subject
 :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
 bh=Yl3h9yd4yTJo0UH3OADrIz/ym6dTPVtYiBjynzP/Sls=;
 b=iuvP1CvJcdCn8DgWsiENT4cj2r2xDG3YHmCJtd7jPH/VUu06wfcHG7IoRQvb849+sS
 zV3fVwShSuDNxtjZdUGGCDTiSmDGXRbW4UAAsC59s3If5nwEcBTQl/1HRzouXOdJ0hfp
 dfQKts+uGg14q6mSVUtkNz6DUKwdPatjnGmmBMnUvHxwaTdFkvurIyCHas7JhSmS5K3A
 +SG0+xjtj/+7O3einOEzzaoJmNjyyy3Nm7bpAkVav/QW1H/JgVGEyqW7/FtldMhtta0u
 NjG6DbpBwicUmMdAXpWhGydNeXLyh55C6ZMglp4mmLKJo9GfuQqLmq2tn8gJJk2rWjsc
 6vzA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20260707; t=1789600511; x=1790205311;
 h=content-type:mime-version:user-agent:message-id:date:face:subject
 :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to:content-type;
 bh=Yl3h9yd4yTJo0UH3OADrIz/ym6dTPVtYiBjynzP/Sls=;
 b=IBNlBM0anR50HV+2/jKZzeWewI7vnH5Ni7VvL1Pb41k2IHqb5cCTQXpzlfgw7X+I6w
 MPxo+FQdGWiAGCGbAOzRSN0xEbS/QypBMyNrrl1cvEg0ZdUpWA76QlP0IUui0ebzvkwv
 rhc9yJbl22Jc9u5B8pL674OoQSKUo4XO615c2TP1Rd0NK76hdr6uIYpwECOiDSib2K0V
 +4h5U/xzn5pocbHMml8MNmQKWbEOaJX2mtNJGrqTT41EzijUSm1ZqOCVlR5rW8MinYYA
 zaW1Fq1VwsYmX8ACwZL2qDlQKauKjI6/jAilQkUEYRaxY3Q8dD4CZQnKNUgzPb3msPo+
 LOew==
X-Gm-Message-State: AFuF++mlw+xHh8b+LWNebPaJQf6I27pnAhf6YGwwwJbBZBLHfnYjMT3b
 G9ioW4YyUIsMknIzCOI6Lk8WyEgp/qB/oYaQZKqu7lJF3+9SaOwNn3drMWNyvA==
X-Gm-Gg: AYBFou3o4ETAW+G4gtVSqqqjWw7m2+f8AAbV6nmpJ7kKwKk8cDuC+suwQG2LtuypYJg
 0XnHk495MrgX2dYWxkHAdjdsudvhXXBx302Ea7QExZO4G1lwYkpVd5niW2zzbGhq4YRs3eQJBYZ
 bDUKB4tWl4bZ27bmrf4c+J0Ij91MNkWSQ//9/MFS9BAVHbWxrdgvki/f3zMwTVANgUlLFA8xnuS
 nCAUBlDluzJvEIGpo+j7PgCpBlB1CM/czEFnIxjqOmCKSqYGCM4LodpO1yXhiBiF3oy6a8+Sm+m
 kp3nMclrgJNLqLgYDYQz6bwHZnFSYlNAkNg0Cdc4TcNLmqt2mcDPIyFzdWkPynTJHDKwe8oSNPy
 f518MJsjKcCf0oxerw79fdVPKJdvpcy7d0efSb03vZnO2Afh8Gc6GhADrM9wp3Cy0LoUMYTkkrZ
 gQXAmSLgtC/OrLQRI37gXo/BiFHf4R0YAU2IGmZ2CGf3k0brGDE2vcN5xLWeKFnd4uSzUm1kM7c
 VGFkZ5jZzJ0apSNYz6vplLrWECsLf/KuAR31liJ9GuZvEnhLXSfN2H9/cg3bmj4H86vi7WXU4CG
 DTxP7Ak=
X-Received: by 2002:a05:6122:512:b0:5bd:71b1:d5c6 with SMTP id
 71dfb90a1353d-5c99ac67d45mr5488433e0c.4.1789600510970; 
 Wed, 16 Sep 2026 16:15:10 -0700 (PDT)
Received: from construct (201-93-59-40.dial-up.telesp.net.br. [201.93.59.40])
 by smtp.gmail.com with ESMTPSA id
 71dfb90a1353d-5c9a53b2ba1sm1137922e0c.8.2026.09.16.16.15.09
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 16 Sep 2026 16:15:10 -0700 (PDT)
From: Rahul Martim Juliato <rahuljuliato@HIDDEN>
X-Google-Original-From: Rahul Martim Juliato <rahul.juliato@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 32.0.50; treesit: cache failed language lookups too
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IB2cksfwAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAABhQTFRFDxIfFR9FMD+RM2CBkZPbZKPEn+Xt////lKVMgwAAAAFiS0dEAIgFHUgAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfqAhsDFwcfcr7WAAACY0lEQVRIx7VVWbLbMAwzBZG6/41LcJHXpl/Vm/G8OADBBWKOo44c//mM2yeoH7go/kqQG3zlucDxgwTzkwz9XVl+K8Z8igL5p4KYKbApCHDC5aGXn7EcD1KCkUl9154EtSJUJWwWIIJbZyLVIIgTguGdCobxQ4nLI3gRLECO9axcwgNYQi81yH5KhGXZ1oU7XSH3YUnQ488YsesOCWrwxYOAgAtW1ZCEZKxoNR4TCILXGnPbjJ65v8ZrbB4fbI02pUaelSjuDKboCS1LifMEg1HwaOpRvV/2Ylja5ekjafyFYU2AnGOTMagh5Qbrs6OngFxTkhFPxUYUZePl3iQnSB7Y+3gcvQocDSYeWOuDYorXZagzhioeqWVSH3ivfvS54/EcW8LvB2eTSJDtbtkJXeGTD/1FwCbMNI/pnC0CjYi3ej2HhDvOD121dGzGFyHgM+5DUnhLNc0lKm0OYptQsWPTJKPMMuil0rhU6+E51th4obJqinOMntOBM59pzlg0wmICoRc3ML5tgpzpODRdk02MQmaEL8YIhdEElJniQbvDRSh7DicV9qjmQFeFHA3mosS8EU6+8g2jV8dzc3jpTK0ZFwWObITvpXZv1MRJXDSOs6WskFcxVKqIlKPMJpzxp9I+udrjLx3tKfB9unHslNi/Wj9AZt8+mGEnnTmPIzMYM5ZENgp1XVghv+uN4/ZE7sf4gXJV9yvHJp1/7EvJlTlz
 pUspOFJt723pVYz9c2cpgHYfKSMXVz72TvL/rJqxL92+D2cGuelri9Nkc5wX6Hjf6cqEsoPptle/Vtllqb3eEPkHU2QXL+sLC8kAAAAASUVORK5CYII=
X-Debbugs-Cc: Yuan Fu <casouri@HIDDEN>,  =?utf-8?Q?St=C3=A9phane?= Marks
 <shipmints@HIDDEN>
X-PGP-Key: https://www.rahuljuliato.com/rahul_pub_key.asc
Date: Wed, 16 Sep 2026 20:15:07 -0300
Message-ID: <m27bkkkcuc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a00:1450:4864:3a::d;
 envelope-from=rahuljuliato@HIDDEN; helo=mail-vs2-x0d.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hi Yuan, This is a a follow-up to bug#81334. The language
 cache we installed there (commit 7eb0fd17e36) removes the repeated
 dlopen/dlsym
 and the ABI version check for languages that *are* installed, and it do [...]
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (rahuljuliato[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 FORGED_GMAIL_RCVD      'From' gmail.com does not match 'Received'
 headers
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

Hi Yuan,

This is a a follow-up to bug#81334.  The language cache we installed
there (commit 7eb0fd17e36) removes the repeated dlopen/dlsym and the ABI
version check for languages that *are* installed, and it does that well.
But it only caches successes: when a grammar is not installed,
treesit_load_language walks the whole candidate list again on every
single call, so code that asks about a missing language in a loop gets
none of the benefit.

The cost of a miss is not small.  On master (5c91443e85c7, macOS,
tree-sitter with ABI 13-15, treesit-extra-load-path nil):

  emacs -Q --batch --eval '(progn
    (require (quote treesit))
    (dolist (lang (quote (markdown nosuchlang)))
      (let ((t0 (float-time)))
        (dotimes (_ 1000) (treesit-language-available-p lang))
        (message "%s: %.4fs" lang (- (float-time) t0)))))'

  markdown:   0.0001s / 1000 calls   (cached hit)
  nosuchlang: 1.7857s / 1000 calls   (~1.8 ms per call)

As you already know, the reason is the candidate list built in
treesit_load_language_push_for_each_suffix: per load directory and per
entry of dynamic-library-suffixes it tries the plain name, the ".0" and
".0.0" variants, and one name per supported ABI version.  Here that is 6
names x 2 suffixes x 2 directories = 24 failing dynlib_open calls per
query, each one also consing an error string for the error list.  Every
element of treesit-extra-load-path adds 12 more.

Where this shows up in practice: a major mode that has to decide per
range, per redisplay or per parser creation whether an embedded language
is available.  I am about to work around it by hand in markdown-ts-mode
(bug#81150) by caching treesit-language-available-p results in the mode,
but the problem is not specific to that mode, and every mode that embeds
optional languages will need the same workaround.  It seems better to
solve it once in treesit.c.

What I would like to propose:

  - Cache negative results as well, keyed by the language symbol,
    alongside the existing positive entries.  treesit-language-
    available-p with DETAIL also needs the signal data, so the cached
    failure has to carry signal_symbol/signal_data; those are Lisp
    objects that would need to be protected from GC, unlike the interned
    symbols the current cache stores.

  - Unlike the positive entries, negative ones must be invalidatable,
    since a grammar can appear during the session.  The points I can
    see:

      * treesit-install-language-grammar, which should flush the entry
        (or the whole negative cache) after a successful install;
      * treesit-extra-load-path being changed, which could be handled by
        a variable watcher, or by making the path list part of the cache
        key;
      * user-emacs-directory being changed, same idea.

    A Lisp-visible flush function would also be useful on its own, for
    users who drop a grammar into place by hand, and for tests.

Positive entries can stay as they are, since we never unload a language.

Does this look like the right direction to you?  If so, I can prepare a
patch.  I would like your opinion on two points before writing it:
whether the negative cache should be keyed on the language symbol alone
plus a watcher on treesit-extra-load-path, or on the symbol plus the
effective search path, and whether you want the flush exposed as a
public function (treesit-forget-language?) or kept internal and called
only from treesit-install-language-grammar.

Thanks,

-- 
Rahul Martim Juliato




Acknowledgement sent to Rahul Martim Juliato <rahuljuliato@HIDDEN>:
New bug report received and forwarded. Copy sent to casouri@HIDDEN, shipmints@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to casouri@HIDDEN, shipmints@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#81879; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 13 Oct 2026 11:30:08 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.