citar functions to act on buffers #826
-
Hello, Would it be possible to use citar functions to parse a dedicated buffer? I have my own elisp functions that make dedicated searches in online databases. The result of these searches is a buffer with the BibTeX entrieas. I would like to display the results using citar (with completion, etc...) Is there any function that accepts a buffer as argument, parses it, and uses this as completion candidates? Many thanks for the awesome citar! |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
There is not. Whether that matters depends on what you precisely want to do. How would that UX work? |
Beta Was this translation helpful? Give feedback.
-
Ideally I can M-x my-custom-search Then I make a custom query, that produces a buffer with BibTeX entries. Citar parses this buffer and I get completion candidates. Upon selection I get the BibTeX key as output that allows me to do two things: 1) insert this citation in the current document, and optionally 2) Download this citation to the local .bib file. |
Beta Was this translation helpful? Give feedback.
-
So to back up even further, you want to query an online db, select some subset of the results, and then insert them in a local bib file? I kind of think that's independent of citar. Have you considered using something like See, for example, this from the wiki. |
Beta Was this translation helpful? Give feedback.
-
Hi, Typically the query returns many results (O(100)), and I would like to choose the one/two to insert as citations using completing-read. In this sense, I think that this is a perfect usecase for citar: narrowing BibTeX searches. More concrete: The generic search can be "find author maldacena and date after 1980". This returns 87 articles and I narrow the search because I remember that the title had the work "complementary" or something similar, and the coauthor was Ellis. This last part is much more confortable to do with completing.read/citar. The problem with biblio.el is that once you get the 100 results you have to search in that buffer by hand and this prevents the common case when you insert more than one citation. helm-bibtex was handling this very nicely, but for various reasons I moved away from helm. |
Beta Was this translation helpful? Give feedback.
-
I see. That was its "fallback" search option? The biblio solution on the wiki was my attempt to recreate that, but I admittedly don't really use it myself! I'm not really sure how that might work here generally. The cache architecture we have wasn't really designed with parsing buffers, or searching online databases, in mind; it works exclusively with global and local files. If you read through the code, you can see how those assumptions play out, and I don't see how to adjust it to handle random buffer, and not include those entries in the cache. Lines 672 to 690 in 885b86f It's possible I'm overlooking something, but my suspicion is you really need a custom completing-read interface for this piece. I could see an external package that hooks into citar somehow (for example, by prompting the user to select which bib file to add selected results to), but likely not directly supported in the core citar package. |
Beta Was this translation helpful? Give feedback.
-
I don't have a full solution for you, but if you want to code something up you might want to look at the Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
@ramos - I converted this to a discussion, and marked Roshan's answer as the answer. HTH. Feel free to followup if you have further questions. |
Beta Was this translation helpful? Give feedback.
-
Temporarily let binding
|
Beta Was this translation helpful? Give feedback.
@ramos,
I don't have a full solution for you, but if you want to code something up you might want to look at the
citar--entries
variable. See its documentation for details, but you should be able to let-bind it temporarily to a hash table of bibliography entries, which will then be used by all Citar functions. You'll want to useparsebib
to create such a hash table from your temporary buffer.Hope that helps!