emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Org-cite: Replace basic follow-processor with transient menu?


From: Tor-björn Claesson
Subject: Re: Fwd: Org-cite: Replace basic follow-processor with transient menu?
Date: Wed, 11 Dec 2024 11:57:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Ihor Radchenko <yantar92@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]