all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Wilhelm Kirschbaum <wilhelm@floatpays.co.za>
To: Yuan Fu <casouri@gmail.com>
Cc: 58711@debbugs.gnu.org
Subject: bug#58711: Treesit hangs when calling treesit-search-forward
Date: Mon, 14 Nov 2022 12:03:11 +0200	[thread overview]
Message-ID: <CAJbepr9apgZcouSBsrgetMk=p7zR67AqfB+Tjdupv-o8gp6yCw@mail.gmail.com> (raw)
In-Reply-To: <7333D25E-DFC5-4720-867F-1FFFE3B0B12B@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]

Thank you, the treesit-parent-while is better.

On Mon, 14 Nov 2022 at 10:45, Yuan Fu <casouri@gmail.com> wrote:

>
>
> > On Nov 13, 2022, at 10:32 PM, Wilhelm Kirschbaum <
> wilhelm@floatpays.co.za> wrote:
> >
> > This works for me for all cases I managed to test:
> >
> > ( I have to keep track of the EOL and BOL to ensure that we don't jump
> to parents or children. )
> >
> > (defun heex--treesit-largest-node-at-point (&optional node)
> >   "Find the largest node at point or from specified NODE."
> >   (save-excursion
> >     (forward-comment (point-max))
> >     (let ((node-list
> >            (cl-loop for node = (or node (treesit-node-at (point)))
> >                     then (treesit-node-parent node)
> >                     while (and node (not (equal (treesit-node-type node)
> "fragment")))
> >                     if (eq (treesit-node-start node)
> >                            (point))
> >                     collect node)))
> >       (car (last node-list)))))
>
> For largest node at point, you can probably use something like
>
> (treesit-parent-while (or node (treesit-node-at (point)))
>                       (lambda (n) (eq (treesit-node-start n) (point))))
>
> Yuan

[-- Attachment #2: Type: text/html, Size: 1789 bytes --]

      reply	other threads:[~2022-11-14 10:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22  9:53 bug#58711: Treesit hangs when calling treesit-search-forward Wilhelm Kirschbaum
2022-10-22 10:26 ` bug#58711: The full tree-sitter parse output Wilhelm Kirschbaum
2022-10-23  6:42 ` bug#58711: Treesit hangs when calling treesit-search-forward Yuan Fu
2022-10-23 23:20   ` Yuan Fu
2022-10-24 17:06     ` Wilhelm Hugo Kirschbaum
2022-10-24 20:19       ` Yuan Fu
2022-11-10  6:44         ` Wilhelm Kirschbaum
2022-11-10  8:14           ` Yuan Fu
2022-11-10 19:03             ` Wilhelm Kirschbaum
2022-11-10 19:05               ` Wilhelm Kirschbaum
2022-11-10 19:32                 ` Wilhelm Kirschbaum
2022-11-10 20:43                   ` Wilhelm Kirschbaum
2022-11-10 22:07                     ` Yuan Fu
2022-11-11  6:30                       ` Wilhelm Kirschbaum
2022-11-14  6:32                         ` Wilhelm Kirschbaum
2022-11-14  8:44                           ` Yuan Fu
2022-11-14 10:03                             ` Wilhelm Kirschbaum [this message]

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

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

  git send-email \
    --in-reply-to='CAJbepr9apgZcouSBsrgetMk=p7zR67AqfB+Tjdupv-o8gp6yCw@mail.gmail.com' \
    --to=wilhelm@floatpays.co.za \
    --cc=58711@debbugs.gnu.org \
    --cc=casouri@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.