(fix): don't print no citelinks if org-ref is not present (#714)

Change confusing behaviour where org-roam buffer prints "no citelinks"
even when org-ref is not present.
This commit is contained in:
Jethro Kuan
2020-05-28 13:53:10 +08:00
committed by GitHub
parent 9ddadc9c25
commit f9a9f15a8b

View File

@@ -116,10 +116,10 @@ When non-nil, the window will not be closed when deleting other windows."
(defun org-roam-buffer--insert-citelinks () (defun org-roam-buffer--insert-citelinks ()
"Insert citation backlinks for the current buffer." "Insert citation backlinks for the current buffer."
(when (require 'org-ref nil t) ;; Ensure that org-ref is present
(if-let* ((ref (with-temp-buffer (if-let* ((ref (with-temp-buffer
(insert-buffer-substring org-roam-buffer--current) (insert-buffer-substring org-roam-buffer--current)
(org-roam--extract-ref))) (org-roam--extract-ref)))
(org-ref-p (require 'org-ref nil t)) ; Ensure that org-ref is present
(key-backlinks (org-roam--get-backlinks (cdr ref))) (key-backlinks (org-roam--get-backlinks (cdr ref)))
(grouped-backlinks (--group-by (nth 0 it) key-backlinks))) (grouped-backlinks (--group-by (nth 0 it) key-backlinks)))
(progn (progn
@@ -141,7 +141,7 @@ When non-nil, the window will not be closed when deleting other windows."
'file-from file-from 'file-from file-from
'file-from-point (plist-get props :point))) 'file-from-point (plist-get props :point)))
(insert "\n\n")))))) (insert "\n\n"))))))
(insert "\n\n* No cite backlinks!"))) (insert "\n\n* No cite backlinks!"))))
(defun org-roam-buffer--insert-backlinks () (defun org-roam-buffer--insert-backlinks ()
"Insert the org-roam-buffer backlinks string for the current buffer." "Insert the org-roam-buffer backlinks string for the current buffer."