From 1f2bc32ad183294d011a508af72e4d5c680c0eb8 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Wed, 3 Jul 2024 13:16:07 -0700 Subject: [PATCH] feat: Prevent redisplay error 1 --- undo-tree-vf.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/undo-tree-vf.el b/undo-tree-vf.el index 23f9f8f..2863bb0 100644 --- a/undo-tree-vf.el +++ b/undo-tree-vf.el @@ -74,7 +74,7 @@ (defun undo-tree-vf--kill-visualizer (&rest _) "Safe version `undo-tree-kill-visualizer'." (when (undo-tree-vs--enabled-p) - (undo-tree-kill-visualizer))) + (ignore-errors (undo-tree-kill-visualizer)))) ;; ;; (@* "Util" ) @@ -96,9 +96,10 @@ (defun undo-tree-vf--window-buffer-change (&rest _) "Window buffer change." (when (undo-tree-vs--enabled-p) - (when-let (((not (minibuffer-window-active-p (selected-window)))) - (buf (current-buffer)) - (win (get-buffer-window undo-tree-visualizer-buffer-name))) + (when-let* (((not (minibuffer-window-active-p (selected-window)))) + (buf (current-buffer)) + (win (get-buffer-window undo-tree-visualizer-buffer-name)) + ((window-live-p win))) (with-selected-window win (unless (equal buf undo-tree-visualizer-parent-buffer) (undo-tree-vf--kill-visualizer))))))