org-roam / org-roam-bibtex

Org Roam integration with bibliography management software
GNU General Public License v3.0
568 stars 47 forks source link

Fix orb-insert-link #197

Closed myshevchuk closed 3 years ago

myshevchuk commented 3 years ago

Ok, it seems that orb-insert-edit-note was expecting only a string data type and throwing the error when it was fed with a list from Bibtex-completion. Not sure how and when this was introduced and why it escaped my attention, but now it's fixed. Thank you for reporting this bug!

By the way, it is not necessary to set org-ref-notes-functions - ORB does this automatically when org-roam-bibtex-mode is on. If you with tp set it manually, you should use orb-org-ref-edit-note - it also does arrange for a few other things required by Org-ref.

OK. Thanks for the update.

But now there is a strange behaviour. I run orb-insert-link, press enter on one of the entry, it gives me this error:

user-error: Invalid capture template format: (r bibliography reference plain :if-new (file+head ~/org/literature/Bhattiprolu:2021rrj.org #+TITLE: High-quality axions in solutions to the $\mu$ problem ) :unnarrowed t) key :region cannot be nil

the Bhattiprolu:2021rrj is the citekey, the High-quality axions in solutions to the $\mu$ problem is the title.

My current configuration :

(setq bibliography-path "~/org/literature/library.bib")
(setq pdf-path "~/Dropbox/Zotero\ Papers")
(setq bibliography-notes "~/org/literature/")
(use-package! org-ref
  :after org
  :config
  (setq
   org-ref-completion-library 'org-ref-ivy-cite
   org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex
   org-ref-default-bibliography (list "~/org/literature/library.bib")
   org-ref-notes-directory bibliography-notes
   org-ref-notes-function 'orb-org-ref-edit-note   )
  )
(after! org-ref
  :commands
  (org-ref-ivy-cite-completion)
  :config
  (setq
   bibtex-completion-notes-path bibliography-notes
   bibtex-completion-bibliography bibliography-path
   bibtex-completion-pdf-field "file"
   )
  )
(after! org-roam
  (org-roam-bibtex-mode))
(use-package! org-roam-bibtex
  :after org-roam
  :config
  (require 'org-ref)
  (require 'ivy-bibtex)
  (setq orb-insert-interface 'ivy-bibtex)
  (setq orb-note-actions-interface 'ivy)
  (setq orb-preformat-keywords '("citekey" "author" "title" "url" "year"))
  (setq org-roam-capture-templates
        '(("r" "bibliography reference" plain
           "%?"
           :if-new
           (file+head "~/org/literature/${citekey}.org" "#+TITLE: ${title}\n")
           :unnarrowed t)))
    )

Further more, if I use orb-insert-link then C-o, select "insert citation", or directly use org-ref-insert-cite-link, I can get a link. Click on the link and select the open notes, I successfully get the note capture interface with correct template. So I guess this error is from some function of orb-insert-link.

Originally posted by @quarkquartet in https://github.com/org-roam/org-roam-bibtex/issues/195#issuecomment-882956504

myshevchuk commented 3 years ago

@quarkquartet, @ErnestDong, should be fixed now.

ErnestDong commented 3 years ago

thank you!

quarkquartet commented 3 years ago

Yes it works. Thanks