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

2024-11-05 Thread Tor-björn Claesson
Ihor Radchenko writes: > Tor-björn Claesson writes: > >> I feel that the guard option does the right thing by directly fixing >> the pattern matching - but what approach do you prefer? > > I provided the guard example just for your reference. > The preference for actual code is more readable cod

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

2024-11-03 Thread Ihor Radchenko
Tor-björn Claesson writes: > I feel that the guard option does the right thing by directly fixing > the pattern matching - but what approach do you prefer? I provided the guard example just for your reference. The preference for actual code is more readable code. IMHO, my second variant with (an

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

2024-11-02 Thread Tor-björn Claesson
Ihor Radchenko writes: > AFIU, you need to match against lambda simply to avoid the next clause > matching it. Exactly. > If so, you can change the clause to match all ,fn, except > lambda like the following: > > `(,key > ,desc > (,(and fn (guard (not (eq fn 'lambda >. ,fn-args) >

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

2024-11-02 Thread Ihor Radchenko
Tor-björn Claesson writes: > Clever! I had to put the let inside the lambda for it to work. You probably do not have to once you use lexical binding (that is - not C-x C-e ad-hoc, but put things into actual byte-compiled file) But let inside the lambda body is perfectly fine. > (defun org-cite

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

2024-11-02 Thread Tor-björn Claesson
Ihor Radchenko writes: > Rather than going into recursive replacements, simply let-bind > !citation, !prefix, and anything else we may want to provide around the > lambda/function call. Clever! I had to put the let inside the lambda for it to work. (defun org-cite-basic-follow--parse-suffix-spec

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

2024-11-01 Thread Ihor Radchenko
Tor-björn Claesson 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 >

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

2024-11-01 Thread Tor-björn Claesson
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

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

2024-10-31 Thread Tor-björn Claesson
Thanks! Here is another take=) (defcustom org-cite-basic-follow-actions '[["Open" ("b" "bibliography entry" (org-cite-basic-goto !citation !prefix))] ["Copy" ("d" "DOI" org-cite-basic-follow.copy-doi)] ["Browse" ("u" "url" org-cite-basic-follow.browse-url)]] "Hepp"

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

2024-10-31 Thread Ihor Radchenko
Tor-björn Claesson writes: > (defun org-cite-basic-follow--setup (_) > (transient-parse-suffixes >'org-cite-basic-follow >(cl-map 'vector (lambda (group) > (cl-map 'vector (lambda (suffix-spec) This is getting complex enough that you can split out this lambda into a dedicated

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

2024-10-31 Thread Tor-björn Claesson
Good ideas! (transient-define-prefix org-cite-basic-follow (citation &optional prefix) [:class transient-columns :setup-children org-cite-basic-follow--setup :pad-keys t] (interactive) (if (or org-cite-basic-follow-ask (eq prefix '(-4))) (transient-setup 'org-cite-basic

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

2024-10-30 Thread Ihor Radchenko
Tor-björn Claesson writes: > (defcustom org-cite-basic-follow-actions > '[["Open" > ("b" "bibliography entry" org-cite-basic-goto (list (transient-scope) > 0))] > ["Copy" > ("d" "DOI" org-cite-basic-follow.copy-doi)] > ["Browse" > ("u" "url" org-cite-basic-follow.bro

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

2024-10-29 Thread Tor-björn Claesson
This is a great learning experience, thank you Ihor and Jonas for the friendly feedback! (defcustom org-cite-basic-follow-actions '[["Open" ("b" "bibliography entry" org-cite-basic-goto (list (transient-scope) 0))] ["Copy" ("d" "DOI" org-cite-basic-follow.copy-doi)] ["Brow

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

2024-10-29 Thread Ihor Radchenko
Tor-björn Claesson writes: > ... >>(mapcar (pcase-lambda (`(,key ,desc ,fn ,transform)) >>(list ,key ,desc >> (lambda () >>(interactive) >>(apply fn (eval transform) >>org-cite-basic-follow-ac

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

2024-10-28 Thread Tor-björn Claesson
Hi again! Den lör 26 okt. 2024 kl 14:45 skrev Jonas Bernoulli : > [Obviously completely untested:] > > (defcustom org-cite-basic-follow-actions > '[["Open" > ("b" "bibliography entry" org-cite-basic-follow.open-bibliography (...))] > ["Copy" > ("d" "DOI" org-cite-basic-follow.copy-

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

2024-10-27 Thread Tor-björn Claesson
Hi and thanks for these suggestions! I have some time away from the family tomorrow evening, and will try to make a new prototype along those lines:) Getting back! Cheers/Tor-björn Den sön 27 okt. 2024 10.07Ihor Radchenko skrev: > Jonas Bernoulli writes: > > > ... > > But the approach I used

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

2024-10-27 Thread Ihor Radchenko
Jonas Bernoulli writes: > ... > But the approach I used for `notmuch-tag-transient' is more applicable > here. Hm, that actually also adds a new class, which we *might* be able > to avoid here, let's look at the simpler `notmuch-search-transient' > for inspiration. > > [Obviously completely unte

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

2024-10-26 Thread Jonas Bernoulli
Ihor Radchenko writes: > Jonas Bernoulli writes: > >>> :set (lambda (option-name new-value) >>> (eval >>> `(transient-define-prefix org-cite-basic-follow (citation >>> &optional prefix) >>> "Follow a citation reference. >> ... >> >> (transient-define-prefix org

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

2024-10-24 Thread Ihor Radchenko
Jonas Bernoulli writes: >> :set (lambda (option-name new-value) >> (eval >> `(transient-define-prefix org-cite-basic-follow (citation >> &optional prefix) >> "Follow a citation reference. > ... > > (transient-define-prefix org-cite-basic-follow (citation &option

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

2024-10-24 Thread Jonas Bernoulli
> (defcustom org-cite-basic-follow-actions > '[["Open" > ("b" "bibliography entry" org-cite-basic-follow.open-bibliography)] >["Copy" > ("d" "DOI" org-cite-basic-follow.copy-doi)] >["Browse" > ("u" "url" org-cite-basic-follow.browse-url)]] > "Contents of the org-cite-basic-f

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

2024-10-22 Thread Ihor Radchenko
[ CCing emacs-devel and the author of transient; maybe we can have some more suggestions this way ] For some context, we are trying to create a customizeable transient menu with items configured via user option. We are also trying to pass additional arguments from prefix to suffix commands in a

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

2024-10-22 Thread Tor-björn Claesson
Ihor Radchenko writes: > Thanks! This looks much more clean. > Even better would be having a defcustom that defines the transient > layout. The idea is to avoid hard-coding [["Open" ... ] ["Copy" ...] > ...] and instead make it defcustom. Here is a solution that works for me. Is this an OK use of

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

2024-10-12 Thread Ihor Radchenko
Tor-björn Claesson writes: >> Is there an easier way to access transient prefix command arguments from >> suffixes? Maybe something provided by transient itself? > > Yes it was way to complicated, thanks! A better way can be found reading > transient.el and magit sources. Together with your other

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

2024-09-24 Thread Tor-björn Claesson
Ihor Radchenko writes: > Tor-björn Claesson writes: > >>> I do think that having extended menus for org-open-at-point could be >>> useful. Not by default, but, for example, with a prefix argument. >>> >> This is a good point, but of much larger scope than just replacing the >> follower of the ba

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

2024-09-22 Thread Ihor Radchenko
Tor-björn Claesson writes: >> I do think that having extended menus for org-open-at-point could be >> useful. Not by default, but, for example, with a prefix argument. >> > This is a good point, but of much larger scope than just replacing the > follower of the basic citation-processor. No probl

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

2024-09-17 Thread Tor-björn Claesson
Hi and thanks for replying! Ihor Radchenko writes: > > I do think that having extended menus for org-open-at-point could be > useful. Not by default, but, for example, with a prefix argument. > This is a good point, but of much larger scope than just replacing the follower of the basic citation-

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

2024-09-15 Thread Ihor Radchenko
Tor-björn Claesson writes: > Since I use org-roam-ref, I initially went with citar and installed > vertico, marginalia and embark, but this felt a bit invasive, > so I went back to the built in basic processors, > which fill all my needs except for the follow-processor. > > To improve following,

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

2024-09-14 Thread Tor-björn Claesson
Hello! I recently switched from org-ref to org-cite, and would like to thank eveyone who has worked on citation handling in org-mode! Your work is of incredible value to my research productivity! Since I use org-roam-ref, I initially went with citar and installed vertico, marginalia and embark, b