all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: sadiq@sadiqpk.org, monnier@iro.umontreal.ca, 60176@debbugs.gnu.org
Subject: bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable
Date: Mon, 16 Jan 2023 20:36:45 +0200	[thread overview]
Message-ID: <86r0vu1g3m.fsf@mail.linkov.net> (raw)
In-Reply-To: <838ri249y5.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 16 Jan 2023 20:21:22 +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.
Or when the user wants to remove the mode from 'auto-mode-alist' after
accidentally loading the corresponding ts package.





  reply	other threads:[~2023-01-16 18:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-18 12:07 bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable Mohammed Sadiq
2022-12-19  7:39 ` Juri Linkov
2022-12-19 12:35   ` Eli Zaretskii
2022-12-19 13:12     ` Mohammed Sadiq
2022-12-19 16:43     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-09 17:30       ` Juri Linkov
2023-01-09 17:57         ` Eli Zaretskii
2023-01-09 23:06         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-10 12:55           ` Eli Zaretskii
2023-01-10 14:29             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-10 18:08             ` Juri Linkov
2023-01-10 18:21               ` Eli Zaretskii
2023-01-16 17:32                 ` Juri Linkov
2023-01-16 18:21                   ` Eli Zaretskii
2023-01-16 18:36                     ` Juri Linkov [this message]
2023-01-16 19:26                       ` Eli Zaretskii
2023-01-17  7:33                         ` Juri Linkov
2023-01-17 12:07                           ` Eli Zaretskii
2022-12-19 17:29     ` Juri Linkov
2022-12-19 17:47       ` Eli Zaretskii
2022-12-21  4:35 ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86r0vu1g3m.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=60176@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=sadiq@sadiqpk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.