From 60801f2fdaf9a94ceec8a365937c6d8ac8a4f802 Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Thu, 22 Jul 2021 20:13:59 +0300 Subject: Follow the current Emacs node in real time --- org-roam-ui.el | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'org-roam-ui.el') diff --git a/org-roam-ui.el b/org-roam-ui.el index fe012f6..9420bf3 100644 --- a/org-roam-ui.el +++ b/org-roam-ui.el @@ -95,15 +95,15 @@ ROWS is the sql result, while COLUMN-NAMES is the columns to use." res)) (defservlet* theme application/json () - (when (boundp 'doom-themes--colors) + (progn + (when (boundp 'doom-themes--colors) (let* - ((colors (butlast doom-themes--colors (- (length doom-themes--colors) 25))) - ui-theme (list nil)) - (progn - (dolist (color colors) - (push (cons (car color) (car (cdr color))) ui-theme)) - (insert (json-encode ui-theme)) - (httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*"))))) + ((colors (butlast doom-themes--colors (- (length doom-themes--colors) 25))) ui-theme (list nil)) + (progn + (dolist (color colors) (push (cons (car color) (car (cdr color))) ui-theme)) + (insert (json-encode ui-theme))))) + (httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*"))) + (defservlet* id/:id text/html () (let ((node (org-roam-populate (org-roam-node-create :id id))) @@ -116,10 +116,9 @@ ROWS is the sql result, while COLUMN-NAMES is the columns to use." (insert html-string))) (defservlet* current-node-id text/event-stream () - (insert (format "data: %s\n\n" + (insert (format "data: %s\n\n" org-roam-ui-current-node-id)) - (httpd-send-header t "text/event-stream" 200 :Access-Control-Allow-Origin "*") - ) + (httpd-send-header t "text/event-stream" 200 :Access-Control-Allow-Origin "*")) (defun org-roam-ui-update () "Track changes within Emacs to update Org-roam UI. -- cgit v1.2.3