-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with citar-export-local-bib-file
#834
Comments
Thanks @kslutsky! @localauthor - I think you added this functionality, and I don't use it myself. Any input? |
I may have added this, but I’m almost as sure that I’ve never used it, which would explain why/how it got out of sync with later changes. In short, I’ve got nothing ;) |
Thanks @localauthor. @kslutsky - while I could implement this, I can't say when. Since you've been working on this, care to submit a PR? If yes, see the contributing doc. |
Alas, not in the near future. My apologies. But I might be able to help in a few weeks, if the issue remains open. Let me, however, ask a related implementation question, if I may. Functions that call So, my question is: Is there a way to get a raw BibTeX entry out of the Thank you. |
Not currently. We use It simplifies things on our end, and gets us input for CSL JSON as well. But it has some limitations. |
I ran into one more issue, which I thought I would like to report here. It affects multiple functions in the Let me explain the problem by taking I believe, the reason is that a To give a concrete example, if The problem can be fixed by unstringifying the argument first, e.g., by pre-processing it as follows: (setq citekeys (mapcan #'citar--unstringify-keys citekeys)) The same issue, in fact, applies to functions |
Any objection in me splitting this off into a separate issue? |
No objections at all. |
First, let me thank @bdarcus and the rest of the contributors for all the hard thought and work that went into
citar
.Describe the bug
I have encountered three issues while using the
citar-export-local-bib-file
function.citar--insert-bibtex
. If the latter is called with acitekey
which is not found in any of thebibtex-files
, then it returns the first bibtex entry within the file instead ofnil
. The reason, I believe, is that while(bibtex-search-entry citekey)
does returnnil
, subsequent calls tobibtex-beginning-of-entry
andbibtex-end-of-entry
are unconditional and point to the first bibtex entry within the file. This can be fixed by making these calls conditional on the returned value ofbibtex-search-entry
:citar-bibliography
does say explicitly that it is expected to be a list of files, but the implementation ofcitar--bibliography-files
allows (rather conveniently) forcitar-bibliography
to be a string provided there is only one bibliography file to be specified. The current implementation ofcitar-export-local-bib-file
, however, does assume thatcitar-bibliography
is a genuine list, since it calls(car citar-bibliography)
to determineext
of the bibliography file. One way to fix this would to be defineext
viacitar-export-local-bib-file
searches for keys only among the global bibliography files and ignores the local ones. This, I believe, is because(citar--insert-bibtex citekey)
is called withinwith-temp-file
and therefore looses access to the local bibliography of the buffer from whichcitar-export-local-bib-file
is called. I am not sure if this behavior is intentional or not. If it is, I think it would be appropriate to mention it in the doc string ofcitar-export-local-bib-file
. But if local bibliography entries should be taken into account, then here is one way to accomplish this. We can letcitar--insert-bibtex
take an optional list of bibtex files to find thecitekey
in:and the variable
bibtex-files
would then be bound as follows(bibtex-files (or bibtex-files-list (citar--bibliography-files)))
Finally, the call to
citar--insert-bibtex
withincitar-export-local-bib-file
would supply the list of bibtex files.With all the changes above,
citar--insert-bibtex
andcitar-export-local-bib-file
would look something like this:The text was updated successfully, but these errors were encountered: