Skip to content

Commit 7743d57

Browse files
committed
merged pull request org-roam#227 to fix issue org-roam#202
1 parent 48e1005 commit 7743d57

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

org-roam-ui.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ This serves the web-build and API over HTTP."
179179
:group 'org-roam-ui
180180
:init-value nil
181181
(cond
182-
(org-roam-ui-mode
182+
((and org-roam-ui-mode (not (org-roam-ui-server-runningp)))
183183
;;; check if the default keywords actually exist on `orb-preformat-keywords'
184184
;;; else add them
185185
(setq-local httpd-port org-roam-ui-port)
@@ -201,6 +201,10 @@ This serves the web-build and API over HTTP."
201201
(remove-hook 'after-save-hook #'org-roam-ui--on-save)
202202
(org-roam-ui-follow-mode -1)))))
203203

204+
(defun org-roam-ui-server-runningp ()
205+
"True if the server is running or listening, otherwise false."
206+
(if (member (process-status org-roam-ui-ws-server) '(listen run)) t))
207+
204208
(defun org-roam-ui--ws-on-open (ws)
205209
"Open the websocket WS to org-roam-ui and send initial data."
206210
(progn

0 commit comments

Comments
 (0)