Skip to content

Commit

Permalink
[Peek] Run peek-mode tear down when quitting treemacs.
Browse files Browse the repository at this point in the history
Fixes #1063
  • Loading branch information
Alexander-Miller committed Nov 27, 2023
1 parent fb8980c commit f0d09d1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/elisp/treemacs-peek-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ purged."
(delete current-buffer treemacs--peeked-buffers))
(treemacs-peek-mode -1))))

(defun treemacs--disable-peek-mode ()
"Hook function for `treemacs-quit-hook'."
(treemacs-peek-mode -1))

(defun treemacs--setup-peek-mode ()
"Set up faces, timers, and hooks etc."
(when treemacs--fringe-indicator-overlay
Expand All @@ -92,7 +96,8 @@ purged."
(run-with-idle-timer 0.5 :repeat #'treemacs--do-peek))
(add-hook
'window-selection-change-functions #'treemacs--finish-peek-on-window-leave
nil :local))
nil :local)
(add-hook 'treemacs-quit-hook #'treemacs--disable-peek-mode))

(defun treemacs--tear-down-peek-mode (&optional restore-window)
"Tear down faces, timers.
Expand All @@ -114,7 +119,8 @@ kept."
(-let [(window buffer) treemacs--pre-peek-state]
(with-selected-window window
(switch-to-buffer buffer))))
(setf treemacs--pre-peek-state nil)))
(setf treemacs--pre-peek-state nil))
(remove-hook 'treemacs-quit-hook #'treemacs--disable-peek-mode))

;;;###autoload
(define-minor-mode treemacs-peek-mode
Expand Down

0 comments on commit f0d09d1

Please sign in to comment.