[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Turning on/off tree-sitter modes
From: |
Eli Zaretskii |
Subject: |
Re: Turning on/off tree-sitter modes |
Date: |
Fri, 29 Nov 2024 09:05:05 +0200 |
> From: Juri Linkov <juri@linkov.net>
> Cc: Eli Zaretskii <eliz@gnu.org>, johan.myreen@gmail.com,
> emacs-devel@gnu.org
> Date: Thu, 28 Nov 2024 21:34:02 +0200
>
> >>>>> Major Mode Remap Alist:
> >>>>> List of remappings:
> >>>>> INS DEL
> >>>>> Remap from major mode: js-mode
> >>>>> To mode (or function): js-ts-mode
> >>>> Here mode names are nicely aligned,
> >>>> so it's easier to read for users.
> >>>
> >> - :offset 12
> >> + :offset 9
> >
> > Maybe 10? With 9, it still doesn't line up on my display (the buttons'
> > margins drive the offset), but hangs over for like 0.5 character width.
> >
> > With 10, the result look more intentional, though I'm not sure if the
> > original plan (in Emacs 25?) was to have a different indentation or not.
>
> And can't be aligned with proportional fonts anyway.
>
> There is even a wishlist item in wid-edit.el:
>
> ;; * Make indentation work with glyphs and proportional fonts.
This should be solvable by using :align-to or :width 'display' space
properties.
>
> >> + :options '((js-mode (function :value js-ts-mode))
> >> + (ruby-mode (function :value ruby-ts-mode)))
> >
> > This :options hunk is a nice illustration, but if it's a serious proposal
> > I wonder which set of modes would be appropriate to have here. All or most
> > ts modes?
>
> Probably the list of all ts-modes would be too long.
> I can count 28 ts-modes in Emacs core.
If the list starts with "All" and "None", the length of the rest is of
secondary importance.
But more generally, this clearly shows limitations of Customize for
large or complex data structures. We should perhaps consider a user
command that shows a dialog box or a child frame with checkbox for
each remapping, letting users just click or press RET on those they
want.
> > Note we still won't be able to cover all tree-sitter modes this way because
> > a large part of them doesn't have any corresponding "traditional" modes and
> > so no existing auto-mode-alist entries.
>
> Such ts-modes can be associated with a non-ts placeholder
> like this wishlist item in lisp/progmodes/go-ts-mode.el:
>
> ;; FIXME: Should we instead put `go-mode' in `auto-mode-alist'
> ;; and then use `major-mode-remap-defaults' to map it to `go-ts-mode'?
> (add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode))
Alternatively, we could use a command that allows to activate one or
more tree-sitter modes, regardless of whether there are alternative
modes. For modes which have no alternatives, such a command will just
set up auto-mode-alist.
- Re: Turning on/off tree-sitter modes, (continued)
- Re: Turning on/off tree-sitter modes, Juri Linkov, 2024/11/27
- Re: Turning on/off tree-sitter modes, Dmitry Gutov, 2024/11/27
- Re: Turning on/off tree-sitter modes, Juri Linkov, 2024/11/28
- Re: Turning on/off tree-sitter modes, Dmitry Gutov, 2024/11/28
- Re: Turning on/off tree-sitter modes, Juri Linkov, 2024/11/28
- Re: Turning on/off tree-sitter modes, Dmitry Gutov, 2024/11/28
- Re: Turning on/off tree-sitter modes, Juri Linkov, 2024/11/29
- Re: Turning on/off tree-sitter modes,
Eli Zaretskii <=
- Re: Turning on/off tree-sitter modes (was: An anonymous IRC user's opinion), Richard Stallman, 2024/11/25
- Re: Turning on/off tree-sitter modes (was: An anonymous IRC user's opinion), Eli Zaretskii, 2024/11/26
- Re: Turning on/off tree-sitter modes, Stefan Monnier, 2024/11/29
- Re: Turning on/off tree-sitter modes, Dmitry Gutov, 2024/11/29
- Re: Turning on/off tree-sitter modes, Eli Zaretskii, 2024/11/30
- Re: Turning on/off tree-sitter modes, Stefan Monnier, 2024/11/30
- Re: Turning on/off tree-sitter modes, Juri Linkov, 2024/11/30
- Re: An anonymous IRC user's opinion, Juri Linkov, 2024/11/19
- Re: An anonymous IRC user's opinion, Dmitry Gutov, 2024/11/19
- Re: An anonymous IRC user's opinion, Philip Kaludercic, 2024/11/20