unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Wilhelm <wkirschbaum@gmail.com>
Cc: 60355@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <1E7949EC-7420-4848-9F45-88A20BAAE1D8@gmail.com> (raw)
In-Reply-To: <87cz85yqx2.fsf@gmail.com>


Wilhelm H Kirschbaum <wkirschbaum@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





  reply	other threads:[~2022-12-28  1:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 12:09 bug#60355: 29.0.60; Tree sitter incorrectly handles of PRED for treesit-defun-type-regexp Wilhelm H Kirschbaum
2022-12-28  1:47 ` Yuan Fu [this message]
2022-12-28  6:31   ` Wilhelm H Kirschbaum
2022-12-28  8:34     ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1E7949EC-7420-4848-9F45-88A20BAAE1D8@gmail.com \
    --to=casouri@gmail.com \
    --cc=60355@debbugs.gnu.org \
    --cc=wkirschbaum@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).