GNU bug report logs - #60127
treesit-end-of-defun: possible bug with clojure grammar

Previous Next

Package: emacs;

Reported by: Danny Freeman <Danny <at> dfreeman.email>

Date: Fri, 16 Dec 2022 18:53:01 UTC

Severity: normal

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #28 received at 60127 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 60127 <at> debbugs.gnu.org, Danny Freeman <danny <at> dfreeman.email>
Subject: Re: bug#60127: treesit-end-of-defun: possible bug with clojure grammar
Date: Sun, 15 Jan 2023 18:39:56 -0800

> On Jan 15, 2023, at 5:56 PM, Dmitry Gutov <dgutov <at> yandex.ru> wrote:
> 
> On 22/12/2022 10:55, Yuan Fu wrote:
>> Danny Freeman<danny <at> dfreeman.email>  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

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.

Yuan



This bug report was last modified 1 year and 260 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.