From 7c37f98c585b91b97e88a501dada72e3c7f41703 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Fri, 6 Aug 2021 12:00:07 +0200 Subject: fix: set orb-keywords if not there --- org-roam-ui.el | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'org-roam-ui.el') 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'. -- cgit v1.2.3