|
From: | Dmitry Gutov |
Subject: | Re: Turning on/off tree-sitter modes |
Date: | Thu, 28 Nov 2024 21:51:16 +0200 |
User-agent: | Mozilla Thunderbird |
On 28/11/2024 21:34, Juri Linkov wrote:
Major Mode Remap Alist: List of remappings: INS DEL Remap from major mode: js-mode To mode (or function): js-ts-modeHere mode names are nicely aligned, so it's easier to read for users.- :offset 12 + :offset 9Maybe 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.
Technically it could be done using pixelwise space specs, (info "(elisp) Specified Space"), but it might be not obvious how to define that behavior through widget specs first.
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.
Could we decide on a smaller subset?
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))
I guess if we're okay with "Ignoring unknown mode" errors and prefer them over "Cannot activate tree-sitter" errors, which are admittedly more verbose.
[Prev in Thread] | Current Thread | [Next in Thread] |