From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable Date: Mon, 16 Jan 2023 20:36:45 +0200 Organization: LINKOV.NET Message-ID: <86r0vu1g3m.fsf@mail.linkov.net> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15010"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: sadiq@sadiqpk.org, monnier@iro.umontreal.ca, 60176@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 16 19:38:12 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 1pHUN2-0003kh-Fn for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Jan 2023 19:38:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHUMu-0006QX-Hc; Mon, 16 Jan 2023 13:38: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 1pHUMs-0006Ps-H2 for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 13:38: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 1pHUMs-000191-8p for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 13:38:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHUMs-00066Y-3X for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 13:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Jan 2023 18:38:02 +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.167389427923454 (code B ref 60176); Mon, 16 Jan 2023 18:38:02 +0000 Original-Received: (at 60176) by debbugs.gnu.org; 16 Jan 2023 18:37:59 +0000 Original-Received: from localhost ([127.0.0.1]:34866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHUMo-00066E-S5 for submit@debbugs.gnu.org; Mon, 16 Jan 2023 13:37:59 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:33401) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHUMm-00065u-AJ for 60176@debbugs.gnu.org; Mon, 16 Jan 2023 13:37:56 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 1FB82240006; Mon, 16 Jan 2023 18:37:47 +0000 (UTC) In-Reply-To: <838ri249y5.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 16 Jan 2023 20:21:22 +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:253514 Archived-At: >> >> (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. Or when the user wants to remove the mode from 'auto-mode-alist' after accidentally loading the corresponding ts package.