Prevent buffer switching when *elpher* already visible.
authorTim Vaughan <vaughant@bs-mbpr538.d.ethz.ch>
Fri, 8 Oct 2021 12:17:23 +0000 (14:17 +0200)
committerTim Vaughan <vaughant@bs-mbpr538.d.ethz.ch>
Fri, 8 Oct 2021 12:17:23 +0000 (14:17 +0200)
elpher.el

index d8e588c..f2397e9 100644 (file)
--- a/elpher.el
+++ b/elpher.el
@@ -2161,7 +2161,8 @@ When run interactively HOST-OR-URL is read from the minibuffer."
     (unless (string-empty-p trimmed-host-or-url)
       (let ((page (elpher-page-from-url trimmed-host-or-url
                                         (elpher-get-default-url-scheme))))
-        (switch-to-buffer elpher-buffer-name)
+        (unless (get-buffer-window elpher-buffer-name t)
+          (switch-to-buffer elpher-buffer-name))
         (elpher-with-clean-buffer
          (elpher-visit-page page))
         nil)))) ; non-nil value is displayed by eshell