From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id oMldFZznF2cGawEAqHPOHw:P1 (envelope-from ) for ; Tue, 22 Oct 2024 17:57:48 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id oMldFZznF2cGawEAqHPOHw (envelope-from ) for ; Tue, 22 Oct 2024 19:57:48 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ZxUwJ4AX; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729619868; a=rsa-sha256; cv=none; b=UPU/TS9tdrl5tJHJzTdRzVsEqVT3WbmsmTF3mpdKq5S65Yds2yg1TJIkoEOZRjPLGrO4xV ZY1+dp3iSajX/SEwWMzen3jEOvs0VWqIr886sVP7khYNHypyj7glDDR6QSQ2+9xm7xtJ6l O9Qjp/52CKyJgwr92cmOOMLx7J8pn6DkAtPJFE5XnQhkV0bY46jq8oNmf6j//fodH4vk9l 4yjDRP7kUCFPVzKDpKsy0tPf4+ITjqNvZqUbZaMTYGhGJqP24CvqjwdP5Rs/aXAdujDbww fWYcWawU0iedmpPW0YwptknJAZmrm9F2Mg4joBUroawDqaAVi4F+Ep/+0OHMVw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ZxUwJ4AX; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1729619868; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=lR1j8r7jWLLChF4WfFUAHHPwMvtij7npXQMKiMbuIuk=; b=uIlreVLW68XQ69yLrIPMI/RxXMWHUXJQNFn2OHQzUjMvBI6mJlN0JI6llilcfckxf7y7Df Bk/fEdcEuSmUzhx/VExSjodOFmmEyRQikPUggS9/UWz6Tmx+vDnACd32PzM5YGPZYVdIaH 3vrP/+1ZF36L+GWe6ougfO+ufx05ZePXoyzJIjXAVbZjkn7ptTRwZiuE8aQEz5CjKmNjEx fASlnEskVHCa1H4o/KItPxBca87abtuWvEkl4O4WXcXxPAV2EfeNvjrc69qEEHYyaZbxOn iPSIb+nS0hjJURE/NEgxTF4N9Ucx+Fu8qRkz91ksy6CmfhjqBuFxLVPLwVagtA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E6E1683E21 for ; Tue, 22 Oct 2024 19:57:47 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3J7i-0002N2-Ty; Tue, 22 Oct 2024 13:56:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3J7X-0002MO-Nb for emacs-orgmode@gnu.org; Tue, 22 Oct 2024 13:56:40 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3J7T-0006NQ-LN for emacs-orgmode@gnu.org; Tue, 22 Oct 2024 13:56:38 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 41D9D240029 for ; Tue, 22 Oct 2024 19:56:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1729619792; bh=TTXiDgl6ixbKYAAwHvUvbhpp7wOAcXx6BGZIvKTpOxw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=ZxUwJ4AXSpiAVTf0sFnfMj5SHcc+OC0DlOZb7gvcreVQ2ZVddPUDl3o5z/86BZGMt MyUV69TgF1S8Om0SEdDoh+8YTGuqyr51MCyElcC50G6cP2SAyiOW6KsUi/+FTwF8Zm c+AeoFK2sIE8fYmCp/BxCfEO58fqjUEmFq24ZFaZWZAx8JgU6zVOTP78CVJvKeMN4c k6NhZdYpOuI8gq0cTo3BPIyaGHRA7H+Xz54MXu+Cq6W6oRVEpOZ9YF2nvx4y76Li2+ LLnn2Ljf6SC1y+5/FsdLMzcNpeS+WCAaYsNVU1xvSq0RM2577OhFoMf1Q/IH8IJfVs BVTnaXjqCZxnQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4XY0H33Wkgz9rxF; Tue, 22 Oct 2024 19:56:31 +0200 (CEST) From: Ihor Radchenko To: =?utf-8?Q?Tor-bj=C3=B6rn?= Claesson Cc: emacs-orgmode@gnu.org, Jonas Bernoulli , emacs-devel@gnu.org Subject: Re: Org-cite: Replace basic follow-processor with transient menu? In-Reply-To: <87a5ewfvo1.fsf@gmail.com> References: <8734m28l9a.fsf@gmail.com> <874j6h3rw8.fsf@localhost> <877cbamq2q.fsf@gmail.com> <87cykvrgwr.fsf@localhost> <8734lpmkjn.fsf@gmail.com> <87r08lqlbu.fsf@localhost> <87a5ewfvo1.fsf@gmail.com> Date: Tue, 22 Oct 2024 17:58:17 +0000 Message-ID: <8734ko10li.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -0.15 X-Spam-Score: -0.15 X-Migadu-Queue-Id: E6E1683E21 X-Migadu-Scanner: mx12.migadu.com X-TUID: H08vEn2y4gjr [ 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 way that there is no need to write suffix commands specially just for transient. Tor-bj=C3=B6rn Claesson writes: > 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 eval, or is > there a better way of doing this? > > (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-follow transient menu.=20 > > This can be customized directly using the customization=20 > interface. Use setopt instead of setq if you change this option=20 > in elisp, to ensure that the transient is rebuilt. +1 > Further actions can be added using transient-define-suffix." > :group 'org-cite > :type 'sexp > :set (lambda (option-name new-value) > (eval > `(transient-define-prefix org-cite-basic-follow (citation &opti= onal prefix) > "Follow a citation reference. > > The contents of this transient menu is set in org-cite-basic-follow-actio= ns." > ,new-value > (interactive) > (if (or org-cite-basic-follow-ask prefix) > (transient-setup 'org-cite-basic-follow nil nil :scope (= list citation prefix)) > (org-cite-basic-goto citation prefix)))) > (set-default-toplevel-value option-name new-value))) This should work, but maybe Jonas can provide better ideas. >>> And I can then for example add my own pdf-action like this: >>> >>> (transient-append-suffix 'org-cite-basic-follow "b" >>> '("p" "pdf" >>> (lambda (citation prefix) >>> (interactive (oref (transient-prefix-object) scope)) >>> (find-file-other-window >>> (concat >>> tbc/projektet >>> "Referensartiklar" >>> "/" >>> (org-element-property :key citation) >>> ".pdf"))))) >> >> It feels a bit too complex to demand knowledge of these transient >> details (how to get the arglist) from users. >> >> I am wondering if we can somehow plug the existing commands passing the >> arguments without any extra setup on the user side. > > The lambda form is much neater with your (transient-scope) suggestion: > (lambda (citation prefix) > (interactive (transient-scope)) > ...) > > Is this simple enough? I don't feel a macro would improve the > situation. It is not too bad, but what I really wanted is to reuse an existing command/function without having to write a tailored interactive statement. Again, I am hoping to get some insight from emacs-devel. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at