Closed publicimageltd closed 2 years ago
I don't see that myself, but this is the code that determines presence of a note:
https://github.com/bdarcus/citar/blob/43f92a94022966a6ad1d4ac373bc2f4e1cc821c2/citar.el#L464-L469
So:
ELISP> (citar-file--files-for-entry
"low2001"
nil ; not actually used here
citar-notes-paths
citar-file-extensions)
("/home/bruce/org/roam/biblio/low2001.org")
ELISP> (citar-file--files-for-entry
"low001"
nil
citar-notes-paths
citar-file-extensions)
nil
Do you see anything there that would explain what you're seeing?
Thanks for the fast reply. As to the problem itself: I set a breakpoint at the format function and found out that the passage you pointed to actually returns the pdf name. Here's the reconstruction with the real values used in that iteration:
ELISP> test-entry
(("file" . "/home/jv/Zotero/storage/MZTA899N/36.4oleary.pdf")
("url" . "http://muse.jhu.edu/content/crossref/journals/new_literary_history/v036/36.4oleary.html")
("date" . "2005")
("author" . "O'Leary, Timothy")
("title" . "Foucault, {{Dewey}}, and the {{Experience}} of {{Literature}}")
("=type=" . "article")
("=key=" . "oleary_2005_Foucault"))
ELISP> test-citekey
"oleary_2005_Foucault"
ELISP> test-notes-paths
("~/Dokumente/Hefte/zettelkasten")
ELISP> test-file-extensions
("pdf" "org" "md")
ELISP> (citar-file--files-for-entry test-citekey test-entry test-notes-paths test-file-extensions)
("/home/jv/Zotero/storage/MZTA899N/36.4oleary.pdf")
In my understanding, the last value should be nil
, correct? Excluding the entry "pdf"
from citar-file-extensions
doesn't help, either.
Update: When I pass nil
instead of the entry
value, it correctly returns nil
:
ELISP> (citar-file--files-for-entry test-citekey nil test-notes-paths test-file-extensions)
nil
Update: When I pass nil instead of the entry value, it correctly returns nil:
So that might be the simple solution.
Except I don't understand the problem.
I see that citar-file--possible-names
looks in the file field without considering the directory, but the citar-file--files-for-entry
function that calls it DOES check if the file exists.
:shrug:
So that might be the simple solution.
I merged this. Can you confirm it works as expected now?
And if you have any ideas why the problem to begin with me ...
It's definitely the entry
value which is causing the problem:
ELISP> (citar-file--possible-names test-citekey test-notes-paths test-file-extensions nil)
("/home/jv/Dokumente/Hefte/zettelkasten/oleary_2005_Foucault.pdf" "/home/jv/Dokumente/Hefte/zettelkasten/oleary_2005_Foucault.org" "/home/jv/Dokumente/Hefte/zettelkasten/oleary_2005_Foucault.md")
ELISP> (citar-file--possible-names test-citekey test-notes-paths test-file-extensions test-entry)
("/home/jv/Dokumente/Hefte/zettelkasten/oleary_2005_Foucault.pdf" "/home/jv/Dokumente/Hefte/zettelkasten/oleary_2005_Foucault.org" "/home/jv/Dokumente/Hefte/zettelkasten/oleary_2005_Foucault.md" "/home/jv/Zotero/storage/MZTA899N/36.4oleary.pdf")
So in the latter case, the pdf file "36.4oleary.pdf
gets added. Since it does exist, it is not wed out by file-exists-p
.
I see you changed it quicker than I could finish reply. :smile: :+1: Thanks!
It does work now.
OIC; the code was working "correctly"; it just wasn't able to distinguish note file from other files.
I suppose another approach would be to have a separate note-extension
defcustom. But that doesn't seem necessary; this will do for now.
Describe the bug First of all: I haven't update bibtex for quite a while, great to see how much it has grown and improved! Now the bug: I understand that the three columns in the completion list mean "F" = File (PDF, for example); "N" = Note, "L" = Link. Now I often see a "N" where there is not a note file.
To Reproduce
Use this bibtex entry:
Expected behavior There should be only a "F" and an "L", since there is no note file associated.
Emacs version: 27.2