GNU bug report logs - #80342
[PATCH] Add readline-ts-mode

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: Steven Allen <steven@HIDDEN>; Keywords: patch; dated Fri, 6 Feb 2026 21:31:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 80342) by debbugs.gnu.org; 12 Feb 2026 22:20:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 12 17:20:09 2026
Received: from localhost ([127.0.0.1]:56574 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vqf2d-0002TY-Ul
	for submit <at> debbugs.gnu.org; Thu, 12 Feb 2026 17:20:09 -0500
Received: from mout01.posteo.de ([185.67.36.65]:46453)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <philipk@HIDDEN>)
 id 1vqf2b-0002PQ-8T
 for 80342 <at> debbugs.gnu.org; Thu, 12 Feb 2026 17:20:06 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 1593E240027
 for <80342 <at> debbugs.gnu.org>; Thu, 12 Feb 2026 23:19:58 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017;
 t=1770934799; bh=qkkB0OGa9YwfleoCcx82Xk8yweExGEjeEvFqXaUYfuQ=;
 h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:From;
 b=kQ55ZVEslkaMF2jHXS7zr6SSTZLe57tiOi0TSWiaXmO9FK5NerFYP6TzPmF7Vfnmw
 oMjW/kw5GAm0GWQuKJpjPDYj12lOTX3TveYtZeEeCtxUsjTn1+gR5zd1u+/7UVwwKl
 EqRMwUJDGcvUcGgDCtjdBe/4kqIZx9PJm9RjmXZv0/+aAoUdcbGKOSK8yAxmEV8qF6
 SI3e/ldp2MVOMESwSaMpE8dLgqv3aIySXQrdUMLvBgqY0aSCZjma8zKUD78EkP2ZUS
 poRnz1sFdbO6Opy+RD7ZoEqpIh3BZsl/ZLd2X+uSTjb5Osd9mM7W+xUCslN7O/zusf
 UnBKHFrt62zYw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4fBqVP5z3Xz6tsb;
 Thu, 12 Feb 2026 23:19:57 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: Steven Allen <steven@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <87fr7cxr4t.fsf@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN> <87ikc8xw30.fsf@HIDDEN>
 <874insbd5f.fsf@HIDDEN> <87fr7cxr4t.fsf@HIDDEN>
OpenPGP: id=philipk@HIDDEN;
 url="https://keys.openpgp.org/vks/v1/by-email/philipk@HIDDEN";
 preference=signencrypt
Date: Thu, 12 Feb 2026 22:19:58 +0000
Message-ID: <87y0kxob8y.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>, Juri Linkov <juri@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 (---)

Steven Allen <steven@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
>> Steven Allen via "Bug reports for GNU Emacs, the Swiss army knife of
>> text editors" <bug-gnu-emacs@HIDDEN> writes:
>>
>>> Stefan Monnier <monnier@HIDDEN> writes:
>>>
>>>> As usual, I'd recommend we keep this out of Emacs's repository, i.e. in
>>>> GNU ELPA.
>>>
>>> I submitted it to Emacs core because:
>>>
>>> 1. Most tree-sitter modes seem to get submitted directly to Emacs core.
>>
>> There are a number of tree-sitter related packages on ELPA, so I don't
>> think there is anything wrong with that.
>>> 2. As a GNU project, it seemed fitting that Emacs should have a built-in
>>> major mode for inputrc files.
>>
>> I also think it should be fine, nevertheless I have added a few comments
>> below.
>
> I agree there's nothing wrong with putting this in ELPA and I'm happy to
> do so.

1+

>>> However, I'm happy to submit it to ELPA instead. 
>>>
>>>>>> Date: Fri, 06 Feb 2026 13:29:48 -0800
>>>>>> From:  Steven Allen via "Bug reports for GNU Emacs,
>>>>>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>>>>> 
>>>>>> The attached patch adds a tree-sitter based major mode for inputrc files
>>>>>> (~/.inputrc, /etc/inputrc, etc.).
>>>>>> 
>>>>>> - The upstream tree-sitter grammar is here:
>>>>>>   https://github.com/tree-sitter-grammars/tree-sitter-readline/
>>>>>> 
>>>>>> - There's an existing non-tree-sitter inputrc major-mode available on
>>>>>>   melpa here:
>>>>>>   https://github.com/nverno/inputrc-mode/blob/master/inputrc-mode.el
>>>>>
>>>>> Thanks.  I wonder if this mode's name should be inputrc-ts-mode
>>>>> instead.  Sean, Stefan, Juri, WDYT?
>>>
>>> I've attached a version that calls the mode `inputrc-ts-mode'. However,
>>> the upstream tree-sitter parser is called readline, so I have to use that
>>> name internally when referring to the tree-sitter language.
>>>
>>>>>> I've never submitted a major mode before and I'm hardly a tree-sitter
>>>>>> expert, so please let me know if I made any mistakes (e.g., do I list
>>>>>> myself as the maintainer?).
>>>>>
>>>>> If you are willing to be responsible for maintenance of this mode,
>>>>> then yes, please list yourself.
>>>
>>> I'm happy to.
>>> From beb03f368bbf944ac6090b839a7b83f1722a94ae Mon Sep 17 00:00:00 2001
>>> From: Steven Allen <steven@HIDDEN>
>>> Date: Fri, 6 Feb 2026 13:18:50 -0800
>>> Subject: [PATCH] Add inputrc-ts-mode
>>>
>>> * etc/NEWS: Mention the new mode.
>>> * lisp/progmodes/treesit-ts-mode.el: New major mode for inputrc files.
>>> ---
>>>  etc/NEWS                          |   6 +
>>>  lisp/progmodes/inputrc-ts-mode.el | 179 ++++++++++++++++++++++++++++++
>>>  2 files changed, 185 insertions(+)
>>>  create mode 100644 lisp/progmodes/inputrc-ts-mode.el
>>>
>>> diff --git a/etc/NEWS b/etc/NEWS
>>> index a7d2a0b8004..002e72692b3 100644
>>> --- a/etc/NEWS
>>> +++ b/etc/NEWS
>>> @@ -3514,6 +3514,12 @@ A major mode based on the tree-sitter library for editing "go.work"
>>>  files.  If tree-sitter is properly set-up by the user, it can be
>>>  enabled for files named "go.work".
>>>  
>>> +---
>>> +*** New major mode 'inputrc-ts-mode'.
>>> +A major mode based on the tree-sitter library for editing inputrc files.
>>> +See the Info node "(bash) Readline Init File" for more information on
>>> +this file format.
>>> +
>>>  ** New package 'lua-mode'.
>>>  The 'lua-mode' package from NonGNU ELPA is now included in Emacs.
>>>  
>>> diff --git a/lisp/progmodes/inputrc-ts-mode.el b/lisp/progmodes/inputrc-ts-mode.el
>>> new file mode 100644
>>> index 00000000000..4d5624e95a7
>>> --- /dev/null
>>> +++ b/lisp/progmodes/inputrc-ts-mode.el
>>> @@ -0,0 +1,179 @@
>>> +;;; inputrc-ts-mode.el --- tree-sitter support for inputrc files  -*- lexical-binding: t; -*-
>>> +
>>> +;; Copyright (C) 2026 Free Software Foundation, Inc.
>>> +
>>> +;; Author     : Steven Allen <steven@HIDDEN>
>>> +;; Maintainer : Steven Allen <steven@HIDDEN>
>>> +;; Created    : February 2026
>>> +;; Keywords   : readline inputrc languages tree-sitter
>>
>> Can you please remove the spaces before the colons?  Aligning the values
>> like this is really not a convention, it is just something that (some)
>> -ts-mode packages do for some reason.
>
> Done.

Thank you!

>>> +
>>> +;; This file is part of GNU Emacs.
>>> +
>>> +;; GNU Emacs is free software: you can redistribute it and/or modify
>>> +;; it under the terms of the GNU General Public License as published by
>>> +;; the Free Software Foundation, either version 3 of the License, or
>>> +;; (at your option) any later version.
>>> +
>>> +;; GNU Emacs is distributed in the hope that it will be useful,
>>> +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> +;; GNU General Public License for more details.
>>> +
>>> +;; You should have received a copy of the GNU General Public License
>>> +;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
>>> +
>>> +;;; Commentary:
>>> +
>>> +;; Major mode for editing inputrc (GNU readline RC) files, powered by
>>> +;; tree-sitter.
>>> +
>>> +;;; Code:
>>> +
>>> +(require 'treesit)
>>> +(eval-when-compile (require 'rx))
>>> +(treesit-declare-unavailable-functions)
>>> +
>>> +(add-to-list
>>> + 'treesit-language-source-alist
>>> + '(readline "https://github.com/tree-sitter-grammars/tree-sitter-readline"
>>> +            :commit "74addc90fc539d31d413c0c7cf7581997a7fa46e")
>>> + t)
>>> +
>>> +(defcustom inputrc-ts-mode-indent-offset 2
>>> +  "Number of spaces for each indentation step in `inputrc-ts-mode'."
>>> +  :version "31.1"
>>> +  :type 'natnum
>>> +  :safe 'natnump
>>> +  :group 'inputrc)
>>
>> Where is this group defined?
>
> Fixed. Note: failure to define groups seems to be a pervasive issue in
> major modes (especially tree-sitter modes).

If you ask me, there are a number of code-style issues in tree-sitter
modes that have been annoying me, and the fact that many are just
re-using each-other as a template doesn't help.  Hopefully
`define-treesit-generic-mode' will help!

Also, if you add the `defgroup' at the beginning of the file, you can
drop the remaining :group declarations (they default to the last
declared group).

[...]

>>> +;;;###autoload
>>> +(define-derived-mode inputrc-ts-mode prog-mode "Inputrc"
>>> +  "Major mode for editing inputrc files, powered by tree-sitter."
>>> +  :group 'inputrc
>>> +  :syntax-table inputrc-ts-mode--syntax-table
>>> +  (setq-local
>>> +   comment-start "# "
>>> +   comment-end "")
>>> +  (when (treesit-ensure-installed 'readline)
>>> +    (setq-local
>>> +     treesit-primary-parser (treesit-parser-create 'readline)
>>> +     treesit-simple-indent-rules inputrc-ts-mode--indent-rules
>>> +     treesit-font-lock-settings inputrc-ts-mode--font-lock-settings
>>> +     treesit-font-lock-feature-list inputrc-ts-mode--font-lock-feature-list)
>>> +    (treesit-major-mode-setup)))
>>> +
>>> +(derived-mode-add-parents 'inputrc-ts-mode '(inputrc-mode))
>>
>> Where is inputrc-mode defined?  I do not know of anything in the core,
>> and don't find anything in ELPA.
>
> It's in MELPA: https://melpa.org/#/inputrc-mode

Hmm, that is not great.  We should add it to NonGNU or GNU ELPA before
merging this package, just to not run into runtime issues.

>>> +;;;###autoload
>>> +(defun inputrc-ts-mode-maybe ()
>>> +  "Enable `inputrc-ts-mode' when its grammar is available.
>>> +Also propose to install the grammar when `treesit-enabled-modes'
>>> +is t or contains the mode name."
>>> +  (declare-function treesit-language-available-p "treesit.c")
>>> +  (if (or (treesit-language-available-p 'readline)
>>> +          (eq treesit-enabled-modes t)
>>> +          (memq 'inputrc-ts-mode treesit-enabled-modes))
>>> +      (inputrc-ts-mode)
>>> +    (fundamental-mode)))
>>
>> Why not check if "inputrc-mode" is available?
>
> Convention. None of the other tree-sitter modes fallback on their base modes.

Does that convention really make sense?  Or is it because the core-modes
wouldn't want to rely on an external package existing.  I think it is
entirely reasonable to do a `fboundp' check for the major mode and then
fall back onto that.

>>> +
>>> +;;;###autoload
>>> +(when (boundp 'treesit-major-mode-remap-alist)
>>> +  (add-to-list 'auto-mode-alist
>>> +               '("/\\.?inputrc\\'" . inputrc-ts-mode-maybe))
>>
>> Can you not pull out this modification to `auto-mode-alist'?  Or how
>> does it depend on `treesit-major-mode-remap-alist'?
>
> I think I could pull it out, but every other tree-sitter mode (that I
> can find) adds to `auto-mode-alist' in inside that condition.

Trying to understand the convention, I think that if you fall back to
the other mode if tree-sitter is not available and the non-TS mode is,
then that should be fine.

>>> +  (add-to-list 'treesit-major-mode-remap-alist
>>> +               '(inputrc-mode . inputrc-ts-mode)))
>>> +
>>> +(provide 'inputrc-ts-mode)
>>> +
>>> +;;; inputrc-ts-mode.el ends here




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

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


Received: (at 80342) by debbugs.gnu.org; 12 Feb 2026 16:08:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 12 11:08:42 2026
Received: from localhost ([127.0.0.1]:50342 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vqZF7-0008LD-Vt
	for submit <at> debbugs.gnu.org; Thu, 12 Feb 2026 11:08:41 -0500
Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]:58359)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <steven@HIDDEN>)
 id 1vqZF4-0008Kg-JL
 for 80342 <at> debbugs.gnu.org; Thu, 12 Feb 2026 11:08:36 -0500
Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46])
 by mailfhigh.phl.internal (Postfix) with ESMTP id 63B8F1400087;
 Thu, 12 Feb 2026 11:08:29 -0500 (EST)
Received: from phl-frontend-03 ([10.202.2.162])
 by phl-compute-06.internal (MEProxy); Thu, 12 Feb 2026 11:08:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com;
 h=cc:cc:content-type:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to; s=fm2; t=1770912509; x=
 1770998909; bh=j4Ov02S6TbvPioFLLMksoIeY3tOAXPJCWwLWLV3akb8=; b=I
 Or7xkQ+wHrQzHvKZjOoXNPS0E+Jpg7c2s5eiWgMmf2qUIq17hVpPX0GxC+y/unC2
 +8YeQi4lAeKCMmBEjh/zxcLPLmlHQCQUq7Xbh3QZjljMSMF5AZTJDa/gqDP4/CzI
 1JLa9WjdpEcOfwjHS6ig2T6Ylb4yk/aNlQNY4GeSr1svV/WGDa867c8HAXyLT6IM
 0/bySIHiOF9wGfoed0y//GZ2uuBqNUxt5XPs9RI2f0CBaPwd4DrJWnIaOVykl7SU
 Jf70xkhwg2NOihLmGvMk77T/+nFFymvims9UlUheBDUNXYPMNtc/wCsm7P9HonXx
 9729Le+rvgS75GBblM5bw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
 1770912509; x=1770998909; bh=j4Ov02S6TbvPioFLLMksoIeY3tOAXPJCWwL
 WLV3akb8=; b=BKXt4B5puaFg44mDaP+NJkm9r8HxN0FctE7pZyThRVyNeIVbpMI
 TcI8uLk7U33iQNrFfMB2GFCBMo0lcBKDLzHTmjizmTrm48d/U/aA/Aw+idIMG9fZ
 //fgV/ei3elGy21fzSU32kProe2Un6dZC71ud/EWgB3wDHdqhHrXRgWFtdDryTPE
 xD6Q+J4rsfcWf6C/ybtyGnmY2ReEDCFtYb1w2zTe4PJG01bsiyoA25h1TL18GsMP
 OGlynVZs+wgMGrLfkJRksy32l2LqY2p7WRMlxxuKzhtuG9hlBY2oBvbNmb+XV+g2
 KwUQvANr6a25oySrdTBWGgM4z+L2PSfTxLg==
X-ME-Sender: <xms:_fqNacrlxzE20cKFWu0-mDO2Mcm6LvgdBQxfvzUtMLUVMZRU_Pm6rQ>
 <xme:_fqNaTYiPjPZNA03IDzS2odnEoOKn7oEsNuDru2IT2rN9bBUg48XLjQL1NVPqSqAN
 vUtdVTF26MclSdXs-vNBFhfYvUXZzgjvskQmWpuAEU1nqPAiB2wStM>
X-ME-Received: <xmr:_fqNadUzKZHe6u0K7iE5fjkd08a6mn4lzJiWgh0U1LtQtRXM99rzSL56>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvtdehkeduucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
 gurhephffvvefujghffffkgggtsehttdertddttddtnecuhfhrohhmpefuthgvvhgvnhcu
 tehllhgvnhcuoehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomheqnecuggftrfgrth
 htvghrnhepvdekheekgeelheehgefgudelkeethffhgfeuffetkeegtddvfeduuddttdej
 jedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsh
 htvghvvghnsehsthgvsggrlhhivghnrdgtohhmpdhnsggprhgtphhtthhopeeipdhmohgu
 vgepshhmthhpohhuthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtth
 hopehphhhilhhiphhksehpohhsthgvohdrnhgvthdprhgtphhtthhopehmohhnnhhivghr
 sehirhhordhumhhonhhtrhgvrghlrdgtrgdprhgtphhtthhopeektdefgedvseguvggssg
 hughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjhhurhhisehlihhnkhhovhdrnhgvthdp
 rhgtphhtthhopehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg
X-ME-Proxy: <xmx:_fqNaU_mgF_6qCoYfvTzQx8D32HVod84rVbgTTA9wjDSdIevQQ7C3w>
 <xmx:_fqNae8Nb0oPue3_enoUBgC6_BJhkU6Aw2JvmkRn5Df2ENrKWrJPow>
 <xmx:_fqNacSEZX1XP7eJY2nLia8A8_iwhCdcLzmSmCKptj_jgqzW1-ggZw>
 <xmx:_fqNaacN4YQk8LgmYvUoZZ7MQCqQZwndiTcCrfjZz-kGxzt-VXFj5Q>
 <xmx:_fqNaQLCHEOf3LbTm0B7UnOjanpd1rC2eyTi7cIirQi0aSL8MUnyom0L>
Feedback-ID: ie8a146a7:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 12 Feb 2026 11:08:28 -0500 (EST)
From: Steven Allen <steven@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <86tsvmrwyg.fsf@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN> <87ikc8xw30.fsf@HIDDEN>
 <874insbd5f.fsf@HIDDEN> <87fr7cxr4t.fsf@HIDDEN>
 <86tsvmrwyg.fsf@HIDDEN>
Date: Thu, 12 Feb 2026 08:08:26 -0800
Message-ID: <87a4xeeyh1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, philipk@HIDDEN, spwhitton@HIDDEN,
 monnier@HIDDEN, juri@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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Steven Allen <steven@HIDDEN>
>> Cc: Stefan Monnier <monnier@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
>>  80342 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>, Sean Whitton
>>  <spwhitton@HIDDEN>
>> Date: Sat, 07 Feb 2026 11:58:26 -0800
>> 
>> Philip Kaludercic <philipk@HIDDEN> writes:
>> 
>> >> +;;;###autoload
>> >> +(when (boundp 'treesit-major-mode-remap-alist)
>> >> +  (add-to-list 'auto-mode-alist
>> >> +               '("/\\.?inputrc\\'" . inputrc-ts-mode-maybe))
>> >
>> > Can you not pull out this modification to `auto-mode-alist'?  Or how
>> > does it depend on `treesit-major-mode-remap-alist'?
>> 
>> I think I could pull it out, but every other tree-sitter mode (that I
>> can find) adds to `auto-mode-alist' in inside that condition.
>
> Where did you see additions to auto-mode-alist conditioned on
> treesit-major-mode-remap-alist?  I see additions to
> treesit-major-mode-remap-alist conditioned on that, but not additions
> to auto-mode-alist.

rust-ts-mode, yaml-ts-mode, markdown-ts-mode, python-ts-mode,
cmake-ts-mode, heex-ts-mode, go-ts-mode, go-mod-ts-mode,
go-work-ts-mode, docker-ts-mode, elixer-ts-mode, php-ts-mode,
typescript-ts-mode, tsx-ts-mode




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

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


Received: (at 80342) by debbugs.gnu.org; 12 Feb 2026 12:03:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 12 07:03:19 2026
Received: from localhost ([127.0.0.1]:44620 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vqVPe-0005JN-Mb
	for submit <at> debbugs.gnu.org; Thu, 12 Feb 2026 07:03:19 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:46370)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vqVPb-0005Iw-CM
 for 80342 <at> debbugs.gnu.org; Thu, 12 Feb 2026 07:03:12 -0500
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 1vqVPT-0001xE-G6; Thu, 12 Feb 2026 07:03:03 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=560cnTjl1jwhbPICFch+oGDcPRyIz3kFJhX01PHVAYM=; b=Z+VG1C9ihI8e
 AZzB7zwFGES9y501DO4zk+cJJbeauTm6idriAOgzLQFwNfDvndZ1dtf2KnvCr0apf2zus5MxlpVmn
 ADkhQBIP1YM41PVHj9kGXtZ7xhx2Ye0rNDJRNwlCo0NYv0oSO7o0DZcOfG9KJezNnWpetk2EOm0g6
 VNNzMfAiIhOQbKgyNZh9jjevRRuQ+2SPtVEgcaf2JerRZzQKHDg92JosrUfbNlSP0Zpo4iwLBznPi
 B7y32gmSGYjb9DVHZMPEDgrZ3Csdsbmd1Ue2tX3AqkBoarVm9Tx6F2XjzCiIguDcCpV73z31L/kMz
 JzZgRcX3AGKoIt2ptR58wA==;
Date: Thu, 12 Feb 2026 14:02:47 +0200
Message-Id: <86tsvmrwyg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Steven Allen <steven@HIDDEN>
In-Reply-To: <87fr7cxr4t.fsf@HIDDEN> (message from Steven Allen on Sat, 
 07 Feb 2026 11:58:26 -0800)
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN> <87ikc8xw30.fsf@HIDDEN>
 <874insbd5f.fsf@HIDDEN> <87fr7cxr4t.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, philipk@HIDDEN, spwhitton@HIDDEN,
 monnier@HIDDEN, juri@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: -1.0 (-)

> From: Steven Allen <steven@HIDDEN>
> Cc: Stefan Monnier <monnier@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
>  80342 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>, Sean Whitton
>  <spwhitton@HIDDEN>
> Date: Sat, 07 Feb 2026 11:58:26 -0800
> 
> Philip Kaludercic <philipk@HIDDEN> writes:
> 
> >> +;;;###autoload
> >> +(when (boundp 'treesit-major-mode-remap-alist)
> >> +  (add-to-list 'auto-mode-alist
> >> +               '("/\\.?inputrc\\'" . inputrc-ts-mode-maybe))
> >
> > Can you not pull out this modification to `auto-mode-alist'?  Or how
> > does it depend on `treesit-major-mode-remap-alist'?
> 
> I think I could pull it out, but every other tree-sitter mode (that I
> can find) adds to `auto-mode-alist' in inside that condition.

Where did you see additions to auto-mode-alist conditioned on
treesit-major-mode-remap-alist?  I see additions to
treesit-major-mode-remap-alist conditioned on that, but not additions
to auto-mode-alist.




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

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


Received: (at 80342) by debbugs.gnu.org; 8 Feb 2026 18:50:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 08 13:49:59 2026
Received: from localhost ([127.0.0.1]:54815 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vp9r5-0004Xj-KM
	for submit <at> debbugs.gnu.org; Sun, 08 Feb 2026 13:49:59 -0500
Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:41030)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vp9r3-0004XQ-1N
 for 80342 <at> debbugs.gnu.org; Sun, 08 Feb 2026 13:49:57 -0500
Received: from smtp2.mailbox.org (smtp2.mailbox.org
 [IPv6:2001:67c:2050:b231:465::2])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4f8H1l1hPrz9th0;
 Sun,  8 Feb 2026 19:49:47 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1770576587;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=B+GOrCXOjwcTKKeibr1HXlrsqgjZh7+BQ+i2ej41vrA=;
 b=O8zTL6dppgTLtdA8bcJArWd/qogypKWssd+1/VHYe5GhW542ccPgL+94dUPMwETwjvvg8q
 A3e/bY5qgTSnyWjdoG1xtzdBPFN2XwTt8aviWm/SiKowZAT/T6B9hG8UApXIqZ88nftnDI
 SE/WE/UlgaGro7g8Tbj2q2efpE7E00lhz42wocZJPRFP9xbw/s5qnCGaUG9CIf/QpckTYg
 YQCEkbMavkIPO57P53d7zSyDVzYGIiSXlVCkUZwdNptgdiOQSQQrfXy5MqXyDECr+YSGXm
 H2FwkBGzXwEjS0ZrRhyI3zgykxLj8zkTqyI3V1w6p8LdGfyhHRzHJ5ObUdTRuQ==
Authentication-Results: outgoing_mbo_mout; dkim=none;
 spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
 2001:67c:2050:b231:465::2 as permitted sender) smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
To: Steven Allen <steven@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <87bji0xpzj.fsf@HIDDEN>
Organization: LINKOV.NET
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <877bso1ieq.fsf@HIDDEN> <87bji0xpzj.fsf@HIDDEN>
Date: Sun, 08 Feb 2026 20:49:25 +0200
Message-ID: <87h5rrjcju.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4f8H1l1hPrz9th0
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Sean Whitton <spwhitton@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: -1.7 (-)

>> I believe it could be defined by just 'define-treesit-generic-mode'
>> in treesit-x.el.
>
> Unfortunately, `treesit-x' doesn't play well with distro-packaged
> tree-sitter grammars.

That's a problem that needs to be addressed anyway.

> - It only looks in a specific directory within user-emacs-directory.
>
> - Arch Linux doesn't even package the queries. This is fixable, but
>   requires working with the Arch Linux packagers.
>
> - NixOS packages the queries, but doesn't make them easily discoverable
>   by Emacs. Also fixable, but requires submitting some PRs to NixOS.

Maybe the 'queries' files could be included in Emacs?




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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 20:25:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 15:25:55 2026
Received: from localhost ([127.0.0.1]:39307 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1voosM-0003g7-Pm
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 15:25:55 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29133)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1voosK-0003fr-8F
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 15:25:52 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 93AE21000BC;
 Sat,  7 Feb 2026 15:25:45 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1770495944;
 bh=3pit+7+WT0XmS80vJjxrd+WKwF3MVNsanlQiMC/uQK0=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=d7TqYrujWnGk/iECH3XIBCdKx8R8uwQF+lKar/jkrlRxryYi94tq2Qf12UZpho6JE
 Efd3bKJONkcf20+znFlmLV0XXUUEHwlh5bqp3CBXrBWr40OCPyhvsaCvLRxknRMjyr
 9/0tPlMAmWJzdSHbA3NR6/RiyyrNoUcdhGKsd+szVpmjnEv5U3bgVvGJpawQMx3SnT
 ov1GI8C2I+qxLo+g1PJH6j+ov5hx1qF1UiFjHsQzjqVbutJj7F5MlXezUrNB2ytGCh
 haejOF1cVeusL/YQpV/TUtxkOWniU6uQIuwCN9/IZdU7qu6urFITRdrkQnLM97esmT
 BaBcgQBOUF0OA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EE8B010002D;
 Sat,  7 Feb 2026 15:25:43 -0500 (EST)
Received: from pastel (104-195-243-38.cpe.teksavvy.com [104.195.243.38])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B3CE512097B;
 Sat,  7 Feb 2026 15:25:43 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Steven Allen <steven@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <87ikc8xw30.fsf@HIDDEN>
Message-ID: <jwvcy2g71hw.fsf-monnier+emacs@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN> <87ikc8xw30.fsf@HIDDEN>
Date: Sat, 07 Feb 2026 15:25:41 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.187 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80342
Cc: Eli Zaretskii <eliz@HIDDEN>, Juri Linkov <juri@HIDDEN>,
 80342 <at> debbugs.gnu.org, Sean Whitton <spwhitton@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 (---)

>> As usual, I'd recommend we keep this out of Emacs's repository, i.e. in
>> GNU ELPA.
> I submitted it to Emacs core because:
> 1. Most tree-sitter modes seem to get submitted directly to Emacs core.

Yes, I consider this to be a bad practice we got into because back when
we first added tree-sitter support, we bundled some modes to "get the
ball rolling".

> 2. As a GNU project, it seemed fitting that Emacs should have a built-in
> major mode for inputrc files.

Right, but that needs to be weighed against the
administrative burden on both sides.

Note: AFAIK I'm not the only one with this opinion, but I also know this
does not reflect a general consensus.


=== Stefan





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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 20:23:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 15:23:22 2026
Received: from localhost ([127.0.0.1]:39267 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1voopt-0003QP-Lg
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 15:23:22 -0500
Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]:56877)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <steven@HIDDEN>)
 id 1voopr-0003QB-Jm
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 15:23:20 -0500
Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44])
 by mailfout.phl.internal (Postfix) with ESMTP id 59ECEEC008A;
 Sat,  7 Feb 2026 15:23:14 -0500 (EST)
Received: from phl-frontend-04 ([10.202.2.163])
 by phl-compute-04.internal (MEProxy); Sat, 07 Feb 2026 15:23:14 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com;
 h=cc:cc:content-type:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to; s=fm2; t=1770495794; x=
 1770582194; bh=pli6jC3L9W827ds1XSEFAxsjcTMPq9HjGobeVp7tepg=; b=N
 cPNWrRmwE4wlYvFJh+pMEcoH7A6v6Z+/zjlQnAuoxwaJMvRZ1yhNzDjqEMoj9K4W
 jWwWZ1vsPmXVe+7dzNJIhbwNt4zvrsC7UEO0R+JGobr5KdRZKGYM3kukYJTe2YoV
 qzNT6ECZOAChmycXl5AUHrMVQoerILEJWdQ4Yeaxez1DNQ160R/+syIfxl8g87B/
 CrVVmw+B7+lZCrIKPSc6zYE3+aMJ+wuHTliKiFlOae88WTuEGweU9Ax5DedNMI+A
 wEUEePydg+KU167xoCPQhuop9p6LjfPwI9C7F/OvYXfQ4wz0N+nqpJNeWSEZ5XAA
 lhcstvFFSIs4VhvdkxLpg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
 1770495794; x=1770582194; bh=pli6jC3L9W827ds1XSEFAxsjcTMPq9HjGob
 eVp7tepg=; b=IHgDF44Q65+pQKC9Hl94f9CdSHaoGfz+dUU796KOyT5214/Nubj
 TRbupUt1NW3qeismb6jZrN3ggJ4mabaTF0CgmLxn1a8ABdo4+yw0zB8sS/XCyjmB
 XV/YJNMCiSsrgqK4Z9sNwZQ90PhI0FXfHmn2wt4/Z4FGgsoUQhq7kVGchSrnzrhQ
 lsDK6bPT9Ll23lr+6egcyhnupefa94roXIVXgjS8TNGUQk6J6NYcK6FaWGpJUrOf
 ZYF+tR2a/fChBNkvuCVSjHVS02NxKJQ7Q+OHmy/HV+8Jhg3ODS5oB0e22nciufQr
 2Qxmcg/mKaZTKNsrhvUs6/QTA8NxYDje4Ig==
X-ME-Sender: <xms:Mp-HaRlYZSncRaNNX_fhy0SQIsf_GbZ5HRU5SFuQhrseInVu4e5IAA>
 <xme:Mp-HaeUi-hcUlJblVKCH5d738RAk4K_-4JH_s0jg7MNdAHqTorTup6EpmTzPl3h_7
 qkXOmXuB6QMqS1Fh4RvzWUjFDWqnw2lgvGR-sRw2PJZXgUFxxKizw>
X-ME-Received: <xmr:Mp-HaXtWDOd63ktAn5IDDAdQZvEpdvdelNt3vx-ga4FiyvclEuPozUWvd8By>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduledvtddtucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
 gurhephffvvefujghffffkgggtsehttdertddttddtnecuhfhrohhmpefuthgvvhgvnhcu
 tehllhgvnhcuoehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomheqnecuggftrfgrth
 htvghrnhepvdekheekgeelheehgefgudelkeethffhgfeuffetkeegtddvfeduuddttdej
 jedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsh
 htvghvvghnsehsthgvsggrlhhivghnrdgtohhmpdhnsggprhgtphhtthhopeehpdhmohgu
 vgepshhmthhpohhuthdprhgtphhtthhopehjuhhriheslhhinhhkohhvrdhnvghtpdhrtg
 hpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepshhpfihhihhtthhonhes
 shhpfihhihhtthhonhdrnhgrmhgvpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruh
 hmohhnthhrvggrlhdrtggrpdhrtghpthhtohepkedtfeegvdesuggvsggsuhhgshdrghhn
 uhdrohhrgh
X-ME-Proxy: <xmx:Mp-HaRauU918chX0UtcHHN4e0Y34OV8XHpYvWvVIi02gTWy7ScGLEg>
 <xmx:Mp-HaWUrilEMvaOUeDzgK_kFUua4-8syvS8iVeJoHVNknTTRhxXYiA>
 <xmx:Mp-HaWR5Xml556XFCSsOR-9mjZ2nnR_xjBpi_q7bJ4FoXyQ1McyFRA>
 <xmx:Mp-HaUPiPKfjS3ArxrM81nKlAz0r9EvPAQfCRL_VGxS5RhJRladAOg>
 <xmx:Mp-HabhWiyt2mYBs2cQZQT7exFgptKrkcwvHRJ2KOjWL_Vtx0-59KLPi>
Feedback-ID: ie8a146a7:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 7 Feb 2026 15:23:13 -0500 (EST)
From: Steven Allen <steven@HIDDEN>
To: Juri Linkov <juri@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <877bso1ieq.fsf@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <877bso1ieq.fsf@HIDDEN>
Date: Sat, 07 Feb 2026 12:23:12 -0800
Message-ID: <87bji0xpzj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Sean Whitton <spwhitton@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: -1.7 (-)

Juri Linkov <juri@HIDDEN> writes:

>> Thanks.  I wonder if this mode's name should be inputrc-ts-mode
>> instead.  Sean, Stefan, Juri, WDYT?
>
> I believe it could be defined by just 'define-treesit-generic-mode'
> in treesit-x.el.

Unfortunately, `treesit-x' doesn't play well with distro-packaged
tree-sitter grammars.

- It only looks in a specific directory within user-emacs-directory.

- Arch Linux doesn't even package the queries. This is fixable, but
  requires working with the Arch Linux packagers.

- NixOS packages the queries, but doesn't make them easily discoverable
  by Emacs. Also fixable, but requires submitting some PRs to NixOS.
 




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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 19:58:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 14:58:41 2026
Received: from localhost ([127.0.0.1]:39045 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vooS0-0001nh-8Y
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 14:58:41 -0500
Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]:43887)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <steven@HIDDEN>)
 id 1vooRw-0001nP-9Z
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 14:58:38 -0500
Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42])
 by mailfout.phl.internal (Postfix) with ESMTP id 8A623EC00CF;
 Sat,  7 Feb 2026 14:58:30 -0500 (EST)
Received: from phl-frontend-04 ([10.202.2.163])
 by phl-compute-02.internal (MEProxy); Sat, 07 Feb 2026 14:58:30 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com;
 h=cc:cc:content-type:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to; s=fm2; t=1770494310; x=
 1770580710; bh=OYdeAkdNEF8DFfaSr/4HIjgFPRXa5sDot1I171CoHoE=; b=l
 bhR/JAhBi5Vc4h60MsqtG/X1mrl/8u4nHecyV4wQLPPajiCby59tuy2ocW3ywmcO
 DMxq98P7ZEZvoD9cAA1IyIlw2juM4XR7FyqGzhc5G59rzpHoTl9gW7sP0o7CoPkk
 ooHHpKMmwXKH9oVJV0mCO63Qh/uqxMWGZlLS8qh0jyIIhWyDrO0BuqSCqlcEwx65
 ZzREt9DxZRnqEVYdwR6Xa/IKV0tHFaZt5ARQ5GZBmwm6fHf3l9dfCiLQKdRvDPzT
 yWS8BXZStSP7Z+PofM1VAEV+oLnP5p9RkoBpC5qmClhcw/2y/pntddfs68WvNjSr
 h2mme2LuCQT/sMlotXBCQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
 1770494310; x=1770580710; bh=OYdeAkdNEF8DFfaSr/4HIjgFPRXa5sDot1I
 171CoHoE=; b=GwkITrnRp4a1GMDHq/F2aYpC96vvh8T3+0Udoqz4OHI1wDAejhi
 bR0QmIGA0KQfWqNjJIlY4NbVUrqZsFcD5h4zms50gevhDKNyBgkI1Ql3NgXAABU4
 nDdPJi5B6fioALgtU6Crpld84IWiAZ1TSGsHWpQol8REYF5zjzvkkgu/fkll4A2n
 Rso3CO69EPsSHKlNHWwDaHBkzdBMR/qnTLkCdb3tb2BqIL9Zb23cwhGL8ERZDqrV
 P/QLoA86ZBQ782OrY4LcIHqHcgsuKRmtTGZ1Dh660TGlc7fOhezqx19uU0rYGPqa
 nHDmfW8ScC5dHlL5j4rFhu2JwbEjOUsUJgw==
X-ME-Sender: <xms:ZpmHaec3beG8jMjxdPn8t9xkFOjCNnQ_nNUfNEmngmit2A5cESg7Gw>
 <xme:ZpmHaRjHm9qVyBX0583MYm9mvbZeaFcUhC5hsnZPPT6LrTb8cqYISXNb7JWumt1OW
 j4FLOgmKnSVHEEHTFqxaobRwuCpo1uMx51B7oQkQcOzIyJTy3yF>
X-ME-Received: <xmr:ZpmHaWwkycmLhtJhozSSsnerns1XfJHCbaUu7VixAg_yO3w8KJWuB_cLQUoh>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduleduleehucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
 gurhephffvvefujghffffkgggtsehmtderredttddtnecuhfhrohhmpefuthgvvhgvnhcu
 tehllhgvnhcuoehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomheqnecuggftrfgrth
 htvghrnhepvdekleeukeefffefjeffheeiieejueffueekledtleekgeethfdtgefhuddv
 vefhnecuffhomhgrihhnpehgihhthhhusgdrtghomhdpghhnuhdrohhrghdpmhgvlhhprg
 drohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm
 pehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomhdpnhgspghrtghpthhtohepiedpmh
 houggvpehsmhhtphhouhhtpdhrtghpthhtohepphhhihhlihhpkhesphhoshhtvghordhn
 vghtpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggrpd
 hrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepkedtfeegvdesuggv
 sggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehjuhhriheslhhinhhkohhvrdhnvg
 htpdhrtghpthhtohepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv
X-ME-Proxy: <xmx:ZpmHadOoHWzdc1mDRxCea-0btdieVuq7814fPR4YmJ5vXi64ElxZMg>
 <xmx:ZpmHaXXq2lg54XcXKMLRgHjvixDLPH-0zznScYoyWVTTz8QVkYeAPQ>
 <xmx:ZpmHaR32hBxg3AUY9DYRTyjfVnXdFvwrl49gn5mE41fKlJkpaRbjRQ>
 <xmx:ZpmHaVq0uo3wXpWCy5EOdpT1t6e1X7JnNJj2fh5PmcTj11rGKn8JXg>
 <xmx:ZpmHaXoESnLY4wiq4rDcvjZWQITTX7C2P5_XTJ5Nd9-Gp6ux26elKliv>
Feedback-ID: ie8a146a7:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 7 Feb 2026 14:58:29 -0500 (EST)
From: Steven Allen <steven@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <874insbd5f.fsf@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN> <87ikc8xw30.fsf@HIDDEN>
 <874insbd5f.fsf@HIDDEN>
Date: Sat, 07 Feb 2026 11:58:26 -0800
Message-ID: <87fr7cxr4t.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>, Juri Linkov <juri@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: -1.7 (-)

--=-=-=
Content-Type: text/plain

Philip Kaludercic <philipk@HIDDEN> writes:

> Steven Allen via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> Stefan Monnier <monnier@HIDDEN> writes:
>>
>>> As usual, I'd recommend we keep this out of Emacs's repository, i.e. in
>>> GNU ELPA.
>>
>> I submitted it to Emacs core because:
>>
>> 1. Most tree-sitter modes seem to get submitted directly to Emacs core.
>
> There are a number of tree-sitter related packages on ELPA, so I don't
> think there is anything wrong with that.
>> 2. As a GNU project, it seemed fitting that Emacs should have a built-in
>> major mode for inputrc files.
>
> I also think it should be fine, nevertheless I have added a few comments
> below.

I agree there's nothing wrong with putting this in ELPA and I'm happy to
do so.

>> However, I'm happy to submit it to ELPA instead. 
>>
>>>>> Date: Fri, 06 Feb 2026 13:29:48 -0800
>>>>> From:  Steven Allen via "Bug reports for GNU Emacs,
>>>>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>>>> 
>>>>> The attached patch adds a tree-sitter based major mode for inputrc files
>>>>> (~/.inputrc, /etc/inputrc, etc.).
>>>>> 
>>>>> - The upstream tree-sitter grammar is here:
>>>>>   https://github.com/tree-sitter-grammars/tree-sitter-readline/
>>>>> 
>>>>> - There's an existing non-tree-sitter inputrc major-mode available on
>>>>>   melpa here:
>>>>>   https://github.com/nverno/inputrc-mode/blob/master/inputrc-mode.el
>>>>
>>>> Thanks.  I wonder if this mode's name should be inputrc-ts-mode
>>>> instead.  Sean, Stefan, Juri, WDYT?
>>
>> I've attached a version that calls the mode `inputrc-ts-mode'. However,
>> the upstream tree-sitter parser is called readline, so I have to use that
>> name internally when referring to the tree-sitter language.
>>
>>>>> I've never submitted a major mode before and I'm hardly a tree-sitter
>>>>> expert, so please let me know if I made any mistakes (e.g., do I list
>>>>> myself as the maintainer?).
>>>>
>>>> If you are willing to be responsible for maintenance of this mode,
>>>> then yes, please list yourself.
>>
>> I'm happy to.
>> From beb03f368bbf944ac6090b839a7b83f1722a94ae Mon Sep 17 00:00:00 2001
>> From: Steven Allen <steven@HIDDEN>
>> Date: Fri, 6 Feb 2026 13:18:50 -0800
>> Subject: [PATCH] Add inputrc-ts-mode
>>
>> * etc/NEWS: Mention the new mode.
>> * lisp/progmodes/treesit-ts-mode.el: New major mode for inputrc files.
>> ---
>>  etc/NEWS                          |   6 +
>>  lisp/progmodes/inputrc-ts-mode.el | 179 ++++++++++++++++++++++++++++++
>>  2 files changed, 185 insertions(+)
>>  create mode 100644 lisp/progmodes/inputrc-ts-mode.el
>>
>> diff --git a/etc/NEWS b/etc/NEWS
>> index a7d2a0b8004..002e72692b3 100644
>> --- a/etc/NEWS
>> +++ b/etc/NEWS
>> @@ -3514,6 +3514,12 @@ A major mode based on the tree-sitter library for editing "go.work"
>>  files.  If tree-sitter is properly set-up by the user, it can be
>>  enabled for files named "go.work".
>>  
>> +---
>> +*** New major mode 'inputrc-ts-mode'.
>> +A major mode based on the tree-sitter library for editing inputrc files.
>> +See the Info node "(bash) Readline Init File" for more information on
>> +this file format.
>> +
>>  ** New package 'lua-mode'.
>>  The 'lua-mode' package from NonGNU ELPA is now included in Emacs.
>>  
>> diff --git a/lisp/progmodes/inputrc-ts-mode.el b/lisp/progmodes/inputrc-ts-mode.el
>> new file mode 100644
>> index 00000000000..4d5624e95a7
>> --- /dev/null
>> +++ b/lisp/progmodes/inputrc-ts-mode.el
>> @@ -0,0 +1,179 @@
>> +;;; inputrc-ts-mode.el --- tree-sitter support for inputrc files  -*- lexical-binding: t; -*-
>> +
>> +;; Copyright (C) 2026 Free Software Foundation, Inc.
>> +
>> +;; Author     : Steven Allen <steven@HIDDEN>
>> +;; Maintainer : Steven Allen <steven@HIDDEN>
>> +;; Created    : February 2026
>> +;; Keywords   : readline inputrc languages tree-sitter
>
> Can you please remove the spaces before the colons?  Aligning the values
> like this is really not a convention, it is just something that (some)
> -ts-mode packages do for some reason.

Done.

>> +
>> +;; This file is part of GNU Emacs.
>> +
>> +;; GNU Emacs is free software: you can redistribute it and/or modify
>> +;; it under the terms of the GNU General Public License as published by
>> +;; the Free Software Foundation, either version 3 of the License, or
>> +;; (at your option) any later version.
>> +
>> +;; GNU Emacs is distributed in the hope that it will be useful,
>> +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +;; GNU General Public License for more details.
>> +
>> +;; You should have received a copy of the GNU General Public License
>> +;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
>> +
>> +;;; Commentary:
>> +
>> +;; Major mode for editing inputrc (GNU readline RC) files, powered by
>> +;; tree-sitter.
>> +
>> +;;; Code:
>> +
>> +(require 'treesit)
>> +(eval-when-compile (require 'rx))
>> +(treesit-declare-unavailable-functions)
>> +
>> +(add-to-list
>> + 'treesit-language-source-alist
>> + '(readline "https://github.com/tree-sitter-grammars/tree-sitter-readline"
>> +            :commit "74addc90fc539d31d413c0c7cf7581997a7fa46e")
>> + t)
>> +
>> +(defcustom inputrc-ts-mode-indent-offset 2
>> +  "Number of spaces for each indentation step in `inputrc-ts-mode'."
>> +  :version "31.1"
>> +  :type 'natnum
>> +  :safe 'natnump
>> +  :group 'inputrc)
>
> Where is this group defined?

Fixed. Note: failure to define groups seems to be a pervasive issue in
major modes (especially tree-sitter modes).

>> +(defvar inputrc-ts-mode--syntax-table
>> +  (let ((table (make-syntax-table)))
>> +    (modify-syntax-entry ?_   "_"   table)
>> +    (modify-syntax-entry ?\[  "_"   table)
>> +    (modify-syntax-entry ?\]  "_"   table)
>> +    (modify-syntax-entry ?\\  "\\"  table)
>> +    (modify-syntax-entry ?=   "."   table)
>> +    (modify-syntax-entry ?\"  "\""  table)
>> +    (modify-syntax-entry ?#   "<"   table)
>> +    (modify-syntax-entry ?\n  ">"   table)
>> +    (modify-syntax-entry ?\^m "> b" table)
>> +    table)
>> +  "Syntax table for `inputrc-ts-mode'.")
>> +
>> +(defvar inputrc-ts-mode--indent-rules
>> +  `((readline
>> +     ((parent-is "source") column-0 0)
>> +     ((node-is ,(rx bos "$" (or "if" "else" "endif") eos))
>> +      parent-bol 0)
>> +     ((n-p-gp nil nil "conditional_construct")
>> +      grand-parent inputrc-ts-mode-indent-offset)))
>> +  "Tree-sitter indent rules for `inputrc-ts-mode'.")
>> +
>> +(defvar inputrc-ts-mode--font-lock-settings
>> +  (treesit-font-lock-rules
>> +   :language 'readline
>> +   :feature 'comment
>> +   '((comment) @font-lock-comment-face)
>> +
>> +   :language 'readline
>> +   :feature 'keyword
>> +   '(("set" @font-lock-keyword-face)
>> +     (["$include" "$if" "$else" "$endif"] @font-lock-preprocessor-face))
>> +
>> +   :language 'readline
>> +   :feature 'operator
>> +   '(["=" "==" "!=" ">=" "<=" ">" "<"] @font-lock-operator-face)
>> +
>> +   :language 'readline
>> +   :feature 'punctuation
>> +   '(":" @font-lock-delimiter-face)
>> +
>> +   :language 'readline
>> +   :feature 'string
>> +   '(([(application_name) (keyname) (keyseq) (macro) (string_value)
>> +       (term_name)]
>> +      @font-lock-string-face)
>> +     ((file_path) @font-lock-string-face))
>> +
>> +   :language 'readline
>> +   :feature 'escape-sequence
>> +   :override t
>> +   '((escape_sequence) @font-lock-escape-face)
>> +
>> +   :language 'readline
>> +   :feature 'character
>> +   '(((symbolic_character_name) @font-lock-constant-face)
>> +     ((key_literal) @font-lock-constant-face))
>> +
>> +   :language 'readline
>> +   :feature 'function
>> +   '((function_name) @font-lock-function-name-face)
>> +
>> +   :language 'readline
>> +   :feature 'variable
>> +   '([(bell_variable) (bool_variable) (edit_mode_variable)
>> +      (keymap_variable) (number_variable) (string_variable)]
>> +     @font-lock-variable-name-face)
>> +
>> +   :language 'readline
>> +   :feature 'constant
>> +   '(([(bell_value) (edit_mode_value) (keymap_value)]
>> +      @font-lock-constant-face)
>> +     (["version" "term" "mode"] @font-lock-variable-use-face))
>> +
>> +   :language 'readline
>> +   :feature 'number
>> +   '(((number_value) @font-lock-number-face)
>> +     ((version_number) @font-lock-number-face))
>> +
>> +   :language 'readline
>> +   :feature 'boolean
>> +   '((bool_value) @font-lock-constant-face))
>> +  "Font-lock settings for `inputrc-ts-mode'.")
>> +
>> +(defvar inputrc-ts-mode--font-lock-feature-list
>> +  '((comment keyword)
>> +    (string function variable constant boolean number escape-sequence)
>> +    (operator punctuation character))
>> +  "Font-lock feature list for `inputrc-ts-mode'.")
>> +
>> +;;;###autoload
>> +(define-derived-mode inputrc-ts-mode prog-mode "Inputrc"
>> +  "Major mode for editing inputrc files, powered by tree-sitter."
>> +  :group 'inputrc
>> +  :syntax-table inputrc-ts-mode--syntax-table
>> +  (setq-local
>> +   comment-start "# "
>> +   comment-end "")
>> +  (when (treesit-ensure-installed 'readline)
>> +    (setq-local
>> +     treesit-primary-parser (treesit-parser-create 'readline)
>> +     treesit-simple-indent-rules inputrc-ts-mode--indent-rules
>> +     treesit-font-lock-settings inputrc-ts-mode--font-lock-settings
>> +     treesit-font-lock-feature-list inputrc-ts-mode--font-lock-feature-list)
>> +    (treesit-major-mode-setup)))
>> +
>> +(derived-mode-add-parents 'inputrc-ts-mode '(inputrc-mode))
>
> Where is inputrc-mode defined?  I do not know of anything in the core,
> and don't find anything in ELPA.

It's in MELPA: https://melpa.org/#/inputrc-mode

>> +;;;###autoload
>> +(defun inputrc-ts-mode-maybe ()
>> +  "Enable `inputrc-ts-mode' when its grammar is available.
>> +Also propose to install the grammar when `treesit-enabled-modes'
>> +is t or contains the mode name."
>> +  (declare-function treesit-language-available-p "treesit.c")
>> +  (if (or (treesit-language-available-p 'readline)
>> +          (eq treesit-enabled-modes t)
>> +          (memq 'inputrc-ts-mode treesit-enabled-modes))
>> +      (inputrc-ts-mode)
>> +    (fundamental-mode)))
>
> Why not check if "inputrc-mode" is available?

Convention. None of the other tree-sitter modes fallback on their base modes.

>> +
>> +;;;###autoload
>> +(when (boundp 'treesit-major-mode-remap-alist)
>> +  (add-to-list 'auto-mode-alist
>> +               '("/\\.?inputrc\\'" . inputrc-ts-mode-maybe))
>
> Can you not pull out this modification to `auto-mode-alist'?  Or how
> does it depend on `treesit-major-mode-remap-alist'?

I think I could pull it out, but every other tree-sitter mode (that I
can find) adds to `auto-mode-alist' in inside that condition.

>> +  (add-to-list 'treesit-major-mode-remap-alist
>> +               '(inputrc-mode . inputrc-ts-mode)))
>> +
>> +(provide 'inputrc-ts-mode)
>> +
>> +;;; inputrc-ts-mode.el ends here


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=0001-Add-inputrc-ts-mode.patch

From e200c4888e81af3bab47f93034f0ec2ffda7b70e Mon Sep 17 00:00:00 2001
From: Steven Allen <steven@HIDDEN>
Date: Fri, 6 Feb 2026 13:18:50 -0800
Subject: [PATCH] Add inputrc-ts-mode

* etc/NEWS: Mention the new mode.
* lisp/progmodes/treesit-ts-mode.el: New major mode for inputrc files.
---
 etc/NEWS                          |   6 +
 lisp/progmodes/inputrc-ts-mode.el | 183 ++++++++++++++++++++++++++++++
 2 files changed, 189 insertions(+)
 create mode 100644 lisp/progmodes/inputrc-ts-mode.el

diff --git a/etc/NEWS b/etc/NEWS
index a7d2a0b8004..002e72692b3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3514,6 +3514,12 @@ A major mode based on the tree-sitter library for editing "go.work"
 files.  If tree-sitter is properly set-up by the user, it can be
 enabled for files named "go.work".
 
+---
+*** New major mode 'inputrc-ts-mode'.
+A major mode based on the tree-sitter library for editing inputrc files.
+See the Info node "(bash) Readline Init File" for more information on
+this file format.
+
 ** New package 'lua-mode'.
 The 'lua-mode' package from NonGNU ELPA is now included in Emacs.
 
diff --git a/lisp/progmodes/inputrc-ts-mode.el b/lisp/progmodes/inputrc-ts-mode.el
new file mode 100644
index 00000000000..4bb13964e50
--- /dev/null
+++ b/lisp/progmodes/inputrc-ts-mode.el
@@ -0,0 +1,183 @@
+;;; inputrc-ts-mode.el --- tree-sitter support for inputrc files  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Free Software Foundation, Inc.
+
+;; Author: Steven Allen <steven@HIDDEN>
+;; Maintainer: Steven Allen <steven@HIDDEN>
+;; Created: February 2026
+;; Keywords: readline inputrc languages tree-sitter
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Major mode for editing inputrc (GNU readline RC) files, powered by
+;; tree-sitter.
+
+;;; Code:
+
+(require 'treesit)
+(eval-when-compile (require 'rx))
+(treesit-declare-unavailable-functions)
+
+(add-to-list
+ 'treesit-language-source-alist
+ '(readline "https://github.com/tree-sitter-grammars/tree-sitter-readline"
+            :commit "74addc90fc539d31d413c0c7cf7581997a7fa46e")
+ t)
+
+(defgroup inputrc nil
+  "Major mode for editing inputrc files."
+  :group 'languages
+  :version "31.1"
+  :prefix "inputrc")
+
+(defcustom inputrc-ts-mode-indent-offset 2
+  "Number of spaces for each indentation step in `inputrc-ts-mode'."
+  :version "31.1"
+  :type 'natnum
+  :safe 'natnump)
+
+(defvar inputrc-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?_   "_"   table)
+    (modify-syntax-entry ?\[  "_"   table)
+    (modify-syntax-entry ?\]  "_"   table)
+    (modify-syntax-entry ?\\  "\\"  table)
+    (modify-syntax-entry ?=   "."   table)
+    (modify-syntax-entry ?\"  "\""  table)
+    (modify-syntax-entry ?#   "<"   table)
+    (modify-syntax-entry ?\n  ">"   table)
+    (modify-syntax-entry ?\^m "> b" table)
+    table)
+  "Syntax table for `inputrc-ts-mode'.")
+
+(defvar inputrc-ts-mode--indent-rules
+  `((readline
+     ((parent-is "source") column-0 0)
+     ((node-is ,(rx bos "$" (or "if" "else" "endif") eos))
+      parent-bol 0)
+     ((n-p-gp nil nil "conditional_construct")
+      grand-parent inputrc-ts-mode-indent-offset)))
+  "Tree-sitter indent rules for `inputrc-ts-mode'.")
+
+(defvar inputrc-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'readline
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'readline
+   :feature 'keyword
+   '(("set" @font-lock-keyword-face)
+     (["$include" "$if" "$else" "$endif"] @font-lock-preprocessor-face))
+
+   :language 'readline
+   :feature 'operator
+   '(["=" "==" "!=" ">=" "<=" ">" "<"] @font-lock-operator-face)
+
+   :language 'readline
+   :feature 'punctuation
+   '(":" @font-lock-delimiter-face)
+
+   :language 'readline
+   :feature 'string
+   '(([(application_name) (keyname) (keyseq) (macro) (string_value)
+       (term_name)]
+      @font-lock-string-face)
+     ((file_path) @font-lock-string-face))
+
+   :language 'readline
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'readline
+   :feature 'character
+   '(((symbolic_character_name) @font-lock-constant-face)
+     ((key_literal) @font-lock-constant-face))
+
+   :language 'readline
+   :feature 'function
+   '((function_name) @font-lock-function-name-face)
+
+   :language 'readline
+   :feature 'variable
+   '([(bell_variable) (bool_variable) (edit_mode_variable)
+      (keymap_variable) (number_variable) (string_variable)]
+     @font-lock-variable-name-face)
+
+   :language 'readline
+   :feature 'constant
+   '(([(bell_value) (edit_mode_value) (keymap_value)]
+      @font-lock-constant-face)
+     (["version" "term" "mode"] @font-lock-variable-use-face))
+
+   :language 'readline
+   :feature 'number
+   '(((number_value) @font-lock-number-face)
+     ((version_number) @font-lock-number-face))
+
+   :language 'readline
+   :feature 'boolean
+   '((bool_value) @font-lock-constant-face))
+  "Font-lock settings for `inputrc-ts-mode'.")
+
+(defvar inputrc-ts-mode--font-lock-feature-list
+  '((comment keyword)
+    (string function variable constant boolean number escape-sequence)
+    (operator punctuation character))
+  "Font-lock feature list for `inputrc-ts-mode'.")
+
+;;;###autoload
+(define-derived-mode inputrc-ts-mode prog-mode "Inputrc"
+  "Major mode for editing inputrc files, powered by tree-sitter."
+  :syntax-table inputrc-ts-mode--syntax-table
+  (setq-local
+   comment-start "# "
+   comment-end "")
+  (when (treesit-ensure-installed 'readline)
+    (setq-local
+     treesit-primary-parser (treesit-parser-create 'readline)
+     treesit-simple-indent-rules inputrc-ts-mode--indent-rules
+     treesit-font-lock-settings inputrc-ts-mode--font-lock-settings
+     treesit-font-lock-feature-list inputrc-ts-mode--font-lock-feature-list)
+    (treesit-major-mode-setup)))
+
+(derived-mode-add-parents 'inputrc-ts-mode '(inputrc-mode))
+
+;;;###autoload
+(defun inputrc-ts-mode-maybe ()
+  "Enable `inputrc-ts-mode' when its grammar is available.
+Also propose to install the grammar when `treesit-enabled-modes'
+is t or contains the mode name."
+  (declare-function treesit-language-available-p "treesit.c")
+  (if (or (treesit-language-available-p 'readline)
+          (eq treesit-enabled-modes t)
+          (memq 'inputrc-ts-mode treesit-enabled-modes))
+      (inputrc-ts-mode)
+    (fundamental-mode)))
+
+;;;###autoload
+(when (boundp 'treesit-major-mode-remap-alist)
+  (add-to-list 'auto-mode-alist
+               '("/\\.?inputrc\\'" . inputrc-ts-mode-maybe))
+  (add-to-list 'treesit-major-mode-remap-alist
+               '(inputrc-mode . inputrc-ts-mode)))
+
+(provide 'inputrc-ts-mode)
+
+;;; inputrc-ts-mode.el ends here
-- 
2.52.0


--=-=-=--




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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 19:13:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 14:13:37 2026
Received: from localhost ([127.0.0.1]:38726 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vonkP-0007iU-9y
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 14:13:37 -0500
Received: from mout-p-201.mailbox.org ([80.241.56.171]:35796)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vonkL-0007i9-Ug
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 14:13:35 -0500
Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4f7gbT6TKZz9sjY;
 Sat,  7 Feb 2026 20:13:25 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1770491605;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=En97URLAvqPoaSirkHdtifPz76klSNgalMkql45wLoM=;
 b=OEejPMRV2NarYHty+5iarKglIvMlwe8C4scNnTKVKBorded6EmRhWMEkKi5ZuHwvvy2MBm
 2ozBJO1TRPX5DWk+u6AJBwh7CV+HYG+LMocxlrk0kvO9KKexJ3w3cC3bS9vWFcd7WumpD5
 fJXcOkMsRXDfpKqnh02Cw0A9EbeDmxsMUPm7DEePio9ELtrt+2FLA9Y1IYgqN/HE3qLswg
 O/VsXMskjMfqLtVX5ZfS71PCwAZeRoFtN9srWWJi0uGGLk+0WWn6MFcK0xoC5oOZScN/iP
 jqlBDVl8qwxwxyQtHFI5JW5+ryrvu8MBV50uN97JmuyVHeJ6kyPrvzMf9PR9Ug==
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <86a4xlvvef.fsf@HIDDEN>
Organization: LINKOV.NET
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
Date: Sat, 07 Feb 2026 21:07:57 +0200
Message-ID: <877bso1ieq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Steven Allen <steven@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Sean Whitton <spwhitton@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: -1.7 (-)

> Thanks.  I wonder if this mode's name should be inputrc-ts-mode
> instead.  Sean, Stefan, Juri, WDYT?

I believe it could be defined by just 'define-treesit-generic-mode'
in treesit-x.el.




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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 18:51:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 13:51:41 2026
Received: from localhost ([127.0.0.1]:38602 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vonPA-0006k1-Ez
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 13:51:41 -0500
Received: from mout01.posteo.de ([185.67.36.65]:54159)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <philipk@HIDDEN>)
 id 1vonP8-0006jZ-0I
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 13:51:39 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 842A7240027
 for <80342 <at> debbugs.gnu.org>; Sat,  7 Feb 2026 19:51:31 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017;
 t=1770490291; bh=3NHAvug8TX63BxmdJ8/mFjG6d+saDDYbWEMOMt96Kr4=;
 h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:From;
 b=LvvHYPRmNI7fnK6YS5Mf5zXOV0P1MrC2xVBfr/FkLPadaikEnSo07V6meoplQhGfE
 bq5MMCF5QykUcTIa4Ijfqk3zXpczlSnouHaVpDI3OtxGcRTl9Rm6Ib6fQrMHoopDCP
 f0jCn16YFIdyIwiwRPvNxYREpRBdO0hJFxfRhGDJd2y8uKMzSgLqPdccy8BNOC3Wvr
 UH69Z84bh32tyg1XFarw17CnFqoqOxPtAyYbMPIVC8L8HA5M3VQRbu4Glpm5/qhsSE
 kD6ZqqQQc0SXEYO6lrbiI6DM0EI53SDir5B5ox9jjCpJqBNjFyTMCIXsMsToLg37ma
 KgLB0Hisdn1PA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4f7g6B28Ysz9rxG;
 Sat,  7 Feb 2026 19:51:30 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: Steven Allen <steven@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <87ikc8xw30.fsf@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN> <87ikc8xw30.fsf@HIDDEN>
OpenPGP: id=philipk@HIDDEN;
 url="https://keys.openpgp.org/vks/v1/by-email/philipk@HIDDEN";
 preference=signencrypt
Date: Sat, 07 Feb 2026 18:51:31 +0000
Message-ID: <874insbd5f.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>, Juri Linkov <juri@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 (---)

Steven Allen via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Stefan Monnier <monnier@HIDDEN> writes:
>
>> As usual, I'd recommend we keep this out of Emacs's repository, i.e. in
>> GNU ELPA.
>
> I submitted it to Emacs core because:
>
> 1. Most tree-sitter modes seem to get submitted directly to Emacs core.

There are a number of tree-sitter related packages on ELPA, so I don't
think there is anything wrong with that.

> 2. As a GNU project, it seemed fitting that Emacs should have a built-in
> major mode for inputrc files.

I also think it should be fine, nevertheless I have added a few comments
below.

> However, I'm happy to submit it to ELPA instead. 
>
>>>> Date: Fri, 06 Feb 2026 13:29:48 -0800
>>>> From:  Steven Allen via "Bug reports for GNU Emacs,
>>>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>>> 
>>>> The attached patch adds a tree-sitter based major mode for inputrc files
>>>> (~/.inputrc, /etc/inputrc, etc.).
>>>> 
>>>> - The upstream tree-sitter grammar is here:
>>>>   https://github.com/tree-sitter-grammars/tree-sitter-readline/
>>>> 
>>>> - There's an existing non-tree-sitter inputrc major-mode available on
>>>>   melpa here:
>>>>   https://github.com/nverno/inputrc-mode/blob/master/inputrc-mode.el
>>>
>>> Thanks.  I wonder if this mode's name should be inputrc-ts-mode
>>> instead.  Sean, Stefan, Juri, WDYT?
>
> I've attached a version that calls the mode `inputrc-ts-mode'. However,
> the upstream tree-sitter parser is called readline, so I have to use that
> name internally when referring to the tree-sitter language.
>
>>>> I've never submitted a major mode before and I'm hardly a tree-sitter
>>>> expert, so please let me know if I made any mistakes (e.g., do I list
>>>> myself as the maintainer?).
>>>
>>> If you are willing to be responsible for maintenance of this mode,
>>> then yes, please list yourself.
>
> I'm happy to.
> From beb03f368bbf944ac6090b839a7b83f1722a94ae Mon Sep 17 00:00:00 2001
> From: Steven Allen <steven@HIDDEN>
> Date: Fri, 6 Feb 2026 13:18:50 -0800
> Subject: [PATCH] Add inputrc-ts-mode
>
> * etc/NEWS: Mention the new mode.
> * lisp/progmodes/treesit-ts-mode.el: New major mode for inputrc files.
> ---
>  etc/NEWS                          |   6 +
>  lisp/progmodes/inputrc-ts-mode.el | 179 ++++++++++++++++++++++++++++++
>  2 files changed, 185 insertions(+)
>  create mode 100644 lisp/progmodes/inputrc-ts-mode.el
>
> diff --git a/etc/NEWS b/etc/NEWS
> index a7d2a0b8004..002e72692b3 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -3514,6 +3514,12 @@ A major mode based on the tree-sitter library for editing "go.work"
>  files.  If tree-sitter is properly set-up by the user, it can be
>  enabled for files named "go.work".
>  
> +---
> +*** New major mode 'inputrc-ts-mode'.
> +A major mode based on the tree-sitter library for editing inputrc files.
> +See the Info node "(bash) Readline Init File" for more information on
> +this file format.
> +
>  ** New package 'lua-mode'.
>  The 'lua-mode' package from NonGNU ELPA is now included in Emacs.
>  
> diff --git a/lisp/progmodes/inputrc-ts-mode.el b/lisp/progmodes/inputrc-ts-mode.el
> new file mode 100644
> index 00000000000..4d5624e95a7
> --- /dev/null
> +++ b/lisp/progmodes/inputrc-ts-mode.el
> @@ -0,0 +1,179 @@
> +;;; inputrc-ts-mode.el --- tree-sitter support for inputrc files  -*- lexical-binding: t; -*-
> +
> +;; Copyright (C) 2026 Free Software Foundation, Inc.
> +
> +;; Author     : Steven Allen <steven@HIDDEN>
> +;; Maintainer : Steven Allen <steven@HIDDEN>
> +;; Created    : February 2026
> +;; Keywords   : readline inputrc languages tree-sitter

Can you please remove the spaces before the colons?  Aligning the values
like this is really not a convention, it is just something that (some)
-ts-mode packages do for some reason.

> +
> +;; This file is part of GNU Emacs.
> +
> +;; GNU Emacs is free software: you can redistribute it and/or modify
> +;; it under the terms of the GNU General Public License as published by
> +;; the Free Software Foundation, either version 3 of the License, or
> +;; (at your option) any later version.
> +
> +;; GNU Emacs is distributed in the hope that it will be useful,
> +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;; GNU General Public License for more details.
> +
> +;; You should have received a copy of the GNU General Public License
> +;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
> +
> +;;; Commentary:
> +
> +;; Major mode for editing inputrc (GNU readline RC) files, powered by
> +;; tree-sitter.
> +
> +;;; Code:
> +
> +(require 'treesit)
> +(eval-when-compile (require 'rx))
> +(treesit-declare-unavailable-functions)
> +
> +(add-to-list
> + 'treesit-language-source-alist
> + '(readline "https://github.com/tree-sitter-grammars/tree-sitter-readline"
> +            :commit "74addc90fc539d31d413c0c7cf7581997a7fa46e")
> + t)
> +
> +(defcustom inputrc-ts-mode-indent-offset 2
> +  "Number of spaces for each indentation step in `inputrc-ts-mode'."
> +  :version "31.1"
> +  :type 'natnum
> +  :safe 'natnump
> +  :group 'inputrc)

Where is this group defined?

> +
> +(defvar inputrc-ts-mode--syntax-table
> +  (let ((table (make-syntax-table)))
> +    (modify-syntax-entry ?_   "_"   table)
> +    (modify-syntax-entry ?\[  "_"   table)
> +    (modify-syntax-entry ?\]  "_"   table)
> +    (modify-syntax-entry ?\\  "\\"  table)
> +    (modify-syntax-entry ?=   "."   table)
> +    (modify-syntax-entry ?\"  "\""  table)
> +    (modify-syntax-entry ?#   "<"   table)
> +    (modify-syntax-entry ?\n  ">"   table)
> +    (modify-syntax-entry ?\^m "> b" table)
> +    table)
> +  "Syntax table for `inputrc-ts-mode'.")
> +
> +(defvar inputrc-ts-mode--indent-rules
> +  `((readline
> +     ((parent-is "source") column-0 0)
> +     ((node-is ,(rx bos "$" (or "if" "else" "endif") eos))
> +      parent-bol 0)
> +     ((n-p-gp nil nil "conditional_construct")
> +      grand-parent inputrc-ts-mode-indent-offset)))
> +  "Tree-sitter indent rules for `inputrc-ts-mode'.")
> +
> +(defvar inputrc-ts-mode--font-lock-settings
> +  (treesit-font-lock-rules
> +   :language 'readline
> +   :feature 'comment
> +   '((comment) @font-lock-comment-face)
> +
> +   :language 'readline
> +   :feature 'keyword
> +   '(("set" @font-lock-keyword-face)
> +     (["$include" "$if" "$else" "$endif"] @font-lock-preprocessor-face))
> +
> +   :language 'readline
> +   :feature 'operator
> +   '(["=" "==" "!=" ">=" "<=" ">" "<"] @font-lock-operator-face)
> +
> +   :language 'readline
> +   :feature 'punctuation
> +   '(":" @font-lock-delimiter-face)
> +
> +   :language 'readline
> +   :feature 'string
> +   '(([(application_name) (keyname) (keyseq) (macro) (string_value)
> +       (term_name)]
> +      @font-lock-string-face)
> +     ((file_path) @font-lock-string-face))
> +
> +   :language 'readline
> +   :feature 'escape-sequence
> +   :override t
> +   '((escape_sequence) @font-lock-escape-face)
> +
> +   :language 'readline
> +   :feature 'character
> +   '(((symbolic_character_name) @font-lock-constant-face)
> +     ((key_literal) @font-lock-constant-face))
> +
> +   :language 'readline
> +   :feature 'function
> +   '((function_name) @font-lock-function-name-face)
> +
> +   :language 'readline
> +   :feature 'variable
> +   '([(bell_variable) (bool_variable) (edit_mode_variable)
> +      (keymap_variable) (number_variable) (string_variable)]
> +     @font-lock-variable-name-face)
> +
> +   :language 'readline
> +   :feature 'constant
> +   '(([(bell_value) (edit_mode_value) (keymap_value)]
> +      @font-lock-constant-face)
> +     (["version" "term" "mode"] @font-lock-variable-use-face))
> +
> +   :language 'readline
> +   :feature 'number
> +   '(((number_value) @font-lock-number-face)
> +     ((version_number) @font-lock-number-face))
> +
> +   :language 'readline
> +   :feature 'boolean
> +   '((bool_value) @font-lock-constant-face))
> +  "Font-lock settings for `inputrc-ts-mode'.")
> +
> +(defvar inputrc-ts-mode--font-lock-feature-list
> +  '((comment keyword)
> +    (string function variable constant boolean number escape-sequence)
> +    (operator punctuation character))
> +  "Font-lock feature list for `inputrc-ts-mode'.")
> +
> +;;;###autoload
> +(define-derived-mode inputrc-ts-mode prog-mode "Inputrc"
> +  "Major mode for editing inputrc files, powered by tree-sitter."
> +  :group 'inputrc
> +  :syntax-table inputrc-ts-mode--syntax-table
> +  (setq-local
> +   comment-start "# "
> +   comment-end "")
> +  (when (treesit-ensure-installed 'readline)
> +    (setq-local
> +     treesit-primary-parser (treesit-parser-create 'readline)
> +     treesit-simple-indent-rules inputrc-ts-mode--indent-rules
> +     treesit-font-lock-settings inputrc-ts-mode--font-lock-settings
> +     treesit-font-lock-feature-list inputrc-ts-mode--font-lock-feature-list)
> +    (treesit-major-mode-setup)))
> +
> +(derived-mode-add-parents 'inputrc-ts-mode '(inputrc-mode))

Where is inputrc-mode defined?  I do not know of anything in the core,
and don't find anything in ELPA.

> +;;;###autoload
> +(defun inputrc-ts-mode-maybe ()
> +  "Enable `inputrc-ts-mode' when its grammar is available.
> +Also propose to install the grammar when `treesit-enabled-modes'
> +is t or contains the mode name."
> +  (declare-function treesit-language-available-p "treesit.c")
> +  (if (or (treesit-language-available-p 'readline)
> +          (eq treesit-enabled-modes t)
> +          (memq 'inputrc-ts-mode treesit-enabled-modes))
> +      (inputrc-ts-mode)
> +    (fundamental-mode)))

Why not check if "inputrc-mode" is available?

> +
> +;;;###autoload
> +(when (boundp 'treesit-major-mode-remap-alist)
> +  (add-to-list 'auto-mode-alist
> +               '("/\\.?inputrc\\'" . inputrc-ts-mode-maybe))

Can you not pull out this modification to `auto-mode-alist'?  Or how
does it depend on `treesit-major-mode-remap-alist'?

> +  (add-to-list 'treesit-major-mode-remap-alist
> +               '(inputrc-mode . inputrc-ts-mode)))
> +
> +(provide 'inputrc-ts-mode)
> +
> +;;; inputrc-ts-mode.el ends here




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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 18:11:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 13:11:42 2026
Received: from localhost ([127.0.0.1]:38230 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vommT-0004Ym-N5
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 13:11:42 -0500
Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]:58117)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <steven@HIDDEN>)
 id 1vommQ-0004YT-8a
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 13:11:39 -0500
Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50])
 by mailfhigh.phl.internal (Postfix) with ESMTP id 15C441400054;
 Sat,  7 Feb 2026 13:11:33 -0500 (EST)
Received: from phl-frontend-03 ([10.202.2.162])
 by phl-compute-10.internal (MEProxy); Sat, 07 Feb 2026 13:11:33 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com;
 h=cc:cc:content-type:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to; s=fm2; t=1770487893; x=
 1770574293; bh=aAAhZFVIj4ar/83NjKo0yF2lLPZLEjS6EdxV4wm9IFc=; b=f
 vDMrrdJxeAQxYlvvuvoBk8J37OQceLTsuVxXJWFnFnq/jwsuLKA47btZzxLJWIhs
 c0XRYDl8Gq5vK0UJDjjYBKqtMtzKEna9AOsk/bBQVnf2Mn/LUsBGVy7rPSmJk0Zz
 c34WGIVGW0SfT/C6xxtGQrVQaGChfEumLpfYKj1Ad3wKF+HQOhRDwK6BB0HnFCMH
 /lj0wBGpJoybRPV92gdCG/CxWgyVXem76FvT/fPlfFzMGM7UgHYmayNTf/K3zUdu
 e7gW5t35PAhcGwI1h5Cu4t2002oNeYHl68Db9ibythu4alnLhA1WXLdQmgSamK0M
 nW4PvNZZCMTOyVGOmT0Nw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
 1770487893; x=1770574293; bh=aAAhZFVIj4ar/83NjKo0yF2lLPZLEjS6Edx
 V4wm9IFc=; b=hXAMrmBgIC9ATpYCm0D9rvxrMR/+j5KRFjF3TCMPqdrSe3awGQV
 bSucI9gtzdZ+mGdaUcpc/0MBH/E+W84L5HxqVJMVxrWTz4Px8NKeFZXzB+y0Nlqt
 yho84BoGvHRkyITythZOFuolPOjCwfiKqGFrpKnF44kG3zjK7SXHEONA6iS2FGzh
 2sZ6duIIqpHHNbHq/NQYcuMwbE2W3udd/NbxzWcJA2DHSbtSUGizpArCavvwua17
 nDl8lNr9/qNxf7JqUeW7C09UBgqNrcG09jmvcl0GdHx/f7KIH/GD5UnWO9QJH8AF
 Bc4deikSnHq7ECNwhrZaecccPlz8PpLax1A==
X-ME-Sender: <xms:VICHaU4mgL3GXYbBv8gnQQuPcQ7xsyStbOaO3-8qDPmpBFScy7LQYw>
 <xme:VICHaXaNg0vf62yv8k9u86YiMdSUd_kFupMa-7EgBhsLj3V_E69x-8wdC4God9aNa
 d3hEtKIu0gLTEF6utnYkF0jjPwx6hTKVobbjlkHupO1ryE0e_cpvA>
X-ME-Received: <xmr:VICHaTj8-Emo6yJOXIjHbU8rfcHzHodsuY5IscTciyjSxr7vbMymo7T7>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduledujeegucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
 gurhephffvvefujghffffkgggtsehmtderredttddtnecuhfhrohhmpefuthgvvhgvnhcu
 tehllhgvnhcuoehsthgvvhgvnhesshhtvggsrghlihgvnhdrtghomheqnecuggftrfgrth
 htvghrnhepueffiefffefhhfejueehiefffeelffeutddthfejfeehveejveeuffejheef
 jedvnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe
 dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsthgvvhgvnhesshhtvggsrghlihgvnhdr
 tghomhdpnhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoh
 epmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggrpdhrtghpthhtohepvghl
 ihiisehgnhhurdhorhhgpdhrtghpthhtohepshhpfihhihhtthhonhesshhpfihhihhtth
 honhdrnhgrmhgvpdhrtghpthhtohepjhhurhhisehlihhnkhhovhdrnhgvthdprhgtphht
 thhopeektdefgedvseguvggssghughhsrdhgnhhurdhorhhg
X-ME-Proxy: <xmx:VICHaY8NOklte5FzujGBu4KG4RCl6RWZK1XmECaG3jbOR3l_CZk1tQ>
 <xmx:VICHaeqH8y2Y11mv5YQmZp8U8V68Spnu9nLjyyCOezz1fspnA15eyg>
 <xmx:VICHaQVc9osgTpgsQkTqctp62vM4gCB_bWS_oDWr6hDYnwQ5N-HWZg>
 <xmx:VICHadAG8WHM6JJ8rFDAyoalFxUnOov9t07QIn1lo1Sjai2l26JXrQ>
 <xmx:VYCHafIfU4IFHltqxtlFCKGmTPbQi7Q9DA3GN5mHzoeCCzHTJ2LRcW6l>
Feedback-ID: ie8a146a7:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 7 Feb 2026 13:11:32 -0500 (EST)
From: Steven Allen <steven@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
 <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN>
Date: Sat, 07 Feb 2026 10:11:31 -0800
Message-ID: <87ikc8xw30.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>,
 Sean Whitton <spwhitton@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: -1.7 (-)

--=-=-=
Content-Type: text/plain

Stefan Monnier <monnier@HIDDEN> writes:

> As usual, I'd recommend we keep this out of Emacs's repository, i.e. in
> GNU ELPA.

I submitted it to Emacs core because:

1. Most tree-sitter modes seem to get submitted directly to Emacs core.

2. As a GNU project, it seemed fitting that Emacs should have a built-in
major mode for inputrc files.

However, I'm happy to submit it to ELPA instead. 

>>> Date: Fri, 06 Feb 2026 13:29:48 -0800
>>> From:  Steven Allen via "Bug reports for GNU Emacs,
>>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>> 
>>> The attached patch adds a tree-sitter based major mode for inputrc files
>>> (~/.inputrc, /etc/inputrc, etc.).
>>> 
>>> - The upstream tree-sitter grammar is here:
>>>   https://github.com/tree-sitter-grammars/tree-sitter-readline/
>>> 
>>> - There's an existing non-tree-sitter inputrc major-mode available on
>>>   melpa here:
>>>   https://github.com/nverno/inputrc-mode/blob/master/inputrc-mode.el
>>
>> Thanks.  I wonder if this mode's name should be inputrc-ts-mode
>> instead.  Sean, Stefan, Juri, WDYT?

I've attached a version that calls the mode `inputrc-ts-mode'. However,
the upstream tree-sitter parser is called readline, so I have to use that
name internally when referring to the tree-sitter language.

>>> I've never submitted a major mode before and I'm hardly a tree-sitter
>>> expert, so please let me know if I made any mistakes (e.g., do I list
>>> myself as the maintainer?).
>>
>> If you are willing to be responsible for maintenance of this mode,
>> then yes, please list yourself.

I'm happy to.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=0001-Add-inputrc-ts-mode.patch

From beb03f368bbf944ac6090b839a7b83f1722a94ae Mon Sep 17 00:00:00 2001
From: Steven Allen <steven@HIDDEN>
Date: Fri, 6 Feb 2026 13:18:50 -0800
Subject: [PATCH] Add inputrc-ts-mode

* etc/NEWS: Mention the new mode.
* lisp/progmodes/treesit-ts-mode.el: New major mode for inputrc files.
---
 etc/NEWS                          |   6 +
 lisp/progmodes/inputrc-ts-mode.el | 179 ++++++++++++++++++++++++++++++
 2 files changed, 185 insertions(+)
 create mode 100644 lisp/progmodes/inputrc-ts-mode.el

diff --git a/etc/NEWS b/etc/NEWS
index a7d2a0b8004..002e72692b3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3514,6 +3514,12 @@ A major mode based on the tree-sitter library for editing "go.work"
 files.  If tree-sitter is properly set-up by the user, it can be
 enabled for files named "go.work".
 
+---
+*** New major mode 'inputrc-ts-mode'.
+A major mode based on the tree-sitter library for editing inputrc files.
+See the Info node "(bash) Readline Init File" for more information on
+this file format.
+
 ** New package 'lua-mode'.
 The 'lua-mode' package from NonGNU ELPA is now included in Emacs.
 
diff --git a/lisp/progmodes/inputrc-ts-mode.el b/lisp/progmodes/inputrc-ts-mode.el
new file mode 100644
index 00000000000..4d5624e95a7
--- /dev/null
+++ b/lisp/progmodes/inputrc-ts-mode.el
@@ -0,0 +1,179 @@
+;;; inputrc-ts-mode.el --- tree-sitter support for inputrc files  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Free Software Foundation, Inc.
+
+;; Author     : Steven Allen <steven@HIDDEN>
+;; Maintainer : Steven Allen <steven@HIDDEN>
+;; Created    : February 2026
+;; Keywords   : readline inputrc languages tree-sitter
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Major mode for editing inputrc (GNU readline RC) files, powered by
+;; tree-sitter.
+
+;;; Code:
+
+(require 'treesit)
+(eval-when-compile (require 'rx))
+(treesit-declare-unavailable-functions)
+
+(add-to-list
+ 'treesit-language-source-alist
+ '(readline "https://github.com/tree-sitter-grammars/tree-sitter-readline"
+            :commit "74addc90fc539d31d413c0c7cf7581997a7fa46e")
+ t)
+
+(defcustom inputrc-ts-mode-indent-offset 2
+  "Number of spaces for each indentation step in `inputrc-ts-mode'."
+  :version "31.1"
+  :type 'natnum
+  :safe 'natnump
+  :group 'inputrc)
+
+(defvar inputrc-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?_   "_"   table)
+    (modify-syntax-entry ?\[  "_"   table)
+    (modify-syntax-entry ?\]  "_"   table)
+    (modify-syntax-entry ?\\  "\\"  table)
+    (modify-syntax-entry ?=   "."   table)
+    (modify-syntax-entry ?\"  "\""  table)
+    (modify-syntax-entry ?#   "<"   table)
+    (modify-syntax-entry ?\n  ">"   table)
+    (modify-syntax-entry ?\^m "> b" table)
+    table)
+  "Syntax table for `inputrc-ts-mode'.")
+
+(defvar inputrc-ts-mode--indent-rules
+  `((readline
+     ((parent-is "source") column-0 0)
+     ((node-is ,(rx bos "$" (or "if" "else" "endif") eos))
+      parent-bol 0)
+     ((n-p-gp nil nil "conditional_construct")
+      grand-parent inputrc-ts-mode-indent-offset)))
+  "Tree-sitter indent rules for `inputrc-ts-mode'.")
+
+(defvar inputrc-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'readline
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'readline
+   :feature 'keyword
+   '(("set" @font-lock-keyword-face)
+     (["$include" "$if" "$else" "$endif"] @font-lock-preprocessor-face))
+
+   :language 'readline
+   :feature 'operator
+   '(["=" "==" "!=" ">=" "<=" ">" "<"] @font-lock-operator-face)
+
+   :language 'readline
+   :feature 'punctuation
+   '(":" @font-lock-delimiter-face)
+
+   :language 'readline
+   :feature 'string
+   '(([(application_name) (keyname) (keyseq) (macro) (string_value)
+       (term_name)]
+      @font-lock-string-face)
+     ((file_path) @font-lock-string-face))
+
+   :language 'readline
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'readline
+   :feature 'character
+   '(((symbolic_character_name) @font-lock-constant-face)
+     ((key_literal) @font-lock-constant-face))
+
+   :language 'readline
+   :feature 'function
+   '((function_name) @font-lock-function-name-face)
+
+   :language 'readline
+   :feature 'variable
+   '([(bell_variable) (bool_variable) (edit_mode_variable)
+      (keymap_variable) (number_variable) (string_variable)]
+     @font-lock-variable-name-face)
+
+   :language 'readline
+   :feature 'constant
+   '(([(bell_value) (edit_mode_value) (keymap_value)]
+      @font-lock-constant-face)
+     (["version" "term" "mode"] @font-lock-variable-use-face))
+
+   :language 'readline
+   :feature 'number
+   '(((number_value) @font-lock-number-face)
+     ((version_number) @font-lock-number-face))
+
+   :language 'readline
+   :feature 'boolean
+   '((bool_value) @font-lock-constant-face))
+  "Font-lock settings for `inputrc-ts-mode'.")
+
+(defvar inputrc-ts-mode--font-lock-feature-list
+  '((comment keyword)
+    (string function variable constant boolean number escape-sequence)
+    (operator punctuation character))
+  "Font-lock feature list for `inputrc-ts-mode'.")
+
+;;;###autoload
+(define-derived-mode inputrc-ts-mode prog-mode "Inputrc"
+  "Major mode for editing inputrc files, powered by tree-sitter."
+  :group 'inputrc
+  :syntax-table inputrc-ts-mode--syntax-table
+  (setq-local
+   comment-start "# "
+   comment-end "")
+  (when (treesit-ensure-installed 'readline)
+    (setq-local
+     treesit-primary-parser (treesit-parser-create 'readline)
+     treesit-simple-indent-rules inputrc-ts-mode--indent-rules
+     treesit-font-lock-settings inputrc-ts-mode--font-lock-settings
+     treesit-font-lock-feature-list inputrc-ts-mode--font-lock-feature-list)
+    (treesit-major-mode-setup)))
+
+(derived-mode-add-parents 'inputrc-ts-mode '(inputrc-mode))
+
+;;;###autoload
+(defun inputrc-ts-mode-maybe ()
+  "Enable `inputrc-ts-mode' when its grammar is available.
+Also propose to install the grammar when `treesit-enabled-modes'
+is t or contains the mode name."
+  (declare-function treesit-language-available-p "treesit.c")
+  (if (or (treesit-language-available-p 'readline)
+          (eq treesit-enabled-modes t)
+          (memq 'inputrc-ts-mode treesit-enabled-modes))
+      (inputrc-ts-mode)
+    (fundamental-mode)))
+
+;;;###autoload
+(when (boundp 'treesit-major-mode-remap-alist)
+  (add-to-list 'auto-mode-alist
+               '("/\\.?inputrc\\'" . inputrc-ts-mode-maybe))
+  (add-to-list 'treesit-major-mode-remap-alist
+               '(inputrc-mode . inputrc-ts-mode)))
+
+(provide 'inputrc-ts-mode)
+
+;;; inputrc-ts-mode.el ends here
-- 
2.52.0


--=-=-=--




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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 14:33:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 09:33:32 2026
Received: from localhost ([127.0.0.1]:35105 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vojNM-0001NT-1P
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 09:33:32 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:26484)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1vojNG-0001NC-Mc
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 09:33:29 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 99E3F81BB1;
 Sat,  7 Feb 2026 09:33:20 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1770474799;
 bh=puQWDvF/ELb5Rr9WjHo9mUwIY5ImnER0Es0Pijzw2tQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=pSqrO6HWlq1lDdmyq1vgrQNz764s4jJcSiyatTW2opjBs1jfeUXmC/Gwd37fk20UH
 2fqdS5aFsyfLS393Itt4E4QZIfkzCRVk5U7spbApNmg2aZh6v2YpYVRirhSwLZmJJt
 +nGyMxf8orvTMWSdVcx06T+l7Jb7ULlUEf6lJ2RbESDkvMunZLH7ntBADLixJ1X2en
 IzjGDW//lLrHu95JxgmUPWAwuyhLDcLhy8XqZOkTi2jhZ5U8DcvHeOepxU//WB+pAd
 o98ADiFUCABlPKL7jv+zWapcLQVUs7BZ7cOAIN6+HJ/O6KgpfU20h4vyWpxbc5hjoI
 gUg2BFkpgYwNw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A1C588179F;
 Sat,  7 Feb 2026 09:33:19 -0500 (EST)
Received: from pastel (104-195-243-38.cpe.teksavvy.com [104.195.243.38])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5D5C11207CF;
 Sat,  7 Feb 2026 09:33:19 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <86a4xlvvef.fsf@HIDDEN>
Message-ID: <jwva4xk8vzs.fsf-monnier+emacs@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
Date: Sat, 07 Feb 2026 09:33:18 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.135 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>,
 Steven Allen <steven@HIDDEN>, Sean Whitton <spwhitton@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 (---)

As usual, I'd recommend we keep this out of Emacs's repository, i.e. in
GNU ELPA.


=== Stefan


Eli Zaretskii [2026-02-07 09:56:56] wrote:

>> Date: Fri, 06 Feb 2026 13:29:48 -0800
>> From:  Steven Allen via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>> 
>> The attached patch adds a tree-sitter based major mode for inputrc files
>> (~/.inputrc, /etc/inputrc, etc.).
>> 
>> - The upstream tree-sitter grammar is here:
>>   https://github.com/tree-sitter-grammars/tree-sitter-readline/
>> 
>> - There's an existing non-tree-sitter inputrc major-mode available on
>>   melpa here:
>>   https://github.com/nverno/inputrc-mode/blob/master/inputrc-mode.el
>
> Thanks.  I wonder if this mode's name should be inputrc-ts-mode
> instead.  Sean, Stefan, Juri, WDYT?
>
>> I've never submitted a major mode before and I'm hardly a tree-sitter
>> expert, so please let me know if I made any mistakes (e.g., do I list
>> myself as the maintainer?).
>
> If you are willing to be responsible for maintenance of this mode,
> then yes, please list yourself.
>
>> I chose to name the mode "readline-ts-mode" to follow the upstream
>> tree-sitter grammar naming, but I'm just as happy to call it "inputrc-ts-mode".





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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 14:01:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 09:01:15 2026
Received: from localhost ([127.0.0.1]:34807 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vois7-0008As-9g
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 09:01:15 -0500
Received: from sendmail.purelymail.com ([34.202.193.197]:54042)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>)
 id 1vois4-0008AT-Tn
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 09:01:13 -0500
DKIM-Signature: a=rsa-sha256;
 b=Wh89VfF3PZEPAGsxwwwwVO6FHHteVAuCWdBANfOHX89wB9C1RjfL3+egM9HkQbZ7+WPG82SbsxXXpjPN7O4Q2IrrrQN4+wQerWAck0onDGZaRk+49lP9DY7Lbtzpz3PKrQRkCeJ46yZ/jpNNCKtl9mHmAUH5rHjizCyV54Rm56FtQz2g7arhngIddgp8KRGlOsdieVdnoVYxzvKEl7tFgJFiZouvOeAUQj11X9xYSZsw8tSQlD6Rn5ddxVPbp3/1SLicQkvsrzGkg/ATpvZE9BHDzUcURDv3gQdsS2N2Ca6Dqo0/ynFnx6XGOKKHp4c4Q9k1dsHlXUXURJdZ5L+2Fg==;
 s=purelymail3; d=spwhitton.name; v=1;
 bh=vhbsgsZxbz9L2pKRbm8/hxstIpFBckw3qDA5ZRrje4A=;
 h=Received:Received:From:To:Subject:Date; 
DKIM-Signature: a=rsa-sha256;
 b=pVNgB+EriIRZfZf+Sv4WitmRdgDdmZ+fMGPHfIoWIFEx/qVXp5CLDFFdDldNeom7v0OegTgNu1aezkYpbXiwIdXV9uz8u+4plc3eKFCTwBl+eatUEI6dybPcA67W+Oi4fypawr+1oPLNXbS6brRp/PkISHsslkQJCupjmQsFRVBuvYb92n4y3iCJfKmZYcPcQemLduoEGy1hTdkjEqcNVDqz9t4wHnLIyt91uG5BEjQBRVSL7Rq1qbGW78hJdzCIVc7A6mJCDcSP03p4JQ7R5xvkmeb/bRmn9Ykaadlp7kfquyPv1JdDwEPsNtIT4P6PlLZjusLcneUydoqiuNSh3Q==;
 s=purelymail3; d=purelymail.com; v=1;
 bh=vhbsgsZxbz9L2pKRbm8/hxstIpFBckw3qDA5ZRrje4A=;
 h=Feedback-ID:Received:Received:From:To:Subject:Date; 
Feedback-ID: 20115:3760:null:purelymail
X-Pm-Original-To: 80342 <at> debbugs.gnu.org
Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -665928539; 
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Sat, 07 Feb 2026 14:01:05 +0000 (UTC)
Received: by zephyr.silentflame.com (Postfix, from userid 1000)
 id 05491940445; Sat, 07 Feb 2026 14:01:05 +0000 (GMT)
From: Sean Whitton <spwhitton@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
In-Reply-To: <86a4xlvvef.fsf@HIDDEN>
References: <87jywp4l2r.fsf@HIDDEN> <86a4xlvvef.fsf@HIDDEN>
Date: Sat, 07 Feb 2026 14:01:04 +0000
Message-ID: <87qzqwd55r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>,
 Steven Allen <steven@HIDDEN>, Stefan Monnier <monnier@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: -1.0 (-)

Hello,

Eli Zaretskii [07/Feb  9:56am +02] wrote:
>> Date: Fri, 06 Feb 2026 13:29:48 -0800
>> From:  Steven Allen via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>
>> The attached patch adds a tree-sitter based major mode for inputrc files
>> (~/.inputrc, /etc/inputrc, etc.).
>>
>> - The upstream tree-sitter grammar is here:
>>   https://github.com/tree-sitter-grammars/tree-sitter-readline/
>>
>> - There's an existing non-tree-sitter inputrc major-mode available on
>>   melpa here:
>>   https://github.com/nverno/inputrc-mode/blob/master/inputrc-mode.el
>
> Thanks.  I wonder if this mode's name should be inputrc-ts-mode
> instead.  Sean, Stefan, Juri, WDYT?

Looking at the upstream docs, inputrc-ts-mode is probably good, yes.

-- 
Sean Whitton




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

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


Received: (at 80342) by debbugs.gnu.org; 7 Feb 2026 07:57:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 07 02:57:10 2026
Received: from localhost ([127.0.0.1]:32882 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vodBm-0006R6-3I
	for submit <at> debbugs.gnu.org; Sat, 07 Feb 2026 02:57:10 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:46896)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vodBi-0006Qc-Mo
 for 80342 <at> debbugs.gnu.org; Sat, 07 Feb 2026 02:57:07 -0500
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 1vodBc-0002P4-An; Sat, 07 Feb 2026 02:57:00 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=31IvlTtBOSmcH3+wi0vgEQ/whLU4+pJd4F8Jsb8bvh8=; b=k7i+Fw0l9zKE
 Gt/C/KosOv2rh+/Wlx4rkcFFM2HtcIxPFKL8kvZPqcSZErvNK9gGTNQfk/iSrxULOoD0AwZBwaE86
 wAOf/Q5QGKMc5vCPF30DPngXMGAwtl4JeUq5u1HdvpdT3oUZhI5o7fpqMkszYrnTTB/Umk4TtTdrF
 5AbMVfsyYbRrZhLSIgtQltLsmVpWBPFmkPgMLn9LYOTtLrJI2Sq4LeCcLaJdT+ZV3giVgJSe+uYfM
 WDfi+o3wJm22QUubne+H9GS29rWBqkE2V81viwQ7zoP3CxT8xkAd17wfgsI8gK5SQX+CM4ncVZLDY
 jcBWRZMEnx3sLE2LFuWmAw==;
Date: Sat, 07 Feb 2026 09:56:56 +0200
Message-Id: <86a4xlvvef.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Steven Allen <steven@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>, Juri Linkov <juri@HIDDEN>
In-Reply-To: <87jywp4l2r.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#80342: [PATCH] Add readline-ts-mode
References: <87jywp4l2r.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80342
Cc: 80342 <at> debbugs.gnu.org
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 (---)

> Date: Fri, 06 Feb 2026 13:29:48 -0800
> From:  Steven Allen via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> The attached patch adds a tree-sitter based major mode for inputrc files
> (~/.inputrc, /etc/inputrc, etc.).
> 
> - The upstream tree-sitter grammar is here:
>   https://github.com/tree-sitter-grammars/tree-sitter-readline/
> 
> - There's an existing non-tree-sitter inputrc major-mode available on
>   melpa here:
>   https://github.com/nverno/inputrc-mode/blob/master/inputrc-mode.el

Thanks.  I wonder if this mode's name should be inputrc-ts-mode
instead.  Sean, Stefan, Juri, WDYT?

> I've never submitted a major mode before and I'm hardly a tree-sitter
> expert, so please let me know if I made any mistakes (e.g., do I list
> myself as the maintainer?).

If you are willing to be responsible for maintenance of this mode,
then yes, please list yourself.

> I chose to name the mode "readline-ts-mode" to follow the upstream
> tree-sitter grammar naming, but I'm just as happy to call it "inputrc-ts-mode".




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

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


Received: (at submit) by debbugs.gnu.org; 6 Feb 2026 21:30:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 06 16:30:13 2026
Received: from localhost ([127.0.0.1]:56859 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1voTOy-0007As-To
	for submit <at> debbugs.gnu.org; Fri, 06 Feb 2026 16:30:13 -0500
Received: from lists.gnu.org ([2001:470:142::17]:44126)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <steven@HIDDEN>)
 id 1voTOs-00077s-2U
 for submit <at> debbugs.gnu.org; Fri, 06 Feb 2026 16:30:06 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <steven@HIDDEN>)
 id 1voTOm-0001i7-7L
 for bug-gnu-emacs@HIDDEN; Fri, 06 Feb 2026 16:29:56 -0500
Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <steven@HIDDEN>)
 id 1voTOh-0007Bu-73
 for bug-gnu-emacs@HIDDEN; Fri, 06 Feb 2026 16:29:55 -0500
Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47])
 by mailfhigh.phl.internal (Postfix) with ESMTP id 451231400170
 for <bug-gnu-emacs@HIDDEN>; Fri,  6 Feb 2026 16:29:50 -0500 (EST)
Received: from phl-frontend-03 ([10.202.2.162])
 by phl-compute-07.internal (MEProxy); Fri, 06 Feb 2026 16:29:50 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stebalien.com;
 h=cc:content-type:content-type:date:date:from:from:in-reply-to
 :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2;
 t=1770413390; x=1770499790; bh=F1QOW7Bn4Ym757qXSkU2Z4GHr/RMabbh
 aBdOKdLYnLU=; b=S9YefhOXhdtD3mQv9nAG4+YjwQyebn39q/bMhjXcRIcgC+TO
 RrD4ECE/DnubqqdfWUCDg2X8h2kzGl/QcJ6krCWRHEknlv1WG0uCEkRAsbWymeAg
 5Br3bTLCo06bakwdEaNy7pf+YT9UlSxlzD1/NWo3GzfhWW1ebBZwjdv3jOkkww0r
 yWbbrNxdNmH20wu6okWXSm9mJGsckXY61Bm7ZFngyWE3fjJHGseFS9/z5yTpcoJ1
 0ZocWhmZphb4Ndg4wG0FyOVuO/F9ciy6AJZWVSMGMm7CKWewDg0HrP7ab3rVpta0
 6uOClVsgRMbiuNswgR+fo/kM+1aEzpMH/8wP4Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:message-id
 :mime-version:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1770413390; x=
 1770499790; bh=F1QOW7Bn4Ym757qXSkU2Z4GHr/RMabbhaBdOKdLYnLU=; b=F
 ux8ge7IlDZBX0kGYKmsL8hXfXqPGEntDLGHS2A8eLw7m1oMJAvLRlaLVBU7udfno
 NFWFK426FLGnPgVQeDX3ZWOem3xHBGuwSebEC19o9Wso2Qm0qZ5ZEaOH/u68+1Fz
 9jxJY0QxT/ologO46Yy5z+YGgUJ0GynOKcE+8QbLTPf2f8S+MgRMX4IPYVHh9Kbe
 6btdHhgL2dvuEUk2pOyReeB2Im1q0qRpX8IAU8RZOWpB2bPHgxqUuMs1hEaqX/YU
 nBK2eKbVtMlIvDF+LWlBsJhhzmA+c3Wp4GvKAo8nbGWpuTyF3fBpM9Pm1GaxUEnA
 /4A9HeGdEQncQwzXxDa9Q==
X-ME-Sender: <xms:Tl2GaftHnL0xV-uOgdCRhD0EXS6chEm2kVZHSfdn6eUiCMgRsN1xrQ>
 <xme:Tl2GaWW5N5xC6MTBDWR8pdWX7mKdvwOSS-WARIxTiwCy_vowT2qzAAwzPr6D26dVl
 8ryz16EcE94sWEOFYYUgGRqN-ohyBApI8Mu3HIyljQ7fcduf57KUwMV>
X-ME-Received: <xmr:Tl2Gad16FxxAxgbOQO_OwfaWPbrB0_TxeT1r5tU2aD4NlY6EjezCupc7>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukeelvdeiucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkgggtsehmtderredttddtne
 cuhfhrohhmpefuthgvvhgvnhcutehllhgvnhcuoehsthgvvhgvnhesshhtvggsrghlihgv
 nhdrtghomheqnecuggftrfgrthhtvghrnhepteekueeitdfggfeuvdduhfeivefgledtud
 efveegtddvvdegtdevkeffleffvdevnecuffhomhgrihhnpehgihhthhhusgdrtghomhen
 ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsthgvvh
 gvnhesshhtvggsrghlihgvnhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehs
 mhhtphhouhhtpdhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrgh
X-ME-Proxy: <xmx:Tl2GabDyvZ4z2OboBt1Ife2ZmwoN5H0Mni1CwDAOCPdNqj_ljlz3Qw>
 <xmx:Tl2GaTjgTBUJWLltghls8AIWWrRz1ffvqjm4o_LyRsFsa_reAaZDUQ>
 <xmx:Tl2Gaf9IQ8-PeZFCHNyb8znFOHJUKuIV9Zb2-DqHysBPj9vYuGdeuw>
 <xmx:Tl2Gaf8jdMGDgACzAsXTWW99jl3FOaCRciVol9NWIjnok-SacCq_5g>
 <xmx:Tl2GaQPdCKKTC2414CZ9uTdLOAHemu4Td9pZY3B6Y5-xgaaPj36ZUeGd>
Feedback-ID: ie8a146a7:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
 <bug-gnu-emacs@HIDDEN>; Fri, 6 Feb 2026 16:29:49 -0500 (EST)
From: Steven Allen <steven@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Add readline-ts-mode
X-Debbugs-Cc: 
Date: Fri, 06 Feb 2026 13:29:48 -0800
Message-ID: <87jywp4l2r.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=103.168.172.154;
 envelope-from=steven@HIDDEN; helo=fhigh-a3-smtp.messagingengine.com
X-Spam_score_int: -7
X-Spam_score: -0.8
X-Spam_bar: /
X-Spam_report: (-0.8 / 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,
 PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
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: -0.3 (/)

--=-=-=
Content-Type: text/plain

Tags: patch


The attached patch adds a tree-sitter based major mode for inputrc files
(~/.inputrc, /etc/inputrc, etc.).

- The upstream tree-sitter grammar is here:
  https://github.com/tree-sitter-grammars/tree-sitter-readline/

- There's an existing non-tree-sitter inputrc major-mode available on
  melpa here:
  https://github.com/nverno/inputrc-mode/blob/master/inputrc-mode.el

I've never submitted a major mode before and I'm hardly a tree-sitter
expert, so please let me know if I made any mistakes (e.g., do I list
myself as the maintainer?).

I chose to name the mode "readline-ts-mode" to follow the upstream
tree-sitter grammar naming, but I'm just as happy to call it "inputrc-ts-mode".

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.18.4, Xaw3d scroll bars)
Repository revision: 0fc6ab4597e5363d56f14500b475a98f2fbf5d98
Repository branch: feature/igc
Windowing system distributor 'The X.Org Foundation', version 11.0.12101021
System Description: NixOS 26.05 (Yarara)

Configured using:
 'configure
 --prefix=/nix/store/c20fqqsdrb2griwpjj9wnjxk26xf7p5l-emacs-20260130.0
 --disable-build-details --with-modules --with-x-toolkit=lucid
 --with-cairo --without-xft --disable-gc-mark-trace
 --without-compress-install --with-toolkit-scroll-bars
 --with-native-compilation --without-imagemagick --with-mailutils
 --without-small-ja-dic --with-tree-sitter --with-xinput2
 --without-xwidgets --with-dbus --without-selinux --with-cairo-xcb
 --without-gsettings --with-sound=no --with-mps=yes'


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=0001-Add-readline-ts-mode.patch

From 09869496cd20b767f02d8fa0ee492cc262d64333 Mon Sep 17 00:00:00 2001
From: Steven Allen <steven@HIDDEN>
Date: Fri, 6 Feb 2026 13:18:50 -0800
Subject: [PATCH] Add readline-ts-mode

* etc/NEWS: Mention the new mode.
* lisp/progmodes/readline-ts-mode.el: New major mode for inputrc files.
---
 etc/NEWS                           |   6 +
 lisp/progmodes/readline-ts-mode.el | 178 +++++++++++++++++++++++++++++
 2 files changed, 184 insertions(+)
 create mode 100644 lisp/progmodes/readline-ts-mode.el

diff --git a/etc/NEWS b/etc/NEWS
index a7d2a0b8004..93cadfeb359 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3514,6 +3514,12 @@ A major mode based on the tree-sitter library for editing "go.work"
 files.  If tree-sitter is properly set-up by the user, it can be
 enabled for files named "go.work".
 
+---
+*** New major mode 'readline-ts-mode'.
+A major mode based on the tree-sitter library for editing readline init
+files (inputrc).  See the Info node "(bash) Readline Init File" for
+more information on this file format.
+
 ** New package 'lua-mode'.
 The 'lua-mode' package from NonGNU ELPA is now included in Emacs.
 
diff --git a/lisp/progmodes/readline-ts-mode.el b/lisp/progmodes/readline-ts-mode.el
new file mode 100644
index 00000000000..81caf00f6f7
--- /dev/null
+++ b/lisp/progmodes/readline-ts-mode.el
@@ -0,0 +1,178 @@
+;;; readline-ts-mode.el --- tree-sitter support for GNU readline RC files  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2026 Free Software Foundation, Inc.
+
+;; Author     : Steven Allen <steven@HIDDEN>
+;; Maintainer : Steven Allen <steven@HIDDEN>
+;; Created    : February 2026
+;; Keywords   : readline inputrc languages tree-sitter
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Major mode for editing GNU readline RC files (inputrc), powered by tree-sitter.
+
+;;; Code:
+
+(require 'treesit)
+(eval-when-compile (require 'rx))
+(treesit-declare-unavailable-functions)
+
+(add-to-list
+ 'treesit-language-source-alist
+ '(readline "https://github.com/tree-sitter-grammars/tree-sitter-readline"
+            :commit "74addc90fc539d31d413c0c7cf7581997a7fa46e")
+ t)
+
+(defcustom readline-ts-mode-indent-offset 2
+  "Number of spaces for each indentation step in `readline-ts-mode'."
+  :version "31.1"
+  :type 'natnum
+  :safe 'natnump
+  :group 'readline)
+
+(defvar readline-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?_   "_"   table)
+    (modify-syntax-entry ?\[  "_"   table)
+    (modify-syntax-entry ?\]  "_"   table)
+    (modify-syntax-entry ?\\  "\\"  table)
+    (modify-syntax-entry ?=   "."   table)
+    (modify-syntax-entry ?\"  "\""  table)
+    (modify-syntax-entry ?#   "<"   table)
+    (modify-syntax-entry ?\n  ">"   table)
+    (modify-syntax-entry ?\^m "> b" table)
+    table)
+  "Syntax table for `readline-ts-mode'.")
+
+(defvar readline-ts-mode--indent-rules
+  `((readline
+     ((parent-is "source") column-0 0)
+     ((node-is ,(rx bos "$" (or "if" "else" "endif") eos))
+      parent-bol 0)
+     ((n-p-gp nil nil "conditional_construct")
+      grand-parent readline-ts-mode-indent-offset)))
+  "Tree-sitter indent rules for `readline-ts-mode'.")
+
+(defvar readline-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'readline
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'readline
+   :feature 'keyword
+   '(("set" @font-lock-keyword-face)
+     (["$include" "$if" "$else" "$endif"] @font-lock-preprocessor-face))
+
+   :language 'readline
+   :feature 'operator
+   '(["=" "==" "!=" ">=" "<=" ">" "<"] @font-lock-operator-face)
+
+   :language 'readline
+   :feature 'punctuation
+   '(":" @font-lock-delimiter-face)
+
+   :language 'readline
+   :feature 'string
+   '(([(application_name) (keyname) (keyseq) (macro) (string_value)
+       (term_name)]
+      @font-lock-string-face)
+     ((file_path) @font-lock-string-face))
+
+   :language 'readline
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'readline
+   :feature 'character
+   '(((symbolic_character_name) @font-lock-constant-face)
+     ((key_literal) @font-lock-constant-face))
+
+   :language 'readline
+   :feature 'function
+   '((function_name) @font-lock-function-name-face)
+
+   :language 'readline
+   :feature 'variable
+   '([(bell_variable) (bool_variable) (edit_mode_variable)
+      (keymap_variable) (number_variable) (string_variable)]
+     @font-lock-variable-name-face)
+
+   :language 'readline
+   :feature 'constant
+   '(([(bell_value) (edit_mode_value) (keymap_value)]
+      @font-lock-constant-face)
+     (["version" "term" "mode"] @font-lock-variable-use-face))
+
+   :language 'readline
+   :feature 'number
+   '(((number_value) @font-lock-number-face)
+     ((version_number) @font-lock-number-face))
+
+   :language 'readline
+   :feature 'boolean
+   '((bool_value) @font-lock-constant-face))
+  "Font-lock settings for `readline-ts-mode'.")
+
+(defvar readline-ts-mode--font-lock-feature-list
+  '((comment keyword)
+    (string function variable constant boolean number escape-sequence)
+    (operator punctuation character))
+  "Font-lock feature list for `readline-ts-mode'.")
+
+;;;###autoload
+(define-derived-mode readline-ts-mode prog-mode "Readline"
+  "Major mode for editing GNU readline RC files, powered by tree-sitter."
+  :group 'readline
+  :syntax-table readline-ts-mode--syntax-table
+  (setq-local
+   comment-start "# "
+   comment-end "")
+  (when (treesit-ensure-installed 'readline)
+    (setq-local
+     treesit-primary-parser (treesit-parser-create 'readline)
+     treesit-simple-indent-rules readline-ts-mode--indent-rules
+     treesit-font-lock-settings readline-ts-mode--font-lock-settings
+     treesit-font-lock-feature-list readline-ts-mode--font-lock-feature-list)
+    (treesit-major-mode-setup)))
+
+(derived-mode-add-parents 'readline-ts-mode '(inputrc-mode))
+
+;;;###autoload
+(defun readline-ts-mode-maybe ()
+  "Enable `readline-ts-mode' when its grammar is available.
+Also propose to install the grammar when `treesit-enabled-modes'
+is t or contains the mode name."
+  (declare-function treesit-language-available-p "treesit.c")
+  (if (or (treesit-language-available-p 'readline)
+          (eq treesit-enabled-modes t)
+          (memq 'readline-ts-mode treesit-enabled-modes))
+      (readline-ts-mode)
+    (fundamental-mode)))
+
+;;;###autoload
+(when (boundp 'treesit-major-mode-remap-alist)
+  (add-to-list 'auto-mode-alist
+               '("/\\.?inputrc\\'" . readline-ts-mode-maybe))
+  (add-to-list 'treesit-major-mode-remap-alist
+               '(inputrc-mode . readline-ts-mode)))
+
+(provide 'readline-ts-mode)
+
+;;; readline-ts-mode.el ends here
-- 
2.52.0


--=-=-=--




Acknowledgement sent to Steven Allen <steven@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#80342; 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: Thu, 12 Feb 2026 22:30:02 UTC

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