Ihor Radchenko <yanta...@posteo.net> writes: >> +(defcustom org-cite-basic-follow-actions >> + '[["Open" >> + ("b" "bibliography entry" (org-cite-basic-goto !citation !prefix))] >> + ["Copy" >> + ("d" "DOI" >> + (kill-new >> + (save-excursion >> + (with-temp-buffer >> + (mapc #'insert-file-contents org-cite-global-bibliography) >> + (bibtex-set-dialect (parsebib-find-bibtex-dialect) t) >> + (bibtex-search-entry (org-element-property :key !citation)) >> + (setq doi (bibtex-autokey-get-field "doi")) >> + (replace-regexp-in-string "^http://dx.doi.org/" "" doi)))))]] >> + "Actions in the `org-cite-basic-follow' transient menu. > > Two comments here: > 1. It should not be a lambda. Better have a function or even command > 2. The logic is not right. You should better follow > `org-cite-basic--key-completion-table': > `org-cite-basic--parse-bibliography', `org-cite-basic--get-entry', > and `org-cite-basic--get-field'.
Thanks for taking the time to look at this. This was originally stolen from org-ref, but can be greatly simplified using org-cite-basic--get-field. I am not sure how to go about getting the citation key from the citation. In the attached patch I introduce a org-cite-basic--get-key helper function, which takes the behaviour of org-cite-basic-goto to extract citation keys from a citation-or-citation-reference. The other option is of course to just use (org-element-property :key !citation). Which approach would be better? Cheers, Tor-björn