emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turning on/off tree-sitter modes


From: Juri Linkov
Subject: Re: Turning on/off tree-sitter modes
Date: Thu, 28 Nov 2024 21:34:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)

>>>>>      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.

>> +  :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.

> 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]