GNU bug report logs - #60355
29.0.60; Tree sitter incorrectly handles of PRED for treesit-defun-type-regexp

Previous Next

Package: emacs;

Reported by: Wilhelm H Kirschbaum <wkirschbaum <at> gmail.com>

Date: Tue, 27 Dec 2022 12:26:01 UTC

Severity: normal

Found in version 29.0.60

Fixed in version 29.1

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

Bug is archived. No further changes may be made.

Full log


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

From: Yuan Fu <casouri <at> gmail.com>
To: Wilhelm <wkirschbaum <at> gmail.com>
Cc: 60355 <at> debbugs.gnu.org
Subject: Re: bug#60355: 29.0.60; Tree sitter incorrectly handles of PRED for 
 treesit-defun-type-regexp
Date: Tue, 27 Dec 2022 17:47:35 -0800
Wilhelm H Kirschbaum <wkirschbaum <at> gmail.com> writes:

> When `treesit-defun-type-regexp` is set with a cons cell (regexp .
> some-pred)
> the following case does not get handled as expected when calling
> (end-of-defun):
>
> ```elixir
> defmodule Example do
>  def foo() do ; regexp match, pred match
>  end
>
>  ;; <point here>
>  @impl true    ; regexp match, pred does not match
>  def bar() do  ; regexp match, pred match
>  end
>  ;; <should jump to here>
>
>  def baz() do
>  end
> end
> ;; <jumps to point here>
> ```

Thank you very much! The root cause is actually another problem, but
anyway it is fixed now.

May I also suggest you to use this function for the predicate:

(defun elixir-ts-mode--capture-defun (node)
  ;; NODE should be a ‘call’ node.
  (member (treesit-node-text
           (treesit-node-child-by-field-name node "target"))
          elixir-ts-mode--definition-keywords))

This should be more accurate than the current one, and is IMO simpler
too.

Yuan




This bug report was last modified 2 years and 140 days ago.

Previous Next


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