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: Tue, 17 Jan 2023 14:07:45 +0200 Message-ID: <831qnt4b5a.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> <835yd646x1.fsf@gnu.org> <864jspd5l5.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34734"; 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 Tue Jan 17 13:08:32 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 1pHklU-0008pg-7J for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Jan 2023 13:08:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHklC-0006d9-1R; Tue, 17 Jan 2023 07:08:14 -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 1pHkl1-0006XR-08 for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 07:08:03 -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 1pHkl0-00037W-1V for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 07:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHkkz-00077D-Hh for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 07:08: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: Tue, 17 Jan 2023 12:08: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.167395726627329 (code B ref 60176); Tue, 17 Jan 2023 12:08:01 +0000 Original-Received: (at 60176) by debbugs.gnu.org; 17 Jan 2023 12:07:46 +0000 Original-Received: from localhost ([127.0.0.1]:35965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHkkj-00076j-Qa for submit@debbugs.gnu.org; Tue, 17 Jan 2023 07:07:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47130) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHkkg-00076U-SR for 60176@debbugs.gnu.org; Tue, 17 Jan 2023 07:07:44 -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 1pHkka-00033O-Gl; Tue, 17 Jan 2023 07:07:36 -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=tvnrmGQUDZtF/MObuP3DxVOk6IqWQgKYjwxlZGMQ0i0=; b=Ki7zJOi/IZsa WqyNunDAf2OLEaH+rprw3eDbvL/rs24nglN6aaX3DLm5wBg6iek3VmkwZtT8qQYXQddkbvi946oRt 0muw3XBdfXR9yl1ptKspr4Hh7ZlEQXnoHURDMewVkRilRoEcRAs65GIoymacKqTwA1PtaoEpSlJ9L LGI4I3L3oF2b1QSF3j5D5B2t7t9kdYHVHy9RWGlbkhkIBHsLbV2BcBM8IIqNIGw0OYfxo8fKwPD5u zisxftWgVaQ3nUQSJ20UeTeqVGEM+sjRdbHmqtnSiXszGJhzZi2DoONFxa0SZA/VSVW2tdGRSK9ke WMwzLd5CjD9AW5OrrgL4VQ==; 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 1pHkkZ-00038K-BN; Tue, 17 Jan 2023 07:07:36 -0500 In-Reply-To: <864jspd5l5.fsf@mail.linkov.net> (message from Juri Linkov on Tue, 17 Jan 2023 09:33:02 +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:253543 Archived-At: > From: Juri Linkov > Cc: monnier@iro.umontreal.ca, sadiq@sadiqpk.org, 60176@debbugs.gnu.org > Date: Tue, 17 Jan 2023 09:33:02 +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? > > This doesn't address the problems mentioned above and below. Which parts "above" were not addressed? As for below: > >> Or when the user wants to remove the mode from 'auto-mode-alist' after > >> accidentally loading the corresponding ts package. I addressed that in the discussion on emacs-devel, see https://lists.gnu.org/archive/html/emacs-devel/2023-01/msg00278.html (I suggest to discuss this there, not here.)