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: Thu, 28 Nov 2024 20:50:27 +0200
User-agent: Mozilla Thunderbird

On 28/11/2024 09:58, Juri Linkov wrote:
I'd prefer

     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.

I think the forms for alist's values are extra indented intentionally. But
it's not the best for aesthetics, I suppose.

I don't know why there is extra indentation in widget.
If offset is reduced from 12 to 9, this provides
better aesthetics with:

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index ba99847f488..bc12e26ac22 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -2862,7 +2865,7 @@ 'editable-list
    "A variable list of widgets of the same type."
    :convert-widget 'widget-types-convert-widget
    :copy 'widget-types-copy
-  :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.

    :format "%v%i\n"
    :format-handler 'widget-editable-list-format-handler
    :entry-format "%i %d %v"
diff --git a/lisp/files.el b/lisp/files.el
index a65bc4a4ea2..7ac22eac2fb 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3621,10 +3621,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
-          :tag "Remappings"
-          :key-type (symbol :tag "From major mode")
-          :value-type (function :tag "To mode (or function)")))
+  :type '(alist :key-type   (symbol   :tag "Remap from major mode"))
+                :value-type (function :tag "To mode (or function)"))
+  :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?

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.



reply via email to

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