From: Eli Zaretskii <eliz@gnu.org>
To: Juri Linkov <juri@linkov.net>
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, 19 Dec 2022 14:35:27 +0200 [thread overview]
Message-ID: <83o7rzeflc.fsf@gnu.org> (raw)
In-Reply-To: <86359bhmfx.fsf@mail.linkov.net> (message from Juri Linkov on Mon, 19 Dec 2022 09:39:14 +0200)
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 60176@debbugs.gnu.org
> From: Juri Linkov <juri@linkov.net>
> Date: Mon, 19 Dec 2022 09:39:14 +0200
>
> > It would be nice if the fallback mode is used when treesitter is not
> > usable. Say for example, for the following file variable in a C file:
> >
> > /* -*- mode: c; mode: c-ts; -*- */
> >
> > If c-ts-mode is not usable (regardless of whether the mode is
> > available), activate c-mode instead.
> >
> > This bug is regarding the automatically loaded mode when a file with some
> > mode is set, and not regarding the user explicitly setting the mode.
> >
> > Supporting this can help me use multiple mode file variables regardless
> > of the GNU Emacs version used by co-developers.
>
> 'major-mode-remap-alist' should be able to handle this requirement
> since its design is similar to MIME.TYPES and MAILCAP. But actually
> MAILCAP supports an additional predicate TEST that is a command
> executed to determine whether or not the mailcap line applies.
>
> So to completely cover all needs, 'major-mode-remap-alist' should
> support a predicate as well. For example,
>
> (setq major-mode-remap-alist '((c-mode #'treesit-available-p c-ts-mode)))
>
> or a more complex predicate:
>
> (setq major-mode-remap-alist '((c-mode (lambda ()
> (and (treesit-available-p)
> (treesit-ready-p 'c t)))
> c-ts-mode)))
I think the idea is that this should happen by default, not as a
(not-so-trivial) customization by the users.
next prev parent reply other threads:[~2022-12-19 12:35 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 [this message]
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
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=83o7rzeflc.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=60176@debbugs.gnu.org \
--cc=juri@linkov.net \
--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.