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#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes Date: Thu, 05 Dec 2024 21:53:38 +0200 Organization: LINKOV.NET Message-ID: <87jzcdlxdp.fsf@mail.linkov.net> References: <87plox4mtp.fsf@masteringemacs.org> <87frpm20t7.fsf@masteringemacs.org> <8634lmbs8t.fsf@gnu.org> <87bk0a1u0o.fsf@masteringemacs.org> <86tte2a5o3.fsf@gnu.org> <877cay1lqt.fsf@masteringemacs.org> <86frpma06f.fsf@gnu.org> <86ikueiekp.fsf@mail.linkov.net> <86ed4zg1cc.fsf@mail.linkov.net> <87zflac68t.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="34872"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: Eli Zaretskii , Mickey Petersen , 73404@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 05 20:56:32 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 1tJHxf-0008t2-TT for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Dec 2024 20:56:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJHxQ-00012m-1X; Thu, 05 Dec 2024 14:56:17 -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 1tJHxD-0000yA-Pw for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 14:56:04 -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 1tJHxC-0008Fc-ER for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 14:56:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=i5idlk6JXWnFqHnQYvetX1DmjqCajuX+gYN4//t0PAA=; b=IUqkWqUuCiIaz+Q36TR+8DtRuKY7kxQNNP8hR4cUUje5if646DKImmUiLIBtoKRRXyXz0PWTK9MNwS6F4YqVQkGlCYYDKAMkvKsV9oC244D144eWG6Bjgwr2L2eVMAvd6THuYwAsaNByVhBLJ3THXaCJCknUt1QclDjtZUnwWTFk11u7PFSdfBcgFnHqgy3HykjQMPkZpzWFtxE3O6Oyb4AGF1IsJtqu5DQrqJMNCMLvgsM6FEWUqR08y02PeHYauA8uhsKHuwebBXyhYN8geWJYK7A0+G0bbFRekJ88nZMKIRAmhdyl0zx3U5N/oqehC4Ffwgw9Nt71saNtjRfhsw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tJHxC-0008MN-4p for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 14:56: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: Thu, 05 Dec 2024 19:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73404 X-GNU-PR-Package: emacs Original-Received: via spool by 73404-submit@debbugs.gnu.org id=B73404.173342850231674 (code B ref 73404); Thu, 05 Dec 2024 19:56:02 +0000 Original-Received: (at 73404) by debbugs.gnu.org; 5 Dec 2024 19:55:02 +0000 Original-Received: from localhost ([127.0.0.1]:41055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJHwE-0008En-Di for submit@debbugs.gnu.org; Thu, 05 Dec 2024 14:55:02 -0500 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:59373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJHwC-0008EB-Fc for 73404@debbugs.gnu.org; Thu, 05 Dec 2024 14:55:01 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 60D2BFF805; Thu, 5 Dec 2024 19:54:51 +0000 (UTC) In-Reply-To: <87zflac68t.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 05 Dec 2024 20:52:18 +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:296482 Archived-At: >> The new logic is the following: if there is no sexp thing defined at point, >> then fall back to 'forward-sexp-default-function'. >> >> Then after (setq js--treesit-sexp-nodes '("binary_expression")) >> 'C-M-f' in e.g. >> >> export const add = (a, b) => -!-a + b; >> >> moves point to >> >> export const add = (a, b) => a + b-!-; > > Unfortunately, I still can't find a way to handle such case > that from > > export const add = (a, b) -!- => a + b; > > typing 'C-M-f' should jump to the end of the next sexp > (to the end of whole "binary_expression"): > > export const add = (a, b) => a + b-!-; > > since only tree-sitter knows about "binary_expression", > so 'forward-sexp-default-function' can't be used here. Actually, I have one idea of possible heuristics: 1. first try 'forward-sexp-default-function' 2. if it crosses the boundary of sexp defined by 'treesit-thing-settings' then use 'treesit-end-of-thing' instead This should work. Ok, will try.