(elpher) switches to existing elpher buffer if one exists.
authorTim Vaughan <tgvaughan@gmail.com>
Thu, 23 May 2019 07:39:31 +0000 (09:39 +0200)
committerTim Vaughan <tgvaughan@gmail.com>
Thu, 23 May 2019 07:39:31 +0000 (09:39 +0200)
elpher.el

index 2764f1d..30ec292 100644 (file)
--- a/elpher.el
+++ b/elpher.el
@@ -742,12 +742,14 @@ The result is stored as a string in the variable ‘elpher-selector-string’."
 (defun elpher ()
   "Start elpher with default landing page."
   (interactive)
-  (switch-to-buffer "*elpher*")
-  (setq elpher-current-node nil)
-  (let ((start-node (elpher-make-node nil
-                                      elpher-start-address
-                                      #'elpher-get-index-node)))
-    (elpher-visit-node start-node))
+  (if (get-buffer "*elpher*")
+      (switch-to-buffer "*elpher*")
+    (switch-to-buffer "*elpher*")
+    (setq elpher-current-node nil)
+    (let ((start-node (elpher-make-node nil
+                                        elpher-start-address
+                                        #'elpher-get-index-node)))
+      (elpher-visit-node start-node)))
   "Started Elpher.") ; Otherwise (elpher) evaluates to start page string.
 
 ;;; elpher.el ends here