GNU bug report logs -
#60176
29.0.60; Fallback file variable mode if treesitter is not usable
Previous Next
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
Message #11 received at 60176 <at> debbugs.gnu.org (full text, mbox):
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 60176 <at> debbugs.gnu.org
> From: Juri Linkov <juri <at> 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.
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.