diff options
| author | Dmitry Gutov | 2024-12-26 02:53:05 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2024-12-26 02:53:05 +0200 |
| commit | 704aa2b6ebaa0e19f72dcc2e8c0f1a02aa6eadbb (patch) | |
| tree | 5cedfffc66450a6ee3752398d7a0b7e2caceab6c | |
| parent | e96727f0ea0986bffe7ff235e5abc5354e63a64d (diff) | |
| download | emacs-704aa2b6ebaa0e19f72dcc2e8c0f1a02aa6eadbb.tar.gz emacs-704aa2b6ebaa0e19f72dcc2e8c0f1a02aa6eadbb.zip | |
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.
| -rw-r--r-- | lisp/progmodes/ruby-ts-mode.el | 8 |
1 files changed, 7 insertions, 1 deletions
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." | |||
| 1120 | (equal (treesit-node-type (treesit-node-child node 0)) | 1120 | (equal (treesit-node-type (treesit-node-child node 0)) |
| 1121 | "("))) | 1121 | "("))) |
| 1122 | 1122 | ||
| 1123 | (defun ruby-ts--sexp-list-p (node) | ||
| 1124 | ;; Distinguish between the named `unless' node and the | ||
| 1125 | ;; node with the same value of type. | ||
| 1126 | (when (treesit-node-check node 'named) | ||
| 1127 | (ruby-ts--sexp-p node))) | ||
| 1128 | |||
| 1123 | (defvar-keymap ruby-ts-mode-map | 1129 | (defvar-keymap ruby-ts-mode-map |
| 1124 | :doc "Keymap used in Ruby mode" | 1130 | :doc "Keymap used in Ruby mode" |
| 1125 | :parent prog-mode-map | 1131 | :parent prog-mode-map |
| @@ -1235,7 +1241,7 @@ leading double colon is not added." | |||
| 1235 | "array" | 1241 | "array" |
| 1236 | "hash") | 1242 | "hash") |
| 1237 | eol) | 1243 | eol) |
| 1238 | #'ruby-ts--sexp-p)) | 1244 | #'ruby-ts--sexp-list-p)) |
| 1239 | (text ,(lambda (node) | 1245 | (text ,(lambda (node) |
| 1240 | (or (member (treesit-node-type node) | 1246 | (or (member (treesit-node-type node) |
| 1241 | '("comment" "string_content" "heredoc_content")) | 1247 | '("comment" "string_content" "heredoc_content")) |