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

Additional fields in the bibtex result #32

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi,

Is it possible to insert additional field(s) in the result of doi-insert-bibtex? So for example right now (doi-insert-bibtex "10.1010....") produces: @Article{article, author = {author}, title = {Title}, abstract = {Abstract} }

I want to insert the field "file", which is generated by my function from "title":

(defun add-fields () (interactive) (let* ((title (bibtex-autokey-get-field "title" '(("[^ a-zA-Z0-9_-]" . "") ("mathrm" . "")))) (len (length title)) (file (bibtex-text-in-field "file"))) (if (and title (not file)) (progn (bibtex-make-field "file" t t ) (insert (concat "~/Science/Papers/" (substring title 0 (if (> len 100) 100 len )) ".pdf"))))))

@Article{article, author = {author}, title = {Title}, abstract = {Abstract}, file={~/Science/Papers/Title.pdf} }

So, can the doi-insert-bibtex produce such entry?

cpitclaudel commented 4 years ago

You can use add-function to run code after biblio-doi--insert

ghost commented 4 years ago

Ok, i see now. Thank you