Function: treesit--explorer-tree-mode-cleanup

treesit--explorer-tree-mode-cleanup is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit--explorer-tree-mode-cleanup)

Documentation

Clean up treesit--explorer-tree-mode.

If called from the source buffer, quit the tree buffer window and kill the explorer buffer. If called from the explorer tree buffer, disable treesit-explore-mode(var)/treesit-explore-mode(fun) in the source buffer, quit the tree window and kill its buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit--explorer-tree-mode-cleanup ()
  "Clean up `treesit--explorer-tree-mode'.
If called from the source buffer, quit the tree buffer window and kill
the explorer buffer.
If called from the explorer tree buffer, disable `treesit-explore-mode'
in the source buffer, quit the tree window and kill its buffer."
  (cond
   ;; Called from the source buffer.
   ((buffer-live-p treesit--explorer-buffer)
    (when (window-live-p (get-buffer-window treesit--explorer-buffer))
      (let ((buf treesit--explorer-buffer))
        (with-selected-window (get-buffer-window treesit--explorer-buffer)
          (quit-window))
        (kill-buffer buf))))
   ;; Called from the tree buffer.
   ((buffer-live-p treesit--explorer-source-buffer)
    (with-current-buffer treesit--explorer-source-buffer
      (treesit-explore-mode -1))
    (when (window-live-p (get-buffer-window (current-buffer)))
      (with-selected-window (get-buffer-window (current-buffer))
        (quit-window 'kill))))))