From 491ee428c083038a8949f998fb4dd0c9ebb36895 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sat, 21 Oct 2023 20:34:07 -0700 Subject: [PATCH] Fix treesit-explore-mode (bug#66431) * 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index c4aba4c3e8d..fa375282d7c 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -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 -- 2.39.2