-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add support for local bibs #150
Comments
Just want to bump this - this would be nice. |
Yes, will get to it, though there are some nuances to figure out with org-cite. One user posted this suggestion as a starting point, BTW: https://gist.github.com/bdarcus/241e24ed568817a7229fa237bb4c5f84 |
I just put this on the "roadmap" for 1.0, just so people know it's a priority. I just have a lot going on, so a PR would definitely be appreciated. |
Someone just pointed out a potentially obvious solution for Can it possibly be that easy? In related news, |
@tmalsburg - can you help me understand how to think about the local-bib case? I want to support both latex and org-cite, with a higher priority on the later. Does it matter that org-cite can mix local and global bib files? How does your recent commit for bibtex-completion impact all this on my end? Any tips appreciated. |
I have been working on this for latex. But my elisp skills are weak and I would like to understand the case better too. The scenario that seems the best ux wise to me is the following,
In this scenario we don't have to have separate local versions of the commands. The other lazy scenario is to just add the commands that insert keys into the document for local bibliography. This enough for my use case and gets the ball rolling and I have a working version of this. The last scenario involves duplicating everything between local and global bibliographies and that is doable but seems least appealing to me. |
I guess another option is to just do 1) from the list above and leave the user to deal with missing entries in the local bibliography. This is doable and works fine if you have exclusively a global or local bibliographies. It is not ideal but seems useful enough. |
Hi @aikrahguzar! I'd actually like to step back further, and think about how this should work from a user POV first. Let's review: org-citeIn I have not yet tested, or figured out, how this commit impacts this, but I think this is how it works: It's just that in biblatexBiblatex basically does similar, where all bib files are listed in the document, and where there really is no distinction between "local" and "global". \addbibresource{/home/bruce/Code/org-mode/test.bib}
\addbibresource{~/org/bib/newer.bib}
\addbibresource{~/Code/org-mode/test.bib} latexIt seems the same? \bibliography{file1,file2} ThoughtsFrom a user POV in bibtex-actions, then, couldn't this all be transparent? If I have a buffer loaded that specifies only to use a local bib file, then that's what I should see, without any (at least required) intervention in bibtex-actions? The obvious advantage is the user sees the same list of files that the processor (org-cite, bibtex, etc.) sees, which is what we want in the end. EDIT: only wrinkle I see ATM is what if I haven't test specified this? Does all of this make sense so far? If we can settle the high-level UX question, then should be easier to settle the best technical approach. |
Hi @bdarcus, this seems like the last scenario and I think that will work. I actually don't have a global collection, so I was trying to imagine what someone who has both would like. There the best ux seems to allow them to build up the local files by inserting the entries they need from the global one into both the document and the local bibliography. There can be multiple files so we somehow have to figure out where to insert these entries but we can just prompt in that case. That can be left as something to work out later and if we just restrict ourselves to working with the files in the document like you are suggesting, I think I can get a working version. |
Good; I'm the opposite, so between us we should be able to figure it out! Might be good to get some more input from people here.
This is an additional requirement that would complicate things if we were to support it. My impulse is to say we shouldn't worry about it initially. WDYT?
Well, to get a little into implementation details, my hunch is:
I created a |
On my org-cite "hunch", yeah, this is what John Kitchin appears to be doing in |
So for org-cite, maybe something like this logic in the end:
That should be it I think. |
I agree, best to not worry about it now for now. So the summary seems to me to be,
Any other major modes to worry about? This seems doable, I think I should be able to have a working version no later than this weekend, though I am still figuring this git thing out. |
Yes, but I don't think you'll need 1. I think we just need to refresh the cache when opening a new document? We should also support markdown with pandoc, at least at some point. I may get started on the org angle, which involves me finding a way to do this, dependent on the major-mode: (let ((bibtex-completion-bibliography (org-cite-list-bibliography-files))) So we could extend that to work for the other modes, perhaps put behind a simple function? Like: (defun bibtex-actions-list-bibliography-files (mode)
"Return complete list of global and local bibliography files for MODE."
;; conditional statements based on major-mode/featurep |
The reason I would like it to be buffer local is that I can have a document with different local bibs open at the same time sometimes. I actually have a hook that generates the local bib when on an idle timer when I open a latex document.
I think we only need this in the
Another way would to use an alist of major modes and corresponding functions, which would allow it to be extended from outside the package. |
We might need the extra cache; I'm not sure either. I'll experiment without it and see where that gets me. |
I think the only place indirectly tied to |
The only function that call |
I've not tested it, and the code itself probably needs work, but something like this is what I'm thinking to start with for org-cite, that can probably be generalized for latex and markdown/pandoc? https://github.com/bdarcus/bibtex-actions/pull/208/files I haven't thought in detail about the cache though. Ideally, we only want it regenerated when needed, and without user needing to manually do it. |
I'm not sure what you're trying to achieve exactly but I think it's sufficient to grab the bibliographies from
In the case of org files, Hope that helps. |
I think that's exactly what we need; thanks @tmalsburg! |
OK, I reverted my initial commit and added one based on Titus' suggestion. It's just a start. |
In case anyone can help with testing, this is now working on the The intended behavior is that any file you visit, at least in latex and org-cite, If feedback, please post to #208. |
I think refresh is not strictly needed. The local candidates should be generated the first time a bibtex-action command needing them is called. Though this call will be slower than the subsequent calls. |
Just tried this branch out. I just tried playing around with it and from my initial tests all looks good! |
Originally posted by @ramos in #148
Not sure what's involved, or when I'll get to it.
Should work both for latex-mode, but also for other relevant options; certainly (the soon to be merged) org-cite. Pandoc?
A PR is welcome.
The text was updated successfully, but these errors were encountered: