GNU bug report logs - #66431
[PATCH] Fix reset treesit--explorer-last-node when explorer buffer was killed

Previous Next

Package: emacs;

Reported by: nvp <noah.v.peart <at> gmail.com>

Date: Tue, 10 Oct 2023 06:04: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: Yuan Fu <casouri <at> gmail.com>
To: nvp <noah.v.peart <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 66431 <at> debbugs.gnu.org
Subject: bug#66431: [PATCH] Fix reset treesit--explorer-last-node when explorer buffer was killed
Date: Sat, 21 Oct 2023 11:33:20 -0700

> On Oct 20, 2023, at 2:22 PM, nvp <noah.v.peart <at> gmail.com> wrote:
> 
> That fixes the problem!
> 
> However, the reason I initially put the reset inside the `(unless (buffer-live-p treesit--explorer-buffer) ...)`
> in `treesit-explore-mode` was b/c it looked like there was an optimization happening in 
> `treesit--explorer-refresh` where it does this check 
> 
>            ;; If we didn't edit the buffer nor change the top-level
>            ;; node, don't redraw the whole syntax tree.
>            (highlight-only (treesit-node-eq
>                             top-level treesit--explorer-last-node))
> 
> I don't know if that is something you'd want to keep, but just pointing it out in case.  I think
> the initial patch works as well, but still allows that check to work when the explorer buffer hasn't 
> been killed.

Oh that’s fine, treesit-explore-mode always wipes everything and start from a clean slate. That optimization is for when the user moves point in the source buffer when explore-mode is on. If you’d like to send a patch that does roughly what I did in the patch I sent, I’d love to merge it. Otherwise I can fix it myself, too.

The initial patch could be a bit confusing to the readers since it sets last-node twice, and it’s not clear why.

Thanks,
Yuan



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

Previous Next


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