]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix treesit-explore-mode (bug#66431)
authorYuan Fu <casouri@gmail.com>
Sun, 22 Oct 2023 03:34:07 +0000 (20:34 -0700)
committerYuan Fu <casouri@gmail.com>
Sun, 22 Oct 2023 03:39:30 +0000 (20:39 -0700)
* lisp/treesit.el (treesit-explore-mode): Reset
treesit--explorer-last-node before calling treesit--explorer-refresh,
so that in the rare case described in the bug report, the explorer
buffer don't show the outdated node.

lisp/treesit.el

index c4aba4c3e8d22c841486d1466eb67853b52e1f50..fa375282d7c89006eebc3132053ed7c519f11e6c 100644 (file)
@@ -2835,13 +2835,13 @@ window."
               (treesit--explorer-tree-mode)))
           (display-buffer treesit--explorer-buffer
                           (cons nil '((inhibit-same-window . t))))
+          (setq-local treesit--explorer-last-node nil)
           (treesit--explorer-refresh)
           ;; Set up variables and hooks.
           (add-hook 'post-command-hook
                     #'treesit--explorer-post-command 0 t)
           (add-hook 'kill-buffer-hook
                     #'treesit--explorer-kill-explorer-buffer 0 t)
-          (setq-local treesit--explorer-last-node nil)
           ;; Tell `desktop-save' to not save explorer buffers.
           (when (boundp 'desktop-modes-not-to-save)
             (unless (memq 'treesit--explorer-tree-mode