GNU bug report logs - #60176
29.0.60; Fallback file variable mode if treesitter is not usable

Previous Next

Package: emacs;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Sun, 18 Dec 2022 12:08:01 UTC

Severity: normal

Tags: notabug, wontfix

Merged with 60559, 60874

Found in version 29.0.60

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: sadiq <at> sadiqpk.org, monnier <at> iro.umontreal.ca, 60176 <at> debbugs.gnu.org
Subject: bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable
Date: Mon, 16 Jan 2023 20:21:22 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Cc: monnier <at> iro.umontreal.ca,  sadiq <at> sadiqpk.org,  60176 <at> debbugs.gnu.org
> Date: Mon, 16 Jan 2023 19:32:06 +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.




This bug report was last modified 2 years and 118 days ago.

Previous Next


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