]> git.eshelyaron.com Git - emacs.git/commitdiff
ruby-ts-mode: Refine the forward-sexp improvement
authorDmitry Gutov <dmitry@gutov.dev>
Thu, 26 Dec 2024 00:53:05 +0000 (02:53 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:34:09 +0000 (16:34 +0100)
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--sexp-list-p):
New function (bug#73404).
(ruby-ts-mode): Use it in sexp-list thing definition.

(cherry picked from commit 704aa2b6ebaa0e19f72dcc2e8c0f1a02aa6eadbb)

lisp/progmodes/ruby-ts-mode.el

index 4ef0cb18eae57b73ab3858504e0d5493f0a64ecd..a6fe39da45fad04b0baca91bfc88f3bac68e9074 100644 (file)
@@ -1120,6 +1120,12 @@ leading double colon is not added."
       (equal (treesit-node-type (treesit-node-child node 0))
              "(")))
 
+(defun ruby-ts--sexp-list-p (node)
+  ;; Distinguish between the named `unless' node and the
+  ;; node with the same value of type.
+  (when (treesit-node-check node 'named)
+    (ruby-ts--sexp-p node)))
+
 (defvar-keymap ruby-ts-mode-map
   :doc "Keymap used in Ruby mode"
   :parent prog-mode-map
@@ -1235,7 +1241,7 @@ leading double colon is not added."
                            "array"
                            "hash")
                           eol)
-                         #'ruby-ts--sexp-p))
+                         #'ruby-ts--sexp-list-p))
                  (text ,(lambda (node)
                           (or (member (treesit-node-type node)
                                       '("comment" "string_content" "heredoc_content"))