From: Dmitry Gutov Date: Thu, 26 Dec 2024 00:53:05 +0000 (+0200) Subject: ruby-ts-mode: Refine the forward-sexp improvement X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4fe8c52327013c85cc672d7cbd5f2f72b40e3011;p=emacs.git ruby-ts-mode: Refine the forward-sexp improvement * 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) --- diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 4ef0cb18eae..a6fe39da45f 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -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"))