From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable Date: Mon, 16 Jan 2023 21:26:50 +0200 Message-ID: <835yd646x1.fsf@gnu.org> References: <61db3ccacc2697d0b740315af495fca2@sadiqpk.org> <86359bhmfx.fsf@mail.linkov.net> <83o7rzeflc.fsf@gnu.org> <865ydf3dnf.fsf@mail.linkov.net> <83lemao8gj.fsf@gnu.org> <86lemap8j4.fsf@mail.linkov.net> <83r0w2merd.fsf@gnu.org> <86ilh64cox.fsf@mail.linkov.net> <838ri249y5.fsf@gnu.org> <86r0vu1g3m.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28059"; mail-complaints-to="usenet@ciao.gmane.io" Cc: sadiq@sadiqpk.org, monnier@iro.umontreal.ca, 60176@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 16 20:28:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHV9d-00077G-NM for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Jan 2023 20:28:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHV9I-0004gw-EY; Mon, 16 Jan 2023 14:28:04 -0500 Original-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 ) id 1pHV9G-0004gX-Eo for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 14:28:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHV9G-0000dB-6c for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 14:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHV9F-0007Vz-N4 for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 14:28:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Jan 2023 19:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60176 X-GNU-PR-Package: emacs Original-Received: via spool by 60176-submit@debbugs.gnu.org id=B60176.167389722928827 (code B ref 60176); Mon, 16 Jan 2023 19:28:01 +0000 Original-Received: (at 60176) by debbugs.gnu.org; 16 Jan 2023 19:27:09 +0000 Original-Received: from localhost ([127.0.0.1]:34898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHV8O-0007Ut-MM for submit@debbugs.gnu.org; Mon, 16 Jan 2023 14:27:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34210) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHV8K-0007UL-9t for 60176@debbugs.gnu.org; Mon, 16 Jan 2023 14:27:07 -0500 Original-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 ) id 1pHV7z-0000W9-Ke; Mon, 16 Jan 2023 14:26:53 -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=Loa/0cPaIz/IWP8/4jeODsHTpchVDDCDiJa72XGUxbQ=; b=DyTqXUozYLkU vR/HMuNnLUO/f/SU8gSyhYXE6Db71/O+921XpR6MKXJ1HyBVNynu4KofFY5ALFjUNI9Fl4JJYbopf 6GdFcByLFGPRCW3n8R16lQX7EC3qvfypkVtKaPFkd0h2Pz0v0s+FQ0sAB7V31X2cP2n0+n9UiA+Q3 ylMPtV1yuGIcwrBkGndLX6SGMBfxQR4+3pQCW4mxaLtJoQmBaV3N8GdgyXGO6DsYfPe3HH2DumOQq ENXIYpy/USXUhwHj6Y+OCA06gCBMG5hi69wCCBC+22Y2SXPZWh0bI2sf8LKj6Ukd/pIWaBqBJXrgV 0Os7Z4BghuZC1x+zCmYw7Q==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHV7x-0005Vd-Vp; Mon, 16 Jan 2023 14:26:43 -0500 In-Reply-To: <86r0vu1g3m.fsf@mail.linkov.net> (message from Juri Linkov on Mon, 16 Jan 2023 20:36:45 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253515 Archived-At: > From: Juri Linkov > Cc: monnier@iro.umontreal.ca, sadiq@sadiqpk.org, 60176@debbugs.gnu.org > Date: Mon, 16 Jan 2023 20:36:45 +0200 > > >> >> (defcustom treesit-enable-modes nil > >> >> :type '(repeat > >> >> (choice (function-item c-ts-mode) > >> >> (function-item c++-ts-mode) > >> >> (function-item c-or-c++-ts-mode) > >> >> ... > >> >> ('c-ts-mode > >> >> (when (treesit-ready-p 'c t) > >> >> (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode)))) > >> > > >> > And this bit is completely unacceptable, from where I stand: it > >> > basically means that the user activated a certain major mode he/she > >> > wanted to use, but the result could be that an entirely different mode > >> > was silently activated instead. What kind of UX is that, and for a > >> > shining new feature at that?? > >> > >> It could update 'auto-mode-alist' instead of 'major-mode-remap-alist'. > >> >From the user's point of view this would be more manageable than > >> what you proposed on emacs-devel with some obscure logic of activating > >> ts modes when the package is loaded or when the mode is enabled first time. > > > > I don't understand the "obscure" part: the logic was exactly as above: > > test that treesit-ready-p returns non-nil for the mode's language. > > > > Other than that, my proposal does exactly what you say here: it > > updates auto-mode-alist. So it sounds like we are in violent agreement. > > The difference is that an explicit option is more controllable by the user. > When the user needs to use some ts-mode then it's easier just to customize > the option instead of tweaking 'auto-mode-alist' when the user want to > start using that mode without first loading its package or calling it > the first time that modifies 'auto-mode-alist' as the side effect. With the changes I proposed, there's no need to tweak auto-mode-alist. A simple load or require of the mode will install the mode in auto-mode-alist. What can be easier and simpler?