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

From: Yuan Fu <[email-masked]>
Date: Fri, 22 Dec 2023 23:09:24 -0800

> On Dec 19, 2023, at 9:08 AM, Denis Zubarev <[email-masked]> wrote:
> 
> I replaced treesit--thing-at with the function from emacs 29.1 in the last version of the patch.
>  Attached it here.
>    19.12.2023, 19:53, "Eli Zaretskii" <[email-masked]>:
>  From: Yuan Fu <[email-masked]>
>  Date: Mon, 18 Dec 2023 18:26:30 -0800
>  Cc: Eli Zaretskii <[email-masked]>,
>   [email-masked]
>  
>  > On Dec 18, 2023, at 4:24 PM, Denis Zubarev <[email-masked]> wrote:
>  >
>  > Just FYI, my paperwork is done.
>  >
>  
>  Great, applied! Closing this bug.
> 
> The new tests fail here:
> 
>     ELC src/treesit-tests.elc
> 
>   In end of data:
>   src/treesit-tests.el:1094:17: Warning: the function `treesit--thing-at' is not known to be defined.
>   [...]
>   Test treesit-search-subtree-backward-1 backtrace:
>     (treesit--thing-at (point) "call")
>     (treesit-search-subtree (treesit--thing-at (point) "call") #'(lambda
>     (let ((node (treesit-search-subtree (treesit--thing-at (point) "call
>     (closure (t) nil (let* ((fn-621 #'treesit-language-available-p) (arg
>     ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
>     ert-run-test(#s(ert-test :name treesit-search-subtree-backward-1 :do
>     ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
>     ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
>     ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
>     ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
>     eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
>     command-line-1(("-L" ";." "-l" "ert" "-l" "src/treesit-tests.el" "--
>     command-line()
>     normal-top-level()
>   Test treesit-search-subtree-backward-1 condition:
>       (void-function treesit--thing-at)
>      FAILED 24/25 treesit-search-subtree-backward-1 (0.000000 sec) at src/treesit-tests.el:1100
>   Can't guess python-indent-offset, using defaults: 4
>   Test treesit-search-subtree-forward-1 backtrace:
>     (treesit--thing-at (point) "call")
>     (treesit-search-subtree (treesit--thing-at (point) "call") #'(lambda
>     (let ((node (treesit-search-subtree (treesit--thing-at (point) "call
>     (closure (t) nil (let* ((fn-609 #'treesit-language-available-p) (arg
>     ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
>     ert-run-test(#s(ert-test :name treesit-search-subtree-forward-1 :doc
>     ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
>     ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
>     ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
>     ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
>     eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
>     command-line-1(("-L" ";." "-l" "ert" "-l" "src/treesit-tests.el" "--
>     command-line()
>     normal-top-level()
>   Test treesit-search-subtree-forward-1 condition:
>       (void-function treesit--thing-at)
>      FAILED 25/25 treesit-search-subtree-forward-1 (0.015625 sec) at src/treesit-tests.el:1086
> 
> The function treesit--thing-at is only available on master.<0002-Fix-an-issue-when-searching-subtree-backward.patch>

Thanks, applied this patch, and all tests pass now.

Yuan