From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#68899: Treesitter's forward-sexp-function Date: Fri, 2 Feb 2024 21:47:33 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30804"; mail-complaints-to="usenet@ciao.gmane.io" To: 68899@debbugs.gnu.org, casouri@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 02 22:49:17 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 1rW1PR-0007of-B2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Feb 2024 22:49:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rW1P2-0007Zb-Ca; Fri, 02 Feb 2024 16:48:52 -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 1rW1P1-0007Wb-6a for bug-gnu-emacs@gnu.org; Fri, 02 Feb 2024 16:48:51 -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 1rW1P0-0003IH-RI for bug-gnu-emacs@gnu.org; Fri, 02 Feb 2024 16:48:50 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rW1PB-0005mT-OO for bug-gnu-emacs@gnu.org; Fri, 02 Feb 2024 16:49:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Feb 2024 21:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68899 X-GNU-PR-Package: emacs X-Debbugs-Original-To: "simon254--- via Bug reports for GNU Emacs, the Swiss army knife of text editors" , Yuan Fu Original-Received: via spool by submit@debbugs.gnu.org id=B.170691048721880 (code B ref -1); Fri, 02 Feb 2024 21:49:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Feb 2024 21:48:07 +0000 Original-Received: from localhost ([127.0.0.1]:45619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rW1OJ-0005gn-33 for submit@debbugs.gnu.org; Fri, 02 Feb 2024 16:48:07 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:49156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rW1OH-0005fq-6k for submit@debbugs.gnu.org; Fri, 02 Feb 2024 16:48:05 -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 1rW1O0-000790-VK for bug-gnu-emacs@gnu.org; Fri, 02 Feb 2024 16:47:48 -0500 Original-Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rW1Nz-0002kH-GL for bug-gnu-emacs@gnu.org; Fri, 02 Feb 2024 16:47:48 -0500 Original-Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5101cd91017so3240345e87.2 for ; Fri, 02 Feb 2024 13:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706910465; x=1707515265; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4hZGgkrneS6hxRxrkJ+sFJeBcU0mWkqxsZZUEpIfulo=; b=nAjC2hqWYHBrVR/7ii5p4/6Cb1Xph8ZDu4nhkpPKP0z/A8R6lbfejYodj6eTDZWNAH grB8IXOtiTsyT8masuKbyNWt22s9jNFJW3jKL4RmaQEBv9rPj3AfSIfWkH5yzQv6Bk+A YhLCT9FDUjTTzYbIRnLDbS25yb170y98vNJEUEyvDDnlHzoLT8x5Ufewv/mHOeF/XVSs 1wMG4RGuNyQYuxXguwe3yUEbdDvIAniQsJwQQOypXMzRNmJNEy6SnUCOp+jGTc3okRAH RL/KGtcNfHIlecfCz+80WdbogjKt0yt8TlOY9V1nWaEDGJ2W0EdwvaaoBb3zjG0+wzN+ hMyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706910465; x=1707515265; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4hZGgkrneS6hxRxrkJ+sFJeBcU0mWkqxsZZUEpIfulo=; b=EqP56lnIIroS5OMquT3rkUsPbjoeHAyVhgrWsjP5vpw3Wsm4cQA3snqoBjEaAJNGTp +dftgtWyUp6j3/LoBb4bY1aU1gFlbQcqdzUL/19g9ZiuQOPNG3z/QF0qgPYyiPsqpf0c Pd/6mivL5LOCNsVky1XHI1V91VpEq9wIHOGOltr0dDPxWc9qGUem4LMl8zfQjr28/Dk8 OmQzvJJwfMpAMRq/YtCl/DtVzITHskpDORPEZqOKKFiAiewv7wKB47bNK+7m46ifJbOg 21IhPAEAkfYX5foG6BOpLU7dwAHFXBH2dC7bXpU+g8qnRH2KfIuXVjJoTvkLwYjwLEX1 R61g== X-Gm-Message-State: AOJu0YwStdQqIcw+kXLlk42EjHSi9AuC8hfDosrLp9Cm4AtTuFMeY6JQ Fonww9BcjzvcBpeK2gL+RFbs1L1Xtr1cMbqqQU4AqBcvMozjslJ8gymxq46v68b5hJ0m1BJVo6n /v20x5uPp6zL6L01vlpKFEQL2RsDh1Qk+bl8= X-Google-Smtp-Source: AGHT+IEFF8nDU3MIib7pAhwXQbdA8Z2ac5609UUe/BpOpDCcH68O5Vq7O23Y7HKxSz9okry96Z5w9TkENNAX9z5HA6Y= X-Received: by 2002:a05:6512:234f:b0:50e:9355:a24b with SMTP id p15-20020a056512234f00b0050e9355a24bmr5350863lfu.22.1706910464707; Fri, 02 Feb 2024 13:47:44 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:279353 Archived-At: Hello Yuan, In c++-mode, python-mode, and all other modes I know, pressing C-M-f with point anywhere in the characters of a symbol brings you to the end of that symbol. In c++-ts-mode it only does something if you're in the beginning of the symbol. Everywhere else point stays where it is. I know there are some intended differences for c++-ts-mode's forward-sexp-function vs c++-mode's, but would this be one such difference? Here's a quick repro, in case you don't follow emacs -Q /tmp/something.cpp -f c++-ts-mode int main() {} If point is 5 (on the 'm' of main), C-M-f will bring me to the space after the closing ')'. This is different from c++-mode, but I think I can learn to live with this, in fact I think I like it. However if point is anywhere on 'ain', point stays put, and that's very jarring when compared to every other mode I've ever worked with in Emacs. Shouldn't the intervening treesit-end-of-thing go to the end of the current thing?, i.e. to the '('? I think it should, at least judging from its docstring, and this patch makes that happen: - (setq pos (funcall advance (if (> arg 0) next prev))) + (setq pos (funcall advance (or (if (> arg 0) next prev) + parent))) This doesn't seem to break tests, assuming it's not in these 3 there were skipped because I don't have the grammar installed. s treesit-defun-navigation-nested-3 s treesit-defun-navigation-nested-4 s treesit-multi-lang If this patch isn't acceptable, is it possible to make this customizable somehow? I know I can set forward-sexp-function to something else, but I now am actually getting used to this f-s-f, only this bit is putting me off. Jo=C3=A3o