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: Dmitry Gutov
Subject: Re: Turning on/off tree-sitter modes
Date: Tue, 26 Nov 2024 02:35:16 +0200
User-agent: Mozilla Thunderbird

On 25/11/2024 14:09, Eli Zaretskii wrote:
Date: Mon, 25 Nov 2024 02:44:52 +0200
Cc: johan.myreen@gmail.com, emacs-devel@gnu.org
From: Dmitry Gutov <dmitry@gutov.dev>

On 24/11/2024 20:56, Eli Zaretskii wrote:
    major-mode-remap-alist:
    INS DEL Key: js-mode
            Value: js-ts-mode
    INS DEL Key: ruby-mode
            Value: ruby-ts-mode
In addition, I personally find this UI quite perplexing, and kinda
doubt users who use it will understand what "Key" and "value" mean in
this case.

We could add more detailed annotations to those customization fields, so
it could look more like this, for example:

    Major Mode Remap Alist:
    Repeat:
    INS DEL Cons-cell:
                Mode to map from: js-mode
                Function to call instead: js-ts-mode

I think this would be a big step in the right direction.

Bonus points for replacing "Repeat" and "Cons-cell" with something
more user-friendly, like "Set of remappings" and "Remap", for example.

Maybe like this:

  Major Mode Remap Alist:
  List of remappings:
  INS DEL Remap:
              From major mode: js-mode
              To mode (or function): js-ts-mode


diff --git a/lisp/files.el b/lisp/files.el
index 9c105dbe1a5..879faa563ad 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3606,7 +3606,10 @@ major-mode-remap-alist
 FUNCTION is typically a major mode which \"does the same thing\" as
 MODE, but can also be nil to hide other entries (either in this var or
 in `major-mode-remap-defaults') and means that we should call MODE."
-  :type '(alist (symbol) (function)))
+  :type '(repeat :tag "List of remappings"
+          (cons :tag "Remap"
+           (symbol :tag "From major mode")
+           (function :tag "To mode (or function)"))))

 (defvar major-mode-remap-defaults nil
   "Alist mapping file-specified modes to alternative modes.




reply via email to

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