emacs-citar / citar

Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.
GNU General Public License v3.0
514 stars 55 forks source link

Integration with Org-roam-bibtex is not working #689

Closed bertulli closed 2 years ago

bertulli commented 2 years ago

Describe the bug After installing ORB, the integration with Citar seems not to be working. When I open a note for a file (C-c C-o on a Org-cite link), the usual Org file is open, and not the Org-Roam-node-ish one. I can however open it with orb-edit-citation-note.

After a bit of tweaking, the further I could do is make Citar actually open a Roam node, but that has a different naming scheme from orb-edit-citation-note, so the two files are not "recognized" by each other packages.

That is, the ORB files are <date>-<title>.org, Citar's ones are <key>.org. The :PROPERTIES:'s :ROAM_REFS: field is identical, but the :ID: is not.

To Reproduce Steps to reproduce the behavior:

  1. Go to an Org-cite link
  2. C-c C-o
  3. Click on the notes file
  4. Go back to the Org-cite link
  5. M-x orb-edit-citation-note

Expected behavior I'd expect the file opened by Citar and the one opened by ORB to be one and the same, so that I can see the notes file in Citar or in ORB.

Emacs version:

Additional context I had to add the following code throughout my init file:

(use-package org-roam-bibtex
  :custom
  (orb-insert-interface 'ivy-bibtex))
(org-roam-bibtex-mode)

(setq orb-roam-ref-format 'org-cite)
(setq citar-has-notes (lambda (citekey _) (orb-note-exists-p citekey)))

(define-key org-mode-map (kbd "C-u C-c C-o") #'orb-edit-citation-note)
(define-key org-roam-mode-map (kbd "C-c b") #'orb-insert-link)

(setq bibtex-completion-notes-path "~/orgRoamNotes/citar-notes/")
(setq citar-notes-paths (list "~/orgRoamNotes/citar-notes/"))

(setq org-roam-directory (expand-file-name "~/orgRoamNotes/"))

Note, in particular, the redefinition of citar-has-notes I took (typos aside) from here. Now: I see you developed citar-org-roam. Is this meant as a drop-in replacement for ORB? The incompatibility is intentional (having the other package)? Are the two providing the same functionalities?

Thanks for your work, I'm liking the "built-in philosophy" of Citar + Vertico + Org-cite + Corfu ❤️

bdarcus commented 2 years ago

We completely broke/improved the note API awhile back, so you need to change your config. See the ORB README, and also:

https://github.com/emacs-citar/citar/wiki/Notes-configuration#org-roam-bibtex

Is this meant as a drop-in replacement for ORB?

Not really; it's not my explicit goal at least, though really that will depend on the user. The config above uses the two together.

I've never used ORB that much, but AFAIK, the main advantage it has ATM is user-defined capture templates.

Once we add that (no ETA), my guess is it will be easier/better to just use citar-org-roam (ORB was built around bibtex-completion and org-ref, neither of which citar use). But again YMMV.

bertulli commented 2 years ago

Thanks, now it works! 🎉 🎊 I'm going to check ORB's README, if it's outdated as it seemed to me I'll do a PR there. 👍