summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-08-06 12:00:07 +0200
committerThomas F. K. Jorna <[email protected]>2021-08-06 12:00:07 +0200
commit7c37f98c585b91b97e88a501dada72e3c7f41703 (patch)
treed95688780bf3b2f79ea7af98c01c3055832808f4
parentfa8f4c45a3dcd5e90c3af45334077414d1ef22c2 (diff)
fix: set orb-keywords if not there
-rw-r--r--org-roam-ui.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/org-roam-ui.el b/org-roam-ui.el
index b8a38fe..86e1324 100644
--- a/org-roam-ui.el
+++ b/org-roam-ui.el
@@ -150,6 +150,9 @@ This serves the web-build and API over HTTP."
(setq org-roam-ui-mode -1))
(cond
(org-roam-ui-mode
+ ;;; check if the default keywords actually exist on `orb-preformat-keywords'
+ ;;; else add them
+ (org-roam-ui--check-orb-keywords)
(setq-local httpd-port org-roam-ui-port)
(setq httpd-root org-roam-ui/app-build-dir)
(httpd-start)
@@ -208,6 +211,14 @@ This serves the web-build and API over HTTP."
(org-roam-ui--send-graphdata))
)
+
+(defun org-roam-ui--check-orb-keywords ()
+ "Check if the default keywords are in `orb-preformat-keywords', if not, add them."
+ (when (and org-roam-ui-retitle-ref-nodes (boundp 'orb-preformat-keywords))
+ (dolist (keyword '("author-abbrev" "year" "title"))
+ (unless (seq-contains-p orb-preformat-keywords keyword)
+ (setq orb-preformat-keywords (append orb-preformat-keywords (list keyword)))))))
+
(defun org-roam-ui--find-ref-title (ref)
"Find the title of the bibtex entry keyed by `ref'.