You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suggest to extend doi-utils with a functionality that allows the user to specify a function to return the PDF file name when downloading it from the internet (in functions doi-utils-async-download-pdf and doi-utils-get-bibtex-entry-pdf).
Today this is hardcoded to be the entry's key (which happen not to work with my workflow, that uses the title).
The changes would be:
Adding a new defcustom for this function (with a default for the current behaviour):
(defcustomdoi-utils-get-downloaded-pdf-name
'(lambda () (cdr (assoc"=key=" (bibtex-parse-entry))))
"The function to create the pdf file name from the bibtex entry.Defaults to using the `key' value as the file name.":type'function:group'doi-utils)
Change in doi-utils-async-download-pdf to use it:
@@ -665,7 +673,7 @@ too. "
(doi (replace-regexp-in-string
"https?://\\(dx.\\)?.doi.org/" ""
(bibtex-autokey-get-field "doi")))
- (key (cdr (assoc "=key=" (bibtex-parse-entry))))+ (base-name (funcall doi-utils-get-downloaded-pdf-name))
(pdf-url)
(pdf-file))
@@ -677,7 +685,7 @@ too. "
(car bibtex-completion-library-path))
(t
(completing-read "Dir: " bibtex-completion-library-path)))
- key ".pdf"))+ base-name ".pdf"))
(unless doi (error "No DOI found to get a pdf for"))
Do the same change in doi-utils-get-bibtex-entry-pdf:
This seems reasonable. Make sure the current behavior remains the default behavior. I think you may need to modify something in how bibtex-completion finds the pdf on your end, or store that file name as a file field in the bibtex entry.
I suggest to extend
doi-utils
with a functionality that allows the user to specify a function to return the PDF file name when downloading it from the internet (in functionsdoi-utils-async-download-pdf
anddoi-utils-get-bibtex-entry-pdf
).Today this is hardcoded to be the entry's key (which happen not to work with my workflow, that uses the
title
).The changes would be:
defcustom
for this function (with a default for the current behaviour):doi-utils-async-download-pdf
to use it:doi-utils-get-bibtex-entry-pdf
:I can submit a pull request if this proposal is acceptable, or change the defcustom/variable names to make it more adequate.
The text was updated successfully, but these errors were encountered: