From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Dec 2022 18:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60127 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 60127@debbugs.gnu.org Cc: Yuan Fu X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167121676721019 (code B ref -1); Fri, 16 Dec 2022 18:53:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 Dec 2022 18:52:47 +0000 Received: from localhost ([127.0.0.1]:50972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Fp9-0005Sx-Ax for submit@debbugs.gnu.org; Fri, 16 Dec 2022 13:52:47 -0500 Received: from lists.gnu.org ([209.51.188.17]:33552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Fp7-0005Sr-HX for submit@debbugs.gnu.org; Fri, 16 Dec 2022 13:52:46 -0500 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 1p6Fp5-0008VB-Tg for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 13:52:45 -0500 Received: from out2.migadu.com ([188.165.223.204]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6Fp2-00038S-G3 for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 13:52:43 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1671216718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=q00+QnbtrpycSvThs451G9uGUUG9+aRS1x0DDK1N+BQ=; b=I/X8pI6CEKX3Ud9nVTCGhic/FScLZ9xC5061bKM4xvJ412OQBr4DfhPGbFthlNjbT/8IQE Hi4dcFehWaEoFJf403/0F70jSKq40xEmQ76yabXBGxNEtUsopI8v0YWfnJAjFIKwHxrJYT 31veWAgm3ygASptGKMtW76uAJKi/SQY= From: Danny Freeman Date: Fri, 16 Dec 2022 13:12:09 -0500 Message-ID: <87sfhf5ghj.fsf@dfreeman.email> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=188.165.223.204; envelope-from=Danny@dfreeman.email; helo=out2.migadu.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Hello, I have been running into what I believe is a bug with treesit-end-of-defun while developing clojure-ts-mode. There are some positions in clojure buffers where treesit-end-of-defun will jump to the end of the buffer. Steps to reproduce: Checkout the emacs-29 branch. I have built mine with commit b01d0246d71a7a3fd92b2864a3c0c0bc9367ee0b and tree-sitter version 0.20.7 Clone my clojure-mode fork: https://github.com/dannyfreeman/clojure-mode check out the `end-of-defun-bug` branch (master works too, but I added a helpful debug message in this branch) Clone tree-sitter-module repo: https://github.com/casouri/tree-sitter-module Apply the patch `tree-sitter-module-clojure-support.patch` located in clojure-mode repo to the casouri/tree-sitter-module repo. Build the treesitter parser for clojure with $ ./build clojure Start emacs $ emacs -q Evaluate the following, replacing the paths with what is relevant to your system ``` (progn (setq treesit-extra-load-path '("~/path/to/tree-sitter-module/dist")) (add-to-list 'load-path "~/path/to/clojure-mode/") (find-file "~/path/to/clojure-mode/clojure-ts-mode.el") (eval-buffer) (find-file "~/path/to/clojure-mode/test_end_of_defun.clj")) ``` Once you have opened test_end_of_defun.clj you can see the problem by pressing M-< C-M-e C-M-e You should see the cursor move from ``` |(def w 1) (def x 2) (def y 3) (def skip-to-here? 4) ``` to ``` (def w 1) | (def x 2) (def y 3) (def skip-to-here? 4) ``` then it unexpectedly jumps to the end of the buffer ``` (def w 1) (def x 2) (def y 3) (def skip-to-here? 4) | ``` The message buffer shows that when the point is between the forms ``` (def w 1) | (def x 2) ``` that `treesit-end-of-defun` thinks the current node is `(def skip-to-here? 4)`, which does not seem right. When the cursor is at other points in this buffer, this problem doesn't seem to occur. For instance, between the (def x 2) and (def y 3) forms, this doesn't happen. I can also see this happening in the `test.clj` file of the clojure-mode repo in a different spot but there is a lot more going on in that file. (hit C-M-e in it until the problem occurs if you are curious). I have the following vars relevant vars set in clojure-ts-mode. Different combinations of them yield the same results. ``` (setq-local treesit-defun-prefer-top-level t treesit-defun-tactic 'top-level treesit-defun-type-regexp (cons (rx (or "list_lit" "vec_lit" "map_lit")) (lambda (node) (message "Node: %s" (treesit-node-text node t)) t))) ``` The clojure code in question produces an error free parse tree. I can see it with `treesit-explore-mode` and by running the file through `tree-sitter parse`, which gives the following parse tree: ``` (source [0, 0] - [7, 0] (list_lit [0, 0] - [0, 9] value: (sym_lit [0, 1] - [0, 4] name: (sym_name [0, 1] - [0, 4])) value: (sym_lit [0, 5] - [0, 6] name: (sym_name [0, 5] - [0, 6])) value: (num_lit [0, 7] - [0, 8])) (list_lit [2, 0] - [2, 9] value: (sym_lit [2, 1] - [2, 4] name: (sym_name [2, 1] - [2, 4])) value: (sym_lit [2, 5] - [2, 6] name: (sym_name [2, 5] - [2, 6])) value: (num_lit [2, 7] - [2, 8])) (list_lit [4, 0] - [4, 9] value: (sym_lit [4, 1] - [4, 4] name: (sym_name [4, 1] - [4, 4])) value: (sym_lit [4, 5] - [4, 6] name: (sym_name [4, 5] - [4, 6])) value: (num_lit [4, 7] - [4, 8])) (list_lit [6, 0] - [6, 21] value: (sym_lit [6, 1] - [6, 4] name: (sym_name [6, 1] - [6, 4])) value: (sym_lit [6, 5] - [6, 18] name: (sym_name [6, 5] - [6, 18])) value: (num_lit [6, 19] - [6, 20]))) ``` Any help or advice here is appreciated. Thank you, -- Danny Freeman From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar References: <87sfhf5ghj.fsf@dfreeman.email> In-Reply-To: <87sfhf5ghj.fsf@dfreeman.email> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Dec 2022 23:21:02 +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: To: Danny@dfreeman.email Cc: 60127@debbugs.gnu.org Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.167123285631286 (code B ref 60127); Fri, 16 Dec 2022 23:21:02 +0000 Received: (at 60127) by debbugs.gnu.org; 16 Dec 2022 23:20:56 +0000 Received: from localhost ([127.0.0.1]:52116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6K0d-00088Y-Hj for submit@debbugs.gnu.org; Fri, 16 Dec 2022 18:20:55 -0500 Received: from mail-pl1-f182.google.com ([209.85.214.182]:40740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6K0b-00088S-9v for 60127@debbugs.gnu.org; Fri, 16 Dec 2022 18:20:53 -0500 Received: by mail-pl1-f182.google.com with SMTP id a9so3751289pld.7 for <60127@debbugs.gnu.org>; Fri, 16 Dec 2022 15:20:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=u98LpS0OOuWq7DdNWuW7V5Va56E8TYlbca8kA9ZTLFY=; b=iQ89sWEz11xBPLjwccJ9e7kjtwyARIJJ5kLc2d3ajts5Gr1Rf5FWSfEAnvGEB7wc8W Kg5nYDzjiiQjWzqu9rdNGsjABfPBrLeCws5GoNqLIUgQM9RW61Fl7uBm4sReLK0zCDOA cf8i8oQgPdyNzQ+zvwLJDhXtg3BIBamBluEZvVMsNQZbC1c7tjeJJxucL+xzgRcAE1xv hriWhEx5QeR+B/M18v2A4Hosrx7h5YWeuD/STNhPTS3OQFmiNL9E8mk3Wtlqmhb8XHn8 0ztt9Nc77psg6MPynrSwpLu7GOXkCBNxrCNGNbBrOJzInKaYG0Lv8pco7VZ1fTYFoi5f 1SWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u98LpS0OOuWq7DdNWuW7V5Va56E8TYlbca8kA9ZTLFY=; b=obMOsiUD4qKKEOF+boBhPZZiQEKG1vJz42unz5nA7c2Ic4sig3Bl79sV+/LkRLl2kO u/SF6lg0HFoQ7Mu9qsV8Cet76Kvps56vfHFy2azYBsfArFmvXrhAYeML5bYdYXDqwuiZ QzSwqBc63Bp4fob2mmZC5MSGQ/p/8c/kmAkMM5MXIrbDHz+Y0UbDAc58gusXvbfbrbmG ltAcA3LgvEHaVnMC1kIILM+qx9kHQkZqGxVg3yhQ1c5H7Y+98L9Ufle/keMJQlxt/0tv CUyvKZc3auMfzXibVcx8dR84gwfMNws+4p19q6a72vzVNUOzJzvurUy55kDXIFw6jncm dRlw== X-Gm-Message-State: ANoB5pnLyzmrEMcv7RqJlHOMMJUD6mdn93fqZtEkyXHvKJbjBbeNm5hM kPhnp7ygMLxXGeYtviaLr5Y5nWlofAeYTw== X-Google-Smtp-Source: AA0mqf6sDTlag2FzfQhAoKp9uZyXrTm+GQnYQkg0nJpk8PEiI2uvXAV4g11WB41Dq1h0hpe1WOwXkQ== X-Received: by 2002:a17:902:f10d:b0:18f:a447:2254 with SMTP id e13-20020a170902f10d00b0018fa4472254mr20514133plb.64.1671232847262; Fri, 16 Dec 2022 15:20:47 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id z6-20020a1709027e8600b00172973d3cd9sm2151472pla.55.2022.12.16.15.20.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Dec 2022 15:20:46 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Message-Id: <42357D6B-C983-4B1F-8857-8C990E848750@gmail.com> Date: Fri, 16 Dec 2022 15:20:43 -0800 X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Danny Freeman writes: > Hello, > > I have been running into what I believe is a bug with > treesit-end-of-defun while developing clojure-ts-mode. There are some > positions in clojure buffers where treesit-end-of-defun will jump to = the > end of the buffer. > > Steps to reproduce: > > Checkout the emacs-29 branch. I have built mine with commit > b01d0246d71a7a3fd92b2864a3c0c0bc9367ee0b and tree-sitter version = 0.20.7 > > Clone my clojure-mode fork: > https://github.com/dannyfreeman/clojure-mode > > check out the `end-of-defun-bug` branch (master works too, but I added > a helpful debug message in this branch) > > Clone tree-sitter-module repo: > https://github.com/casouri/tree-sitter-module > > Apply the patch `tree-sitter-module-clojure-support.patch` located in > clojure-mode repo to the casouri/tree-sitter-module repo. > > Build the treesitter parser for clojure with > > $ ./build clojure > > Start emacs > > $ emacs -q > > Evaluate the following, replacing the paths with what is relevant to > your system > > ``` > (progn > (setq treesit-extra-load-path = '("~/path/to/tree-sitter-module/dist")) > (add-to-list 'load-path "~/path/to/clojure-mode/") > (find-file "~/path/to/clojure-mode/clojure-ts-mode.el") > (eval-buffer) > (find-file "~/path/to/clojure-mode/test_end_of_defun.clj")) > ``` > > > Once you have opened test_end_of_defun.clj you can see the problem by > pressing > > M-< > C-M-e > C-M-e > > You should see the cursor move from > > ``` > |(def w 1) > > (def x 2) > > (def y 3) > > (def skip-to-here? 4) > ``` > > to > > ``` > (def w 1) > | > (def x 2) > > (def y 3) > > (def skip-to-here? 4) > ``` > > > then it unexpectedly jumps to the end of the buffer > > ``` > (def w 1) > > (def x 2) > > (def y 3) > > (def skip-to-here? 4) > | > ``` > > > The message buffer shows that when the point is between the forms > > ``` > (def w 1) > | > (def x 2) > ``` > > > that `treesit-end-of-defun` thinks the current node is > `(def skip-to-here? 4)`, which does not seem right. > > When the cursor is at other points in this buffer, this problem = doesn't > seem to occur. For instance, between the (def x 2) and (def y 3) = forms, > this doesn't happen. > > I can also see this happening in the `test.clj` file of the = clojure-mode > repo in a different spot but there is a lot more going on in that = file. > (hit C-M-e in it until the problem occurs if you are curious). > > I have the following vars relevant vars set in clojure-ts-mode. > Different combinations of them yield the same results. > > ``` > (setq-local treesit-defun-prefer-top-level t > treesit-defun-tactic 'top-level > treesit-defun-type-regexp (cons (rx (or "list_lit" = "vec_lit" "map_lit")) > (lambda (node) > (message "Node: %s" = (treesit-node-text node t)) > t))) > ``` > > > The clojure code in question produces an error free parse tree. I can > see it with `treesit-explore-mode` and by running the file through > `tree-sitter parse`, which gives the following parse tree: > > ``` > (source [0, 0] - [7, 0] > (list_lit [0, 0] - [0, 9] > value: (sym_lit [0, 1] - [0, 4] > name: (sym_name [0, 1] - [0, 4])) > value: (sym_lit [0, 5] - [0, 6] > name: (sym_name [0, 5] - [0, 6])) > value: (num_lit [0, 7] - [0, 8])) > (list_lit [2, 0] - [2, 9] > value: (sym_lit [2, 1] - [2, 4] > name: (sym_name [2, 1] - [2, 4])) > value: (sym_lit [2, 5] - [2, 6] > name: (sym_name [2, 5] - [2, 6])) > value: (num_lit [2, 7] - [2, 8])) > (list_lit [4, 0] - [4, 9] > value: (sym_lit [4, 1] - [4, 4] > name: (sym_name [4, 1] - [4, 4])) > value: (sym_lit [4, 5] - [4, 6] > name: (sym_name [4, 5] - [4, 6])) > value: (num_lit [4, 7] - [4, 8])) > (list_lit [6, 0] - [6, 21] > value: (sym_lit [6, 1] - [6, 4] > name: (sym_name [6, 1] - [6, 4])) > value: (sym_lit [6, 5] - [6, 18] > name: (sym_name [6, 5] - [6, 18])) > value: (num_lit [6, 19] - [6, 20]))) > ``` > > Any help or advice here is appreciated. > > Thank you, 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]. 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. [1] https://github.com/tree-sitter/tree-sitter-bash/issues/139 Yuan From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 14:12: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: To: Yuan Fu Cc: 60127@debbugs.gnu.org Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.16712862635202 (code B ref 60127); Sat, 17 Dec 2022 14:12:01 +0000 Received: (at 60127) by debbugs.gnu.org; 17 Dec 2022 14:11:03 +0000 Received: from localhost ([127.0.0.1]:56126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Xu3-0001Lq-CM for submit@debbugs.gnu.org; Sat, 17 Dec 2022 09:11:03 -0500 Received: from out2.migadu.com ([188.165.223.204]:21266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Xu0-0001LT-8e for 60127@debbugs.gnu.org; Sat, 17 Dec 2022 09:11:02 -0500 References: <42357D6B-C983-4B1F-8857-8C990E848750@gmail.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1671286256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RjP6iqBNwnDfkkxBXpT6a5fA0osqMav1x+9edPerLp4=; b=TM1wJg82Mn8Wd5LHJMoq1dM1WEaXBM2aSbZwLBYvPEhQsU4/7PnfS9El0E0J2/SpVudAGQ 8hdaPa9wXnXnvFsVX8fo965V7HMwPNvHih6hhLt/kA8CgUvQNWOqOhsy+potcQMil4KQfk 7KriaZ7I81DQtqdQTg3eg2j6fhALUmE= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Danny Freeman Date: Sat, 17 Dec 2022 09:07:40 -0500 In-reply-to: <42357D6B-C983-4B1F-8857-8C990E848750@gmail.com> Message-ID: <87k02q5dea.fsf@dfreeman.email> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yuan Fu writes: > 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 si= milar > problem with bash before[1]. > > At this point there aren=E2=80=99t much we can do in Emacs. If I find som= e time > I=E2=80=99ll make a reproduce recipe and submit an issue on tree-sitter-c= lojure. > > [1] https://github.com/tree-sitter/tree-sitter-bash/issues/139 > > Yuan This bash issue will be really helpful, thanks for sharing. I've been doing work on tree-sitter-clojure, so I can start digging over there. You don't need to worry about writing up a recipe unless you really want to. (I will just test with Emacs since I do not know C very well). --=20 Danny Freeman From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 16:01:02 +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: To: Yuan Fu Cc: 60127@debbugs.gnu.org Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.16712928519456 (code B ref 60127); Sat, 17 Dec 2022 16:01:02 +0000 Received: (at 60127) by debbugs.gnu.org; 17 Dec 2022 16:00:51 +0000 Received: from localhost ([127.0.0.1]:56631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ZcI-0002SR-S5 for submit@debbugs.gnu.org; Sat, 17 Dec 2022 11:00:51 -0500 Received: from out-174.mta0.migadu.com ([91.218.175.174]:63152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ZcH-0002SK-6v for 60127@debbugs.gnu.org; Sat, 17 Dec 2022 11:00:49 -0500 References: <42357D6B-C983-4B1F-8857-8C990E848750@gmail.com> <87k02q5dea.fsf@dfreeman.email> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Danny Freeman Date: Sat, 17 Dec 2022 10:47:58 -0500 In-reply-to: <87k02q5dea.fsf@dfreeman.email> Message-ID: <87cz8i58hv.fsf@dfreeman.email> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Danny Freeman writes: >> 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 s= imilar >> problem with bash before[1]. >> >> At this point there aren=E2=80=99t much we can do in Emacs. If I find so= me time >> I=E2=80=99ll make a reproduce recipe and submit an issue on tree-sitter-= clojure. >> >> [1] https://github.com/tree-sitter/tree-sitter-bash/issues/139 >> >> 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. https://paste.sr.ht/~dannyfreeman/8786059276c334036877159a5b0872cd2aa6fbc0 --=20 Danny Freeman From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 16:11: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: To: Yuan Fu Cc: 60127@debbugs.gnu.org Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.16712934129746 (code B ref 60127); Sat, 17 Dec 2022 16:11:01 +0000 Received: (at 60127) by debbugs.gnu.org; 17 Dec 2022 16:10:12 +0000 Received: from localhost ([127.0.0.1]:56677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ZlL-0002X8-PU for submit@debbugs.gnu.org; Sat, 17 Dec 2022 11:10:12 -0500 Received: from out-12.mta0.migadu.com ([91.218.175.12]:18558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6ZlJ-0002X2-Di for 60127@debbugs.gnu.org; Sat, 17 Dec 2022 11:10:10 -0500 References: <42357D6B-C983-4B1F-8857-8C990E848750@gmail.com> <87k02q5dea.fsf@dfreeman.email> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Danny Freeman Date: Sat, 17 Dec 2022 10:47:58 -0500 In-reply-to: <87k02q5dea.fsf@dfreeman.email> Message-ID: <87a63m57vl.fsf@dfreeman.email> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yuan, >> 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 s= imilar >> problem with bash before[1]. >> >> At this point there aren=E2=80=99t much we can do in Emacs. If I find so= me time >> I=E2=80=99ll make a reproduce recipe and submit an issue on tree-sitter-= clojure. >> >> [1] https://github.com/tree-sitter/tree-sitter-bash/issues/139 >> >> 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. 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. --=20 Danny Freeman From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar References: <87sfhf5ghj.fsf@dfreeman.email> In-Reply-To: <87sfhf5ghj.fsf@dfreeman.email> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Dec 2022 08:56:02 +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: To: Danny Freeman Cc: 60127@debbugs.gnu.org Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.167169934817669 (code B ref 60127); Thu, 22 Dec 2022 08:56:02 +0000 Received: (at 60127) by debbugs.gnu.org; 22 Dec 2022 08:55:48 +0000 Received: from localhost ([127.0.0.1]:57080 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8HMi-0004av-85 for submit@debbugs.gnu.org; Thu, 22 Dec 2022 03:55:48 -0500 Received: from mail-pj1-f42.google.com ([209.85.216.42]:36863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8HMg-0004an-0A for 60127@debbugs.gnu.org; Thu, 22 Dec 2022 03:55:46 -0500 Received: by mail-pj1-f42.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so5083663pjp.1 for <60127@debbugs.gnu.org>; Thu, 22 Dec 2022 00:55:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=kgcqrblpI5iWOcB4yZI4ZOS3VXQ96D/+i98veoX9vh0=; b=ShBQrs3U2uGrj3WLKfdDTNXfrrIQYsa33NXhlfsRz65QmHS3zEzeqbKy8+yQrN8ioh VeJnZaU4QqbA7CcOyETgiqpofQGt4+G9cFWXh5qBu1HOTo/W7C/JwQ6OYcCIO0IppLuk 6HhvNt4gdcb0FJJfRnnykP40aVhCzuOKNL8UQPSszP4tCG+8K8loMIrpfjbO37cK+AEA cfl2QZrhvFzhFEHNdb+45L1bLznbXCS0RavX2JNoVu6xlDC/JzagKJAszVFwj9aHl4+3 tJLrwmPIffbuSnHsjCzk1eWcgvgcOb25NhI1xrQtKVZZZo4jfRBc3Y1XPIli/8YtowZJ fflg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kgcqrblpI5iWOcB4yZI4ZOS3VXQ96D/+i98veoX9vh0=; b=dOYQh9KHt6xikSKmON+8U7//QT7i9ITf2G+oNlx9ykmpkTaxyfxXqWqdqEjYFLHy1c oph+qvunMHJsLxw/SCHHKj1iv4IBy8AXdsBfguFdpJRqbPjD541V/P5WCE59Ii9dEOW+ 1XY+myByDbXHusZR+AVbfVNkZ4mUY2tut+E3Ks1l7ZLSNGxuoEZCPYyFOMJL+NlKOQ67 BovTLQpzU99PVEHf8qt4UGTyGzAEY14TaTwTekEYmIuG+QcJSQ4AAk3xtJNXNFYha9u2 7nef2btkwnVepymLGWCbinbCDF2r85qTn5cVcCUH6xIn+c1VOBAY2hI8SaAxPCLh0KAb G7+Q== X-Gm-Message-State: AFqh2kpXIqGYL9CrLsF5cd6ZmhouBXXTxvZ/XUweVvR31q2CTUQ34b95 YiJ+JxmBNGA26/3TCHQo2tcG3of47jI= X-Google-Smtp-Source: AMrXdXtoJvViGyqm3dUNatTgC//0DMCu8395/Ct2YNh1aSZ9TxwLOixqzLIvMossjn2lzKjJ6cPpwA== X-Received: by 2002:a17:902:748b:b0:191:3c8:b2ab with SMTP id h11-20020a170902748b00b0019103c8b2abmr5297541pll.31.1671699340329; Thu, 22 Dec 2022 00:55:40 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id a3-20020a170902710300b00186b758c9fasm17167pll.33.2022.12.22.00.55.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2022 00:55:39 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Message-Id: Date: Thu, 22 Dec 2022 00:55:38 -0800 X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Danny Freeman writes: > Yuan, > >>> 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]. >>> >>> 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. >>> >>> [1] https://github.com/tree-sitter/tree-sitter-bash/issues/139 >>> >>> 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. > > 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. Yuan From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 07 18:17:52 2023 Received: (at control) by debbugs.gnu.org; 7 Jan 2023 23:17:52 +0000 Received: from localhost ([127.0.0.1]:59258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEIRk-0001UE-Lr for submit@debbugs.gnu.org; Sat, 07 Jan 2023 18:17:52 -0500 Received: from mail-pl1-f171.google.com ([209.85.214.171]:44970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEIRj-0001Tx-5Q for control@debbugs.gnu.org; Sat, 07 Jan 2023 18:17:51 -0500 Received: by mail-pl1-f171.google.com with SMTP id p24so5573074plw.11 for ; Sat, 07 Jan 2023 15:17:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=kXmZf5Ia59gp68o3o+I9NCu8dicVUSKedWxHqB47gv0=; b=OyKZQhzkJplxwBwzRTSbw0ZbwVrZpEOR+EKdslUi7dNbiOStHMkGpzJ8hH4EmzRiRz weaDMneooAgORPX7sLqorq2e/9WSA7Lo+UgslERWCFw7fJ+T1xpeT89f1NSxwZEqZhmG eO+8HLehn7n6OWyzBM2LMhYu51uNHItbdJteObtYR1PuO1779zpt4Zj1fG2kSQO+9NV7 v0EGMGCrPCkqcUOGM6indFYIu0v9/JrqbljpkkA9Ur7B72nCb/7YAyY3C+ieEcPyzfIJ 4ZYzKgYeBioUmj5YX/1SWL8UNtiAwm+intFzZchxBPEje7o7cnkIpZ2dvl/OjYm2qMYD HCvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kXmZf5Ia59gp68o3o+I9NCu8dicVUSKedWxHqB47gv0=; b=w7lemeKNqCfhwt/76zZ1f0hxVKxnG+1PTTLiLKc31wAsyW9iQl2MiRbgq1RmxyZPK2 9bIWD9qbuxgYYgjIytLeifmeRfCQa1bf+sEBf8XJ2Vyc7K6rZ3qRZvrMGcwpRkpjIHwC irYUhK7kXdY5gHbYMC3t6EvDtZ8c0PB9fPqeDxsmfKqIeRN+W3BnnfOayhSWpqtZ8H3z zUsSBdM1UFUqtk1Px6gNFbltF/1dxtwrVGf82bPkEO0O0AiwqldvUWIpA1+D7U+/iLu7 WAxyGuVj/CxajoTQPmlxoFbxdBxC0LoEMLf5s6yhT/K4tq35BlBDBT2HEA0GG/lQ0Kvt 7qAQ== X-Gm-Message-State: AFqh2krvjFVjyrollVUEZ7mh/0n6l6TzjxmL9hopAPRiZEECIwbbdFvz m8l4KqGoHEhAp3BUNhEPrU10AcTw86Aesg== X-Google-Smtp-Source: AMrXdXtDCHd4/JkNEDrDO4eVhfntbI/TmcHjxB/4+Vd/igUeBOf50G+ZSciW8O+Ai/bTUZxyUeyXBQ== X-Received: by 2002:a17:90b:3c02:b0:226:e122:5215 with SMTP id pb2-20020a17090b3c0200b00226e1225215mr7388792pjb.12.1673133465411; Sat, 07 Jan 2023 15:17:45 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id az7-20020a17090b028700b00225e670e4c7sm2946254pjb.35.2023.01.07.15.17.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jan 2023 15:17:45 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: control message for bug #60127 Message-Id: <748CF622-C809-44F7-8985-E77523135C9B@gmail.com> Date: Sat, 7 Jan 2023 15:17:44 -0800 To: control@debbugs.gnu.org X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 60127 + pending quit From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Jan 2023 01:57:02 +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 To: Yuan Fu , Danny Freeman Cc: 60127@debbugs.gnu.org Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.167383418121823 (code B ref 60127); Mon, 16 Jan 2023 01:57:02 +0000 Received: (at 60127) by debbugs.gnu.org; 16 Jan 2023 01:56:21 +0000 Received: from localhost ([127.0.0.1]:60004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHEjU-0005fv-RS for submit@debbugs.gnu.org; Sun, 15 Jan 2023 20:56:21 -0500 Received: from mail-wr1-f44.google.com ([209.85.221.44]:33590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHEjS-0005fg-Tu for 60127@debbugs.gnu.org; Sun, 15 Jan 2023 20:56:19 -0500 Received: by mail-wr1-f44.google.com with SMTP id b5so4927919wrn.0 for <60127@debbugs.gnu.org>; Sun, 15 Jan 2023 17:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=o//FlaQeU1f14nEA+MG0zkt0hZu7ebkH4HkHt/a/maY=; b=KyZWGpyptnxuFvWESuqFhaAQARm40gkh4f/w6AjRHY3Ji5RqGbY2TSFZcKqZf/rJ1U dxuoJMgHyLsYjDN4rptdPkqfdvXuZfhbcQmZNgThfJFv/l31Zjrsk7UkExMtHiX+ahp6 T553/VsZmBWDsKXNO/aj1J8UJdLekuifai3HWh88gvA1R7BgOf5Rordli7uzz4TqwcmS 7gDgbKa2HtBXyp6yamWYIWpC4B4fGU0R37JHBCSQnXDfwhOjlKqa5OUgalfOJygVRQoP GCbRiMUEaq/zUvVBxjSj4o5akoevkj9gpQZ0h0PTrfU5fq6Ys4TV3VhRwUCTAexSjgYM EJ3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o//FlaQeU1f14nEA+MG0zkt0hZu7ebkH4HkHt/a/maY=; b=Wp5nBGwNhMSDqkP1n+NIQZAaxVXaEGnsWM7Lz0K/er8KStAxzq+7e2S1OR3mfjn5nL qxlVXrIbp7Tf8c7ZaU1QWnUMDqrT0vvUiN0RI9hK92MmizIkMSyIzIFaGRRLoB/c+M4j ObYRQN+W+kbxiDRCDLmo4HJW8cVbcHKcwXhMvfItoAaM6qFvxbhLuhnLaqurSrgXhQPF EmIKu1q6KYYnw2htRiCy/iOOcMZgiehcS6N3+qUZqpowog5Z1MGyypBRkTa0RJbnomgn mbvhaR6CpPxOrM/ZKW8o9ngbz/a6gePcEFGAWenO/XWl/zzN4Us/zZf2ShD+l8mDSPjK ysAw== X-Gm-Message-State: AFqh2krYpe6+4d4KEWL+T3KnrEnrOJh8Hs0hmfsS2euxOG5qeuMsYW9M rqIN5nyJXfbHftZmaRZ1V7w= X-Google-Smtp-Source: AMrXdXun2OnNGvj5cELWuk1urs37hZqWLbsh7UyxCsA+hUTSFqhKWCgS7Q0pu7rEfKmd3ZXsYT/wSA== X-Received: by 2002:adf:de0e:0:b0:2bd:fa1d:5291 with SMTP id b14-20020adfde0e000000b002bdfa1d5291mr3128286wrm.67.1673834173049; Sun, 15 Jan 2023 17:56:13 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id v14-20020adff68e000000b002365730eae8sm24974426wrp.55.2023.01.15.17.56.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Jan 2023 17:56:12 -0800 (PST) Message-ID: <6a7f5a94-b2cd-c6b8-1267-87da1c6303e1@yandex.ru> Date: Mon, 16 Jan 2023 03:56:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-US References: <87sfhf5ghj.fsf@dfreeman.email> From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 22/12/2022 10:55, Yuan Fu wrote: > Danny Freeman writes: > >> Yuan, >> >>>> 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’ve had similar >>>> problem with bash before[1]. >>>> >>>> At this point there aren’t much we can do in Emacs. If I find some time >>>> I’ll make a reproduce recipe and submit an issue on tree-sitter-clojure. >>>> >>>> [1]https://github.com/tree-sitter/tree-sitter-bash/issues/139 >>>> >>>> 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. >> >> 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 >> >> 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’s pretty good (the reproduce), the author’s modified program > is even better. Let’s wait and see what tree-sitter’s author have to > say. Just to keep everyone of the same page: clojure-tree-sitter's author posted an issue to tree-sitter last week: https://github.com/tree-sitter/tree-sitter/issues/2012 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-1364830835 From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar 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 To: Dmitry Gutov Cc: 60127@debbugs.gnu.org, Danny Freeman Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.167383680625710 (code B ref 60127); Mon, 16 Jan 2023 02:41:01 +0000 Received: (at 60127) by debbugs.gnu.org; 16 Jan 2023 02:40:06 +0000 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 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 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) 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) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) From: Yuan Fu In-Reply-To: <6a7f5a94-b2cd-c6b8-1267-87da1c6303e1@yandex.ru> Date: Sun, 15 Jan 2023 18:39:56 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <1B32D81E-3647-4FCA-A1C8-AFD8AFC96E78@gmail.com> References: <87sfhf5ghj.fsf@dfreeman.email> <6a7f5a94-b2cd-c6b8-1267-87da1c6303e1@yandex.ru> X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > 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= From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar References: <87sfhf5ghj.fsf@dfreeman.email> In-Reply-To: <87sfhf5ghj.fsf@dfreeman.email> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jan 2023 09:31: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 To: Dmitry Gutov Cc: Eli Zaretskii , 60127@debbugs.gnu.org, Danny Freeman Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.16739478332000 (code B ref 60127); Tue, 17 Jan 2023 09:31:01 +0000 Received: (at 60127) by debbugs.gnu.org; 17 Jan 2023 09:30:33 +0000 Received: from localhost ([127.0.0.1]:35749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHiIb-0000WC-FF for submit@debbugs.gnu.org; Tue, 17 Jan 2023 04:30:33 -0500 Received: from mail-pj1-f48.google.com ([209.85.216.48]:53797) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHiIZ-0000Vw-84 for 60127@debbugs.gnu.org; Tue, 17 Jan 2023 04:30:32 -0500 Received: by mail-pj1-f48.google.com with SMTP id d8so595079pjc.3 for <60127@debbugs.gnu.org>; Tue, 17 Jan 2023 01:30:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=3ITKihIQSCli07PwFr2mYsPxQfNYYXHGTPiNzDUeKl0=; b=kdsZ2e6HVmXhT42LAhW782128KtNDtssIObxWBcLhZ0C90yiwEfW1Aoabuur08c3Qu tJqSbTFRLDnvAULuujv0/gvRMZ6l038ak9+whrJI+eIhPlh7FENYdRMXiFvMCi8/AMmP MY4TevU6u85ldvFluYHTkMnhbWrFpYw8gWIOYIP4dot5EkuRUSbp9U6iFfAUl3nuMtvN J6WfKw7mh/0Ac/3fcWAfVm3Uo4GuGD1prrpYxrUMvbrNOxMK9krufmOG1w0uVSApUlr6 aKBjnCSJMBAPzjq2M4DDf5qLy7VYtC2AU2iFjSVHHKx3ddu512mG2mbtqBQFxNahyIwk wLcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3ITKihIQSCli07PwFr2mYsPxQfNYYXHGTPiNzDUeKl0=; b=s10NuUpk2yKTRs6Xy8Uh4rLqa9rtq1z5SIr/ynJkukbNc5lf1Q1H56IxdtXLzEhEax yvKn2h6RDrWlZefXkQWpNyYwvvMQ2xhAeIPPGKuo0KaxB2WBuSKxIGmj8QA0HpeYJzwC F3qr/KFJGClKruOpAmLL/xM0iM3PyhFs5efiTTErexmTAq0CumyB0xakLvvVbEibYJme Bvib2H7GvxnuXPd8vpxT6NU/IDdiWDpc1BvTS+iYkvGexxa9YDvIg2eV9CpeGYY/uz3B +iWCA/cfs79nRGAH4LpJh2u5SL6WIQv4TOTwkkJ+f9qezdWK6SXp73mYZMKwh5I5IhxK aadA== X-Gm-Message-State: AFqh2kojxBhqbDilwANm4BM4R5zeeQcqtxlOhqKmHgwWdznnTYeFYlb/ LvhSaDYHkkvWk1lvNwwiUHU= X-Google-Smtp-Source: AMrXdXsmhc3H+4FS2cVa1X4UqxANumE8fqs3rkiF111IQVo+3fz5eyoLGUVBM+tjYjhc/ww/jBQWZA== X-Received: by 2002:a17:90a:a795:b0:226:3a18:177e with SMTP id f21-20020a17090aa79500b002263a18177emr2668924pjq.16.1673947825183; Tue, 17 Jan 2023 01:30:25 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id x4-20020a634844000000b0044046aec036sm16932226pgk.81.2023.01.17.01.30.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2023 01:30:24 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Message-Id: Date: Tue, 17 Jan 2023 01:30:22 -0800 X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > 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. I did that. I tested with the Clojure example and it works fine now. Eli, we don=E2=80=99t use ts_node_first_child_for_pos for now until = tree-sitter fix that function, should I removed the boilerplate for it or should I leave it as-is? I saw you removed ts_node_parent when I did a similar fix. Yuan From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jan 2023 12:21: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 To: Yuan Fu Cc: 60127@debbugs.gnu.org, danny@dfreeman.email, dgutov@yandex.ru Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.167395804428682 (code B ref 60127); Tue, 17 Jan 2023 12:21:01 +0000 Received: (at 60127) by debbugs.gnu.org; 17 Jan 2023 12:20:44 +0000 Received: from localhost ([127.0.0.1]:35997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHkxH-0007SX-RA for submit@debbugs.gnu.org; Tue, 17 Jan 2023 07:20:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50210) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHkxE-0007SE-Lq for 60127@debbugs.gnu.org; Tue, 17 Jan 2023 07:20:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHkx8-00064C-9N; Tue, 17 Jan 2023 07:20:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=6DxQabcPlNIjkmggvdDcBIV334UFcf+sYBJd+G9QveY=; b=dSaerCvwJxx/bkHeObGW wue5ZSz7rTs/CUFlTbzYsXXJU5qhKjOebAWaMO+N2nUcJ4RtXw3BhtGAIY8RMGu2VpG6Xv7IJ1Gm4 KiYkwI5FIr+cVBeEVYvzAzOaGkC+YwtFgbKBlssYBcN6rSU6yPHbe4bSTDcUDe9/5pp5WO9z3dpeK RfJ9zF3czDD8IWu00lHjadqGJ+P78wd8+5LpiHNgUFaFcKNwCH8did7rgI2/Epib9aVF0GW/VodPV QwwBH9CTRSxOnLZfydJxujfic0xTr6uPmrfB7lnxe6+IQUhcW9EJ5+2NpwtsKY+ywts5nBixYpT3r WT+IaMqfbBHPQA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHkx7-0004ka-Eh; Tue, 17 Jan 2023 07:20:34 -0500 Date: Tue, 17 Jan 2023 14:20:43 +0200 Message-Id: <83zgah2vz8.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yuan Fu on Tue, 17 Jan 2023 01:30:22 -0800) References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Tue, 17 Jan 2023 01:30:22 -0800 > Cc: 60127@debbugs.gnu.org, > Danny Freeman , > Eli Zaretskii > > > > I’d 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’ve already done > > that for ts_node_parent anyway. > > I did that. I tested with the Clojure example and it works fine now. > > Eli, we don’t use ts_node_first_child_for_pos for now until tree-sitter > fix that function, should I removed the boilerplate for it or should I > leave it as-is? I saw you removed ts_node_parent when I did a similar > fix. It should be either removed or #ifdef'ed away, because otherwise GCC complains in the MS-Windows build about unused macro. From unknown Sat Jun 21 03:21:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60127: treesit-end-of-defun: possible bug with clojure grammar Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jan 2023 16:00:02 +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 To: Eli Zaretskii Cc: Yuan Fu , 60127@debbugs.gnu.org, dgutov@yandex.ru Received: via spool by 60127-submit@debbugs.gnu.org id=B60127.167397117924058 (code B ref 60127); Tue, 17 Jan 2023 16:00:02 +0000 Received: (at 60127) by debbugs.gnu.org; 17 Jan 2023 15:59:39 +0000 Received: from localhost ([127.0.0.1]:38044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHoN9-0006Fx-C8 for submit@debbugs.gnu.org; Tue, 17 Jan 2023 10:59:39 -0500 Received: from out-57.mta0.migadu.com ([91.218.175.57]:50748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHoN7-0006Fp-5y for 60127@debbugs.gnu.org; Tue, 17 Jan 2023 10:59:38 -0500 References: <83zgah2vz8.fsf@gnu.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1673971173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y3uHXltXHSLFknm3nsGgAmn7gA3cwoxuqPaGML61ggU=; b=iedVc/9RGHfdFBk6iLfCHGFse7Stcfq0FoO3NxL++PGnNKS3Pu+aSikXzazRHFYWMODwL6 VXSegwX5dcdbj5FEcBQFp+i1xyS/BpEhhie2h1ZXYXY8dJLJPiaKAE/YW60vbHQM4HCEkd UVhKRjvqpJGb8R+G0wAAcQmhYqdhYSw= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Danny Freeman Date: Tue, 17 Jan 2023 10:49:45 -0500 In-reply-to: <83zgah2vz8.fsf@gnu.org> Message-ID: <87zgahgnj3.fsf@dfreeman.email> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Yuan Fu >> Date: Tue, 17 Jan 2023 01:30:22 -0800 >> Cc: 60127@debbugs.gnu.org, >> Danny Freeman , >> Eli Zaretskii >>=20 >>=20 >> > I=E2=80=99d rather not use treesit_search_dfs, as it does much more wo= rk 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 alrea= dy done >> > that for ts_node_parent anyway. >>=20 >> I did that. I tested with the Clojure example and it works fine now. >>=20 >> Eli, we don=E2=80=99t use ts_node_first_child_for_pos for now until tree= -sitter >> fix that function, should I removed the boilerplate for it or should I >> leave it as-is? I saw you removed ts_node_parent when I did a similar >> fix. > > It should be either removed or #ifdef'ed away, because otherwise GCC > complains in the MS-Windows build about unused macro. Thanks for tackling this problem on the Emacs end Yuan. I tested it out with clojure-ts-mode and it seems to have addressed my problems. I also took the liberty of linking to your commit in the tree-sitter github issue in case the maintainers want to take a look at it. --=20 Danny Freeman From unknown Sat Jun 21 03:21:44 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Danny Freeman Subject: bug#60127: closed (Re: bug#60127: treesit-end-of-defun: possible bug with clojure grammar) Message-ID: References: <87sfhf5ghj.fsf@dfreeman.email> X-Gnu-PR-Message: they-closed 60127 X-Gnu-PR-Package: emacs Reply-To: 60127@debbugs.gnu.org Date: Tue, 05 Sep 2023 15:58:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1693929481-7572-1" This is a multi-part message in MIME format... ------------=_1693929481-7572-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #60127: treesit-end-of-defun: possible bug with clojure grammar which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 60127@debbugs.gnu.org. --=20 60127: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D60127 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1693929481-7572-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 60127-done) by debbugs.gnu.org; 5 Sep 2023 15:57:53 +0000 Received: from localhost ([127.0.0.1]:58010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdYR6-0001xi-Iz for submit@debbugs.gnu.org; Tue, 05 Sep 2023 11:57:52 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:54587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdYR3-0001xU-U3 for 60127-done@debbugs.gnu.org; Tue, 05 Sep 2023 11:57:51 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-50078e52537so4516735e87.1 for <60127-done@debbugs.gnu.org>; Tue, 05 Sep 2023 08:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693929463; x=1694534263; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=CRpVWWq5Vv+hR6eBH4O/JieBVEcvFuqemPnfiMSlkOA=; b=H77IGT1uLbvq0q6TY1+LVbPWTmmqT2gJ+oZFdLNQUXaz+bKMry6y2VPgXOK5D0j9Tv ezQEovVHk+M7g2cF9EbwxupIR26G2tT8CYAdMKr/sqG463VoXlbMeGZqajLN0qrqbwUp MEOaz1rpAac1C2zLxy5PI09Nk6bK7FamdCOOijvTZUr6r7g50FBVMxPuCVS9YCQkbcAe fJP39SJP8dpcAOyupV5bdMTVrAHFQP1ganX0FUUKodwEetPuZufSJoI2aPJ9ZbL9rDnj P+o5OSNQId4F/tpjgm2Vbh4O4FXm3ZeYSWs1hbYSfw4znLSs62prQIbWMK8vKIF265ue JPxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693929463; x=1694534263; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CRpVWWq5Vv+hR6eBH4O/JieBVEcvFuqemPnfiMSlkOA=; b=WNM896owXJC16cE9uoRY3xG8lu0eyzhEuPK/XvlG5RHdX+f2OBmjW6bA4xc7b/8LD8 xuKErXHkg2o75j420VZfXGyBV2OA/Umw30hiBt3kVlFGl++P414qKo1V7kUiTtIwCJ53 tj83RcJGvY83uwXEAQmjmf1uRoHqC+SftQ9w2/aOXvuaI57jseBfuFdQFgBo/0miTNa6 4dXR+d83vGeFU94TjsHUajrE6SI3aH4xp83T6eYcZVBKkzuKx18lYuWEOAGFGXsucJGZ uy48hoVLR6akfkQFZiSaW8zMNs82ZQ9COKzLGtLCOjcdjPPHffpOiBTI/WZ8++iBlNVd Azjw== X-Gm-Message-State: AOJu0YyAOOjdHEzTdR65aSYOIOaGni/0P65zpl0Hro9T+DweROoPtJYA pRe5+Rn+YPd7i/MR7+PDsoyfyw+yh5mAkPQ6FxLYRl0C6oc= X-Google-Smtp-Source: AGHT+IFmTsUf2/bQ3ESSP6A7YkMKzBkdj2k2se8H3eYxR33KvdFUDKa+TtUM9CloKo65XLeOejVEzNTL4QDBlfMd09M= X-Received: by 2002:ac2:5326:0:b0:4fd:d002:ddad with SMTP id f6-20020ac25326000000b004fdd002ddadmr203166lfh.12.1693929463137; Tue, 05 Sep 2023 08:57:43 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 5 Sep 2023 08:57:42 -0700 From: Stefan Kangas In-Reply-To: <87zgahgnj3.fsf@dfreeman.email> (Danny Freeman's message of "Tue, 17 Jan 2023 10:49:45 -0500") References: <83zgah2vz8.fsf@gnu.org> <87zgahgnj3.fsf@dfreeman.email> MIME-Version: 1.0 Date: Tue, 5 Sep 2023 08:57:42 -0700 Message-ID: Subject: Re: bug#60127: treesit-end-of-defun: possible bug with clojure grammar To: Danny Freeman Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60127-done Cc: Eli Zaretskii , dgutov@yandex.ru, Yuan Fu , 60127-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Danny Freeman writes: > Thanks for tackling this problem on the Emacs end Yuan. I tested it out > with clojure-ts-mode and it seems to have addressed my problems. > I also took the liberty of linking to your commit in the tree-sitter > github issue in case the maintainers want to take a look at it. This bug seems to have been left open by mistake, so I'm closing it now. Please reopen the bug if I missed something. ------------=_1693929481-7572-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 16 Dec 2022 18:52:47 +0000 Received: from localhost ([127.0.0.1]:50972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Fp9-0005Sx-Ax for submit@debbugs.gnu.org; Fri, 16 Dec 2022 13:52:47 -0500 Received: from lists.gnu.org ([209.51.188.17]:33552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6Fp7-0005Sr-HX for submit@debbugs.gnu.org; Fri, 16 Dec 2022 13:52:46 -0500 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 1p6Fp5-0008VB-Tg for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 13:52:45 -0500 Received: from out2.migadu.com ([188.165.223.204]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6Fp2-00038S-G3 for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 13:52:43 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1671216718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=q00+QnbtrpycSvThs451G9uGUUG9+aRS1x0DDK1N+BQ=; b=I/X8pI6CEKX3Ud9nVTCGhic/FScLZ9xC5061bKM4xvJ412OQBr4DfhPGbFthlNjbT/8IQE Hi4dcFehWaEoFJf403/0F70jSKq40xEmQ76yabXBGxNEtUsopI8v0YWfnJAjFIKwHxrJYT 31veWAgm3ygASptGKMtW76uAJKi/SQY= From: Danny Freeman To: bug-gnu-emacs@gnu.org Subject: treesit-end-of-defun: possible bug with clojure grammar Date: Fri, 16 Dec 2022 13:12:09 -0500 Message-ID: <87sfhf5ghj.fsf@dfreeman.email> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=188.165.223.204; envelope-from=Danny@dfreeman.email; helo=out2.migadu.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: Yuan Fu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Hello, I have been running into what I believe is a bug with treesit-end-of-defun while developing clojure-ts-mode. There are some positions in clojure buffers where treesit-end-of-defun will jump to the end of the buffer. Steps to reproduce: Checkout the emacs-29 branch. I have built mine with commit b01d0246d71a7a3fd92b2864a3c0c0bc9367ee0b and tree-sitter version 0.20.7 Clone my clojure-mode fork: https://github.com/dannyfreeman/clojure-mode check out the `end-of-defun-bug` branch (master works too, but I added a helpful debug message in this branch) Clone tree-sitter-module repo: https://github.com/casouri/tree-sitter-module Apply the patch `tree-sitter-module-clojure-support.patch` located in clojure-mode repo to the casouri/tree-sitter-module repo. Build the treesitter parser for clojure with $ ./build clojure Start emacs $ emacs -q Evaluate the following, replacing the paths with what is relevant to your system ``` (progn (setq treesit-extra-load-path '("~/path/to/tree-sitter-module/dist")) (add-to-list 'load-path "~/path/to/clojure-mode/") (find-file "~/path/to/clojure-mode/clojure-ts-mode.el") (eval-buffer) (find-file "~/path/to/clojure-mode/test_end_of_defun.clj")) ``` Once you have opened test_end_of_defun.clj you can see the problem by pressing M-< C-M-e C-M-e You should see the cursor move from ``` |(def w 1) (def x 2) (def y 3) (def skip-to-here? 4) ``` to ``` (def w 1) | (def x 2) (def y 3) (def skip-to-here? 4) ``` then it unexpectedly jumps to the end of the buffer ``` (def w 1) (def x 2) (def y 3) (def skip-to-here? 4) | ``` The message buffer shows that when the point is between the forms ``` (def w 1) | (def x 2) ``` that `treesit-end-of-defun` thinks the current node is `(def skip-to-here? 4)`, which does not seem right. When the cursor is at other points in this buffer, this problem doesn't seem to occur. For instance, between the (def x 2) and (def y 3) forms, this doesn't happen. I can also see this happening in the `test.clj` file of the clojure-mode repo in a different spot but there is a lot more going on in that file. (hit C-M-e in it until the problem occurs if you are curious). I have the following vars relevant vars set in clojure-ts-mode. Different combinations of them yield the same results. ``` (setq-local treesit-defun-prefer-top-level t treesit-defun-tactic 'top-level treesit-defun-type-regexp (cons (rx (or "list_lit" "vec_lit" "map_lit")) (lambda (node) (message "Node: %s" (treesit-node-text node t)) t))) ``` The clojure code in question produces an error free parse tree. I can see it with `treesit-explore-mode` and by running the file through `tree-sitter parse`, which gives the following parse tree: ``` (source [0, 0] - [7, 0] (list_lit [0, 0] - [0, 9] value: (sym_lit [0, 1] - [0, 4] name: (sym_name [0, 1] - [0, 4])) value: (sym_lit [0, 5] - [0, 6] name: (sym_name [0, 5] - [0, 6])) value: (num_lit [0, 7] - [0, 8])) (list_lit [2, 0] - [2, 9] value: (sym_lit [2, 1] - [2, 4] name: (sym_name [2, 1] - [2, 4])) value: (sym_lit [2, 5] - [2, 6] name: (sym_name [2, 5] - [2, 6])) value: (num_lit [2, 7] - [2, 8])) (list_lit [4, 0] - [4, 9] value: (sym_lit [4, 1] - [4, 4] name: (sym_name [4, 1] - [4, 4])) value: (sym_lit [4, 5] - [4, 6] name: (sym_name [4, 5] - [4, 6])) value: (num_lit [4, 7] - [4, 8])) (list_lit [6, 0] - [6, 21] value: (sym_lit [6, 1] - [6, 4] name: (sym_name [6, 1] - [6, 4])) value: (sym_lit [6, 5] - [6, 18] name: (sym_name [6, 5] - [6, 18])) value: (num_lit [6, 19] - [6, 20]))) ``` Any help or advice here is appreciated. Thank you, -- Danny Freeman ------------=_1693929481-7572-1--