From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#68993: treesitter support for forward-sexp-default-function Date: Sat, 10 Feb 2024 19:46:46 +0200 Organization: LINKOV.NET Message-ID: <86a5o86wl5.fsf@mail.linkov.net> References: <86y1bv6jsm.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33065"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 68993@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 10 18:50:02 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rYrUI-0008WP-Bb for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 10 Feb 2024 18:50:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYrU6-0002Xl-Ps; Sat, 10 Feb 2024 12:49:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYrU3-0002XI-Tb for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2024 12:49:47 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYrU2-0000BG-Gm for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2024 12:49:47 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rYrUI-0006QE-5a for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2024 12:50:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Feb 2024 17:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68993 X-GNU-PR-Package: emacs Original-Received: via spool by 68993-submit@debbugs.gnu.org id=B68993.170758738124619 (code B ref 68993); Sat, 10 Feb 2024 17:50:02 +0000 Original-Received: (at 68993) by debbugs.gnu.org; 10 Feb 2024 17:49:41 +0000 Original-Received: from localhost ([127.0.0.1]:57738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYrTx-0006P0-8x for submit@debbugs.gnu.org; Sat, 10 Feb 2024 12:49:41 -0500 Original-Received: from relay9-d.mail.gandi.net ([2001:4b98:dc4:8::229]:53363) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYrTu-0006OZ-Tn for 68993@debbugs.gnu.org; Sat, 10 Feb 2024 12:49:39 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id D8E9DFF803; Sat, 10 Feb 2024 17:49:15 +0000 (UTC) In-Reply-To: <86y1bv6jsm.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 08 Feb 2024 19:38:17 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279772 Archived-At: 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