From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar Date: Sun, 15 Jan 2023 18:39:56 -0800 Message-ID: <1B32D81E-3647-4FCA-A1C8-AFD8AFC96E78@gmail.com> References: <87sfhf5ghj.fsf@dfreeman.email> <6a7f5a94-b2cd-c6b8-1267-87da1c6303e1@yandex.ru> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="24271"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60127@debbugs.gnu.org, Danny Freeman To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 16 03:41:26 2023 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 1pHFR8-00069S-1J for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Jan 2023 03:41:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHFQm-0004Ti-0k; Sun, 15 Jan 2023 21:41:04 -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 1pHFQk-0004TY-9m for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2023 21:41:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHFQk-0007jS-2U for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2023 21:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHFQj-0006hw-LY for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2023 21:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Jan 2023 02:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60127 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: pending Original-Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.167383680625710 (code B ref 60127); Mon, 16 Jan 2023 02:41:01 +0000 Original-Received: (at 60127) by debbugs.gnu.org; 16 Jan 2023 02:40:06 +0000 Original-Received: from localhost ([127.0.0.1]:60024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHFPq-0006gc-Cd for submit@debbugs.gnu.org; Sun, 15 Jan 2023 21:40:06 -0500 Original-Received: from mail-pl1-f170.google.com ([209.85.214.170]:39849) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHFPn-0006g2-Uk for 60127@debbugs.gnu.org; Sun, 15 Jan 2023 21:40:05 -0500 Original-Received: by mail-pl1-f170.google.com with SMTP id z13so1119845plg.6 for <60127@debbugs.gnu.org>; Sun, 15 Jan 2023 18:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IpuB4coZ6teP5+aOWNYMp8w5aRYYsqEm3UfnCfe1zfI=; b=BY6e0wQAkIcm2qcW3l9u2TDlYNTTk5mNaKDY7ssJTLS1jXYSIzY91Rhxx2OvobOhKA TkDYI2mTgd+cxey+XZD9X3EfMGoZolwueXCkkxnT1EA9VkT0d4z1WcvRfLbNCmZNgm3J 8Y0nP03G6SKaeuILfl/4zU/nezvqbLkTINT7JKm7Vt8Ds/5bcejGbUVm2NyWmpXADKk2 9lclvqOcO/TXAAODVd1iFEE+rBdkAd6IAx7kniAZ8HPgu2p92FM0oTekHKHnCjTDx4R+ Ws8CQIy92lDt1yCVLeOTZqX1ou0fQMO7pSU0kxATZIVuCxADWjIdxfCMuvFEiX6cKSDe WAow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IpuB4coZ6teP5+aOWNYMp8w5aRYYsqEm3UfnCfe1zfI=; b=nWP8rY0nEG2tBTzD770rAVynQVLggAS6vGNB9akAc9TGwCecwbPd/dpMiJleUhq9Vw 4ztP+L0FJelhylbZ6P/0Huc/0nUY+Iq6nLYtGm1OpIrtBQ1ZYlaBbaeXVD7AoEEr6PB2 kIYUpbC2OycNZsmoL0MTs+g8NhDX2g3mHLviR7nd5kQneWjyWXFjWGCihKMM9EOD0Buy w0nuG84pnejxgItU+8t0IBoatKV1nfdVwOsUsvQ4XLymVp0NcM0X6hu52W3ndD+9z6GX mghWW/XHgktzBydShFozUY55XXvBdSODeD/7qFhtOYhoS11CJ19d+5EW7Q0T/tn04T/m sIUw== X-Gm-Message-State: AFqh2kp+L9Om7tZBscXoQuFlr1cE+Y4pJfgyDy4KgU3RihhFzaSA2Ozx uj86mMocAnHVUpXx24PPFvg= X-Google-Smtp-Source: AMrXdXtKiz+V9HSq+AUKo5ozT7Is8noht8Ifc9QQMkJ5A1dWCAXXzzBSMlFg8gO/RD5ZwWP64hMSkA== X-Received: by 2002:a05:6a20:669a:b0:b8:5eb4:a817 with SMTP id o26-20020a056a20669a00b000b85eb4a817mr4775549pzh.44.1673836798054; Sun, 15 Jan 2023 18:39:58 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id bg7-20020a056a02010700b004785c24ffb4sm5816699pgb.26.2023.01.15.18.39.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Jan 2023 18:39:57 -0800 (PST) In-Reply-To: <6a7f5a94-b2cd-c6b8-1267-87da1c6303e1@yandex.ru> X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:253460 Archived-At: > On Jan 15, 2023, at 5:56 PM, Dmitry Gutov wrote: >=20 > On 22/12/2022 10:55, Yuan Fu wrote: >> Danny Freeman writes: >>> Yuan, >>>=20 >>>>> Thank you very much for this detailed report! This seems to be = some >>>>> problem with either tree-sitter or tree-sitter-clojure, where >>>>> treesit-node-first-child-for-pos gives wrong result. We=E2=80=99ve = had similar >>>>> problem with bash before[1]. >>>>>=20 >>>>> At this point there aren=E2=80=99t much we can do in Emacs. If I = find some time >>>>> I=E2=80=99ll make a reproduce recipe and submit an issue on = tree-sitter-clojure. >>>>>=20 >>>>> [1]https://github.com/tree-sitter/tree-sitter-bash/issues/139 >>>>>=20 >>>>> Yuan >>> I have a c program that I believe reproduces the problem. I'm not = sure >>> how we will go about fixing it in tree-sitter-clojure, but at least = we >>> have a minimal way to re-create it. >>>=20 >>> Here is a link to the issue I created: >>> https://github.com/sogaiu/tree-sitter-clojure/issues/32 >>> that also includes the c-program. I've also put it on my source hut >>> = https://paste.sr.ht/~dannyfreeman/8786059276c334036877159a5b0872cd2aa6fbc0= =20 >>> If you find the time, I would appreciate it if you could confirm my >>> findings. I'm a little in over my head with this bug I'm afraid. >> I think it=E2=80=99s pretty good (the reproduce), the author=E2=80=99s = modified program >> is even better. Let=E2=80=99s wait and see what tree-sitter=E2=80=99s = author have to >> say. >=20 > Just to keep everyone of the same page: >=20 > clojure-tree-sitter's author posted an issue to tree-sitter last week: = https://github.com/tree-sitter/tree-sitter/issues/2012 >=20 > and, previously, he also suggested we might be able to work around it = using treesit_search_dfs: = https://github.com/sogaiu/tree-sitter-clojure/issues/32#issuecomment-13648= 30835 I=E2=80=99d rather not use treesit_search_dfs, as it does much more work = than the current code. You know what, I can write a custom = ts_node_first_child_for_byte and use that in Emacs, I=E2=80=99ve already = done that for ts_node_parent anyway. Yuan=