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: Sat, 23 Nov 2024 19:51:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)

>>> How about if that's done like:
>>>
>>>     (setopt treesit-enable-modes '(c-ts-mode))
>>>
>>> Or maybe 'M-x treesit-add-enabled-mode' can be added too.
>> I think a command is better.
>
> Okay. It can read the mode name with completion, and then call
>
>   (setopt treesit-enable-modes (cons new-mode treesit-enable-modes))

Recently Philip rightly noticed that 'major-mode-remap-alist'
would be sufficient.  And indeed, such a command could be implemented
just as

  (defun treesit-add-enabled-mode (non-ts-mode ts-mode)
    (setopt major-mode-remap-alist
            (cons (cons non-ts-mode ts-mode)
                  major-mode-remap-alist)))

Or the idea was to simplify this by using only ts-mode here
while maintaining a huge database of non-ts → ts mappings
in an internal variable?  (that will eventually grow
into something like 'eglot-server-programs')



reply via email to

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