It’s happening because of the way how ORB runs capture. Thanks for letting me know, I’ll look into it. Meanwhile, press C-g
to abort the capture.
This should be fixed now.
With M-:
or M-x eval-expression
. This was just to check what element Org would return for [cite:@key]
. So when point is on a link, (org-element-context)
returns a link element - a list starting with (link ...)
. If it’s on a headline - then a headline element (headline ...)
. I expected (after inspecting oc.el
and relevant parts of org.el
) that for a citation [cite:@key]
this function would return (citation ...)
but it returns (paragraph ...)
meaning that Org parser did not recognize the citation as Org element and treated it as a part of a paragraph. This explains why following or exporting a citation does not work. But I can’t figure why Org element does not parse the citation in my instance. I therefore wondered may be you had any similar issues.
Actually, when I ran make
in the cloned repository, the command quit with an error during building the Org manual. Lisp files were successfully compiled before that, so I assumed it was fine to continue. But maybe something else was not built properly and this was the cause of my issue.
Hi @mshevchuk, thanks for your help. Unfortunately, running org-roam-db-sync
and then evaluating orb-make-notes-cache
did not solve the issue. Any other suggestion about what to check next? (as a last resort, I can simply recreate the note, it is not a big deal – but I’m keen on understanding a bit better how Org, Org-roam, and OB work under the hood).
Thanks for fixing the abort issue!
Just to be clear, after rechanging the filename and updating the cache, I can insert/access the note without issues with Org-roam. It is just accessing it within helm-bibtex
with org-roam-bibtex
mode on that does not work (I’m prompted to capture a new note).
Try to reproduce your issue with another note. Carefully record all the steps you’ve taken and report them here so I can repeat them in the exact order.
I tried to reproduce your issue with the following but failed:
- Create a note
test.org
, for example with a dummytest
BibTeX record - Rename the note outside Emacs:
test.org
→test2.org
- Helm-bibtex → Edit notes → a new note
test.org
is created (no capture prompts) → delete it without saving org-roam-db-sync
- Helm-bibtex → Edit notes → a new note
test.org
is created (no capture prompts) → delete it without saving orb-make-notes-cache
- Helm-bibtex → Edit notes → I’m taken to the original note, now under
test2.org
filename .
Notice that I did not rename the file back and I did not turn org-roam-bibtex-mode
on/off. When I rename the file back to test.org
, I have to go through steps 4 and 6 once again to fix it.
By the way, could it be that you also modified the value of ROAM_REFS
? Does the value match the citation key of the BibTeX record?
Thanks @mshevchuk for your detail advice. Here are my steps:
- Add a dummy Bibtex entry to my
reference.bib
file; - Enter Emacs and turn on
org-roam-bibtex-mode
; - Create a new note,
test.org
, throughhelm-bibtex
for the dummy entry; - Close Emacs and rename the note using the ID, say as
202105152349test.org
; - Enter Emacs and
org-roam
gives me a warning ofinvalid ref cite:test2021, skipping...
for the renamed note (but I did not change theROAM_REFS
, that’s the original); - Run
org-roam-db-sync
, activateorg-roam-bibtex-mode
and evaluate(orb-makes-notes-cache)
; - Through
helm-bibtex
I see that the dummy citation entry has no note now; - Rechange the name of the note to the original outside Emacs;
- Enter Emacs, run
org-roam-db-sync
, activateorg-roam-bibtex-mode
and evaluate(orb-makes-notes-cache)
; - Now,
helm-bibtex
correctly shows me that the dummy entry has a note but I cannot access it iforg-roam-bibtex
is on (I’m prompted to capture a new note).
I cannot reproduce this part. It seems you don’t have Org-ref loaded. Org-ref is required by Org-roam to be able to recognize cite:links
. Maybe it’s loaded too late?
In fact, after quitting and relaunching Emacs (steps 4 and 5) I’m able to navigate to the renamed note without additional steps.
Mmmh. So, in my config file I first load and set all relevant variables for org-roam
(including the capture templates). Afterwards, I load and set everything for org-roam-bibtex
and do (require 'org-ref)
after (require 'org-roam-bibtex)
. Is org-ref required too late? Or might there be something else wrong in my config order?
If you load Org-ref with ORB (as in README), then Org-ref will be loaded only after you turn on org-roam-bibtex-mode
. This would explain why you don’t get the Org-roam database updated properly with org-roam-db-sync
before you run org-roam-bibtex-mode
.
This part is very strange. The same function is used by ORB to tell helm-bibtex
that a note exists and to decide whether to create a new note when you call Edit notes.
Hard to tell for sure without looking at it. Probably the latter though.
I’ll try to change my config order following your suggestions @mshevchuk as soon as I can. In the meantime, I’ll post my config settings here in case you can spot something wrong straight away. Thanks a lot for your help and time!
It looks more or less fine. But when do you do org-roam-setup
?
It’s in the first screenshot, line 339.
I have almost your config, and I am still having the warnings at startup
(use-package! org-ref
:after org
:config
(setq org-ref-default-bibliography '("~/Dropbox/home/documents/org/roam/_library.bib")
org-ref-notes-function 'orb-org-ref-edit-note
org-ref-completion-library 'org-ref-helm-bibtex
org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex)
(setq bibtex-completion-pdf-extension '(".pdf" ".djvu")
bibtex-completion-pdf-field "file"))
(use-package! org-roam-bibtex
:after org-roam
:config
(require 'org-ref)
(setq orb-preformat-keywords
'("citekey" "title" "url" "author-or-editor" "keywords" "file" "year")
orb-process-file-keyword t
orb-file-field-extensions '("pdf")
orb-note-actions-interface 'helm
orb-insert-interface 'helm-bibtex))
(after! org-roam
(org-roam-bibtex-mode))
I removed all the packages in doom and compiled all again. I don’t know what else to do?
Right, I missed it. You can try moving (require 'org-ref)
just before (org-roam-setup)
. But the things can be more complicated because of how you load other Org-related packages and how you install or load Org itself. Org is sometimes tricky and is well-known to suffer from weird loading issues. You may also want to check if you have any compiled files, try removing them and restart Emacs.
Do you have other Org-related packages in your config? How do you load Org itself, just with the org
module in init.el
?
Weird; I get a void symbol error if I do that.
If I eval org-element-object-containers
, I get this, which seems to suggest it recognizes the citation as a citation?
(bold citation footnote-reference italic link subscript radio-target strike-through superscript table-cell underline paragraph ...)