[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#68993: treesitter support for forward-sexp-default-function
From: |
Juri Linkov |
Subject: |
bug#68993: treesitter support for forward-sexp-default-function |
Date: |
Sat, 10 Feb 2024 19:46:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
Hi Yuan,
Do you think 'comment' is a suitable name for 'treesit-forward-sexp'?
I'm unsure even if 'text' is a good name for 'treesit-forward-sentence'.
But at least these two should be consistent with each another.
Maybe better to add the prefix 'default-' to both?
This will hint that the default function is used.
Then 'treesit-forward-sentence' will support types
'sentence' and 'default-sentence'.
And 'treesit-forward-sexp' will support types
'sexp' and 'default-sexp'.
> @@ -2137,7 +2137,10 @@ treesit-forward-sexp
> (interactive "^p")
> (let ((arg (or arg 1))
> (pred (or treesit-sexp-type-regexp 'sexp)))
> - (or (if (> arg 0)
> + (or (when (treesit-node-match-p (treesit-node-at (point)) 'comment t)
> + (funcall #'forward-sexp-default-function arg)
> + t)
> + (if (> arg 0)
> (treesit-end-of-thing pred (abs arg) 'restricted)
> (treesit-beginning-of-thing pred (abs arg) 'restricted))
> ;; If we couldn't move, we should signal an error and report