cpitclaudel / biblio.el

Browse and import bibliographic references from CrossRef, DBLP, HAL, arXiv, Dissemin, and doi.org from Emacs
GNU General Public License v3.0
180 stars 14 forks source link

question: how to run biblio.el on the command-line? #22

Closed monperrus closed 6 years ago

monperrus commented 6 years ago

Hi, I'm not an Emacs user, but I love the features of biblio.el.

How to run biblio.el on the command-line?

cpitclaudel commented 6 years ago

Hi,

What would running it on the command line look like?

monperrus commented 6 years ago

Something like:

runner biblio.el biblio-lookup "fiat deductive delaware"

it would output the bibtex entry on the console

cpitclaudel commented 6 years ago

Ah, I see. The runner would have to be Emacs, since the whole package is written in Emacs Lisp. Assuming this isn't too much, then sure, it'd be possible, and fairly easy to do. Concretely, you can already do this:

$ emacs --batch -l ~/.emacs.d/init.el -l biblio \
      --eval '(setq biblio-synchronous t)' \
      --eval "(with-current-buffer 
                (biblio--lookup-1 'biblio-dblp-backend \"fiat delaware\")
                (message \"%s\" (buffer-string)))"
DBLP search results for ‘fiat delaware’
> Fiat - Deductive Synthesis of Abstract Data Types in a Proof Assistant.
  Benjamin Delaware, Clément Pit-Claudel, Jason Gross, Adam Chlipala
  In: POPL
  Type: Conference and Workshop Papers
  URL: https://dblp.org/rec/conf/popl/DelawarePGC15

(Of course, I'm not arguing that this is a decent CLI — just saying that one could write a thin wrapper around the existing code to expose a CLI).

If you want an ncurses-style interface, that would be a lot more work.

Updating the code to make it runnable by the ELisp interpreter in GNU Guile would be another option for portability, though Emacs is probably more widely available than guile.

monperrus commented 6 years ago

Thanks!