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#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode Date: Fri, 27 Dec 2024 09:42:47 +0200 Organization: LINKOV.NET Message-ID: <87ttaptws8.fsf@mail.linkov.net> References: <87plox4mtp.fsf@masteringemacs.org> <87zflac68t.fsf@mail.linkov.net> <87jzcdlxdp.fsf@mail.linkov.net> <87o71jocgs.fsf@mail.linkov.net> <5192B278-66C0-48AE-B881-E57CCBB6B501@gmail.com> <87frmtbc9z.fsf@mail.linkov.net> <86bjxh1h86.fsf@gnu.org> <87y10l8h6k.fsf@mail.linkov.net> <87ldwl8g60.fsf@mail.linkov.net> <87wmg53rdj.fsf@mail.linkov.net> <87a5d0n651.fsf@mail.linkov.net> <87zfktphks.fsf@mail.linkov.net> <87ttb0rwni.fsf_-_@mail.linkov.net> <4DFCFBC8-A353-48F2-8257-D6CFB155A030@gmail.com> <87ttatpnii.fsf@mail.linkov.net> <8abcb53c-1636-450d-ac0c-fdf44566ab95@gutov.dev> <87cyhg2nyu.fsf@mail.linkov.net> <8dc10f82-4400-4924-bb6b-dcd98bcb598d@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6145"; 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: Yuan Fu , 74963@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 27 08:47:19 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 1tR543-0001Qk-A0 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Dec 2024 08:47:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tR53q-00043g-9c; Fri, 27 Dec 2024 02:47:06 -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 1tR53n-00043G-0y for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 02:47:03 -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 1tR53m-0000Mz-Om for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 02:47:02 -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=hiAtbkSy4klD6LY4DnKbE3AAMY31fFosT8EsANuiKMw=; b=A9lXBxne4n7CwcjDrnjyxI9xEZEZ8eWWrUGTCG0xROdzQdmI1R+2l5Q8rHm+8+ehdrObqYxRDji46CJE3+KbWgRqpXdYy1/VID3Hn3dwmiaA8hS0xbowe77QeejcEiWOSXTB10zBvfS/upwIjlS2Q+vqezijTgv5SVsHaBg8X73qHzrTBo+JsMVKvMvfTXxkb+PbyUdD9gLipPre+cE07zJxPcEfHEFWyvJprgvnE/Sem5jRnTOVVB0OTQI4v3gtUFicMnTphLwImqM2pQX9M3820C51ehtcCJmFVJfeM+tG+t4MAqm1S1QTRe/15wk/UNIkcsmW1RQJevzZQZrKZw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tR53m-0001Ac-IE for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 02:47: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: Fri, 27 Dec 2024 07:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74963 X-GNU-PR-Package: emacs Original-Received: via spool by 74963-submit@debbugs.gnu.org id=B74963.17352855864435 (code B ref 74963); Fri, 27 Dec 2024 07:47:02 +0000 Original-Received: (at 74963) by debbugs.gnu.org; 27 Dec 2024 07:46:26 +0000 Original-Received: from localhost ([127.0.0.1]:44551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR53B-00019S-L1 for submit@debbugs.gnu.org; Fri, 27 Dec 2024 02:46:25 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:50321) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR53A-00019D-GX for 74963@debbugs.gnu.org; Fri, 27 Dec 2024 02:46:24 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 3F52D1BF206; Fri, 27 Dec 2024 07:45:54 +0000 (UTC) In-Reply-To: <8dc10f82-4400-4924-bb6b-dcd98bcb598d@gutov.dev> (Dmitry Gutov's message of "Thu, 26 Dec 2024 03:00:38 +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:297809 Archived-At: >>> Given that we're already calling a predicate every time (in >>> ruby-ts-mode), we might as well add one more check. See the patch at the >>> end. >> Thanks, I tried the patch. It was broken, so needed to edit manually. > > Maybe something regarding whitespace at the end? Something with whitespace, but not a big problem. >> Also the new key 'w' doesn't work in diff buffers, need to fix it as well. > > The binding for 'diff-kill-ring-save'? Seems to work here, as long as the > diff buffer is in read-only mode. Yes, 'W' with 'diff-kill-ring-save'. Single keys are still a problem in visited diff files. >>> Adding the check for "named" fixes the first two cases, but then C-M-f >>> inside "def" jumps to after "baaz". Could be worked around with a >>> special case, but I wonder what this difference comes from (haven't >>> properly debugged yet). >> I see no problems with your patch. Everything works nicely. > > Hmm, I can't reproduce it either anymore. > > Thanks for testing, pushed to master now (unfortunately the commit message > refers to bug#73404). Thanks. Maybe a helper for other ts-modes will be handy: (defun treesit-node-named (node) (treesit-node-check node 'named)) to be used like this (sexp ,(cons (treesit-match-nodes strings) 'treesit-node-named))