Tor-björn Claesson <tclaes...@gmail.com> writes: > But that was not good enough - we do not cover the case of specifying > a lambda in org-cite-basic-follow-actions, > or passing other arguments to the function than citation, prefix or > citation key. > > This updated version fixes this, so the action can be either > 1. a suffix (as in transient-define-suffix) > 2. a lambda form (as in (lambda (citation prefix) (interactive > (transient-scope)) ...)) > 3. a function call, which will be wrapped in the ugly dance-lambda and > where !citation, !prefix, and !citation-key > will be (recursively) substituted but other arguments preserved.
Rather than going into recursive replacements, simply let-bind !citation, !prefix, and anything else we may want to provide around the lambda/function call. > (pcase specification > ((and (pred stringp) label) > label) > (`(,key ,desc (lambda . ,fn-args) . ,other) > (list key desc `(lambda ,@fn-args) ,other)) > ... > (`(,key ,desc ,suffix) > (list key desc suffix)))) All these special cases can be simply handled using (other other) ; if not a pattern we care about, just retain it unchanged pcase clause. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>