GNU bug report logs - #67117
[PATCH] Tree-sitter: fix an issue when searching subtree backward

Previous Next

Package: emacs;

Reported by: Denis Zubarev <dvzubarev <at> yandex.ru>

Date: Sat, 11 Nov 2023 23:40:02 UTC

Severity: normal

Tags: patch

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Yuan Fu <casouri <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#67117: closed ([PATCH] Tree-sitter: fix an issue when
 searching subtree backward)
Date: Tue, 19 Dec 2023 02:27:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 18 Dec 2023 18:26:30 -0800
with message-id <6D360CF2-666F-4BFE-AF6E-98F47829B338 <at> gmail.com>
and subject line Re: bug#67117: [PATCH] Tree-sitter: fix an issue when searching subtree backward
has caused the debbugs.gnu.org bug report #67117,
regarding [PATCH] Tree-sitter: fix an issue when searching subtree backward
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
67117: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67117
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Denis Zubarev <dvzubarev <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Tree-sitter: fix an issue when searching subtree backward
Date: Sun, 12 Nov 2023 02:38:33 +0300
[Message part 3 (text/plain, inline)]
Tags: patch


Steps to reproduce the issue:
1. emacs -Q
2. M-x find-file /tmp/t.py
3. paste to the buffer
 
Temp(1, 2) 
 
4. M-x python-ts-mode
5. Call search-subtree with backward flag
   M-x eval-expression (treesit-search-subtree
               (treesit--thing-at (point) "call")
               (lambda (n) (equal (treesit-node-type n ) "integer"))
               t)
It should return the second int node (#<treesit-node integer in 9-10>), but it returns nil.

I fixed it in treesit_traverse_child_helper.
Do not call treesit_traverse_sibling_helper when the named node is
required and the last child is the named node.
Otherwise treesit_traverse_sibling_helper will move cursor to the
previous sibling and the last node will be skipped.
I've added test for this bug.




In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2023-11-12 built on NUC-here
Repository revision: 400a71b8f2c5a49dce4f542adfd2fdb59eb34243
Repository branch: search-subtree-bacward-fix
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.3 LTS

Configured using:
 'configure --with-modules --with-native-compilation=aot
 --with-imagemagick --with-json --with-tree-sitter --with-xft'

[0001-Fix-an-issue-when-searching-subtree-backward.patch (text/patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Yuan Fu <casouri <at> gmail.com>
To: Denis Zubarev <dvzubarev <at> yandex.ru>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67117-done <at> debbugs.gnu.org
Subject: Re: bug#67117: [PATCH] Tree-sitter: fix an issue when searching
 subtree backward
Date: Mon, 18 Dec 2023 18:26:30 -0800

> On Dec 18, 2023, at 4:24 PM, Denis Zubarev <dvzubarev <at> yandex.ru> wrote:
> 
> Just FYI, my paperwork is done.
> 

Great, applied! Closing this bug.

Yuan


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

Previous Next


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