branch: elpa/dirvish
commit de915a538e1b0c63226e22c8570c80012c899613
Author: Alex Lu <hellosimon1...@hotmail.com>
Commit: Alex Lu <hellosimon1...@hotmail.com>

    fix: update UI within context window
---
 dirvish-tramp.el         | 5 +++--
 dirvish.el               | 4 +++-
 extensions/dirvish-vc.el | 5 +++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dirvish-tramp.el b/dirvish-tramp.el
index f5251cd0b2..df9e21a229 100644
--- a/dirvish-tramp.el
+++ b/dirvish-tramp.el
@@ -79,8 +79,9 @@ FN is the original `dired-noselect' closure."
         (when (buffer-live-p buf)
           (with-current-buffer buf
             (dirvish-tramp--ls-parser dir data)
-            (unless inhibit-setup (run-hooks 'dirvish-setup-hook))
-            (dirvish-update-body-h))))
+            (unless inhibit-setup (run-hooks 'dirvish-setup-hook)))
+          (when-let* ((win (get-buffer-window buf)) ((window-live-p win)))
+            (with-selected-window win (dirvish-update-body-h)))))
     (dirvish--kill-buffer (process-buffer proc))))
 
 (cl-defmethod dirvish-data-for-dir
diff --git a/dirvish.el b/dirvish.el
index c0c767d130..a2b2d55b13 100644
--- a/dirvish.el
+++ b/dirvish.el
@@ -1289,7 +1289,9 @@ version-controlled.  Run `dirvish-setup-hook' after data 
parsing unless
 INHIBIT-SETUP is non-nil."
   (ignore dir buffer)
   (unless inhibit-setup (run-hooks 'dirvish-setup-hook))
-  (dirvish-update-body-h))
+  (when-let* ((win (get-buffer-window buffer))
+              ((window-live-p win)))
+    (with-selected-window win (dirvish-update-body-h))))
 
 (defun dirvish--window-split-order ()
   "Compute the window split order."
diff --git a/extensions/dirvish-vc.el b/extensions/dirvish-vc.el
index 9fcc490d45..c8b5160d5d 100644
--- a/extensions/dirvish-vc.el
+++ b/extensions/dirvish-vc.el
@@ -136,8 +136,9 @@ It is called when `:vc-backend' is included in 
DIRVISH-PROPs while
                 (puthash k orig dirvish--attrs-hash)))
             data)
            (dirvish-prop :vc-info info)
-           (unless inhibit-setup (run-hooks 'dirvish-setup-hook))
-           (dirvish-update-body-h))))
+           (unless inhibit-setup (run-hooks 'dirvish-setup-hook))))
+       (when-let* ((win (get-buffer-window buf)) ((window-live-p win)))
+         (with-selected-window win (dirvish-update-body-h))))
      (delete-process p)
      (dirvish--kill-buffer (process-buffer p)))
    nil 'meta (cons buffer inhibit-setup)))

Reply via email to