My elfeed is focused on finding papers and when I check out each entry, there is a PMID and DOI number at the end.
`PMID:39334129 | DOI:10.1207/s12102-021-03242-8`
I wanted to call a function that records the entry into my .bib file and at the same time downloads the PDF of that paper if available using my python function. I cannot seem to do these two actions in a single function so I have to use two functions (one for PMID to get the pdf and other for DOI to get entered into .bib file) which work fine separately:
(defun extract-PMID-DOI (regexp)
(interactive (list (read-regexp "Regexp: ")))
(isearch-mode t t)
(let ((isearch-regexp nil))
(isearch-yank-string regexp)))
(defun fetch-pubmed-pdf ()
(interactive)
(extract-PMID-DOI "PMID:") ;; puts cursor on PMID number
(insert (shell-command-to-string (concat "python3 /home/user/fetch_pdfs.py -out /home/user/papers/pdfs/ -pmids " (current-word))))
)
(defun fetch-pubmed-doi ()
(interactive)
(extract-PMID-DOI "DOI:10.") ;; puts cursor on DOI number
(doi-utils-add-bibtex-entry-from-doi (concat "10." (current-word)) "~/papers/ref.bib")
)
I wanted to know if there is a way for me to combine the two functions `fetch-pubmed-pdf` and `fetch-pubmed-doi` into a single function and also if there is a way to link the pdf that was downloaded in my `/home/user/papers/pdfs/` to the .bib entry obtained from the doi?