branch: externals/dicom
commit cb25eb78b458efa7220b72680eecde2cbc833dae
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>

    Improve window selection of dicom-open
---
 dicom.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/dicom.el b/dicom.el
index 1b2f6d6287..e7f0c80546 100644
--- a/dicom.el
+++ b/dicom.el
@@ -657,11 +657,12 @@ The command is specified as FMT string with ARGS."
     (unless (equal (buffer-local-value 'dicom--file buf) file)
       (with-current-buffer buf
         (dicom--setup file)))
-    (if (not (dicom--dir-p))
-        (pop-to-buffer buf)
-      (setq dicom--image-buffer buf)
-      (display-buffer buf (and (not (eq (window-buffer) buf))
-                               '(nil (inhibit-same-window . t)))))))
+    (when (dicom--dir-p)
+      (setq dicom--image-buffer buf))
+    (if (with-current-buffer (window-buffer)
+          (and dicom--file (not (dicom--dir-p))))
+        (switch-to-buffer buf)
+      (pop-to-buffer buf '(nil (inhibit-same-window . t))))))
 
 ;;;###autoload
 (defun dicom-bookmark-jump (bm)

Reply via email to