From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id AIXHKzpTF2dNGAEAe85BDQ:P1 (envelope-from ) for ; Tue, 22 Oct 2024 07:24:43 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id AIXHKzpTF2dNGAEAe85BDQ (envelope-from ) for ; Tue, 22 Oct 2024 09:24:42 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=eaR+rF84; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1729581881; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=zd0fP8bhW5XbI8RhK4GcmQLfMiJ9vWnbSSDUnqiv7rk=; b=jYXPyqquPlEEBI1D+M6BjP0LecK5jBk1Sd975X8h/rhOku325SCsnMq+AF2goCNUHTqI1W PTMaOsUqsMaGyr+2dkCRqAg1fv4Gb8UdFMUhJtiZJnQJ8KpOID9HKxyT7V88u15LZUtdpS so2MFuCRgYy3AprXlA/9DfdaKjNR7voUflzxQj4NaVo6kXWkv20/JOBow4GxCXioMQFm/3 B7P6ywMQi+kSyHKsp1v8LxwhlOlJTSpFU03EHK7COPtLG7ohy7kg5KopXO5DUL3K/tlqlF AOXyBqJdDncANfRpxuq20u/v39WDvS/J7yDlpQ3uf6OD3W298vV/S4g2FcOdUg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=eaR+rF84; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729581881; a=rsa-sha256; cv=none; b=VOlX6TM+hq8QNQJIadnxlMbV9MFWS8YRVBHcK4Lb9QtKz6fFUq5kSO4kpXgoTIGBD2SAFp HodSUMm87KrJ45IUvR5xu6cLQbpjsBQe3b9UIXK5wi0OcZ6GlP9ltE2pNe2tP/fbnnUIZh 1Ja6HNA7cEHZgG3VWpUvSGcUNk0g/qrB99Ne6xZWCOoHvL4BD4H/OmhAncLIVT4CYYYLul erqwk3H5XTxMbs0Wlnb9X2By0BcQPH4bL64l84m5K+FrPgrSd6TczzWzeLcNmxMQhEcR4B AOliZKmjuwDeg8tnsUGf2hLDvjkA+DciV2BV/BvKxehlVgzQ/07P/UUpljj//w== 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 C09D78CC48 for ; Tue, 22 Oct 2024 09:24:41 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t39F4-0007bg-3L; Tue, 22 Oct 2024 03:23:46 -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 1t39Ey-0007bK-2O for emacs-orgmode@gnu.org; Tue, 22 Oct 2024 03:23:40 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t39Ew-0001Ke-89 for emacs-orgmode@gnu.org; Tue, 22 Oct 2024 03:23:39 -0400 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2fb4fa17044so55217431fa.3 for ; Tue, 22 Oct 2024 00:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729581814; x=1730186614; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zd0fP8bhW5XbI8RhK4GcmQLfMiJ9vWnbSSDUnqiv7rk=; b=eaR+rF84zW1c4Hsq6yA1SKct3N/YjRTEjoJYwcUqwtBD1ONH2dvnFuxexdiM0TTrZT BAZT42815M1L6SEWvu0iVHFYwAgrIa/1wKjyOYhOPvtWCBtBcIqsYWKwaJikQhH0rnxt 8r6I6Uif18qJkrtyC4TFPXBeIT3DuK0wEDmVz07MpfzD5i9FyOMfJ1yLadicutzEf+ro ziDLypk0eZKagib+RzE2U+UZq4g6CxU61PaF5t2e4ipO7eXupnCpwdUiUBDOGSponDeQ RmM8GynVl3L/nmvoPYqjo7pbntBV65hTC/rtFxhOISM5r1N4KlkIjxC0x72/ap7zu3cN HfDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729581814; x=1730186614; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=zd0fP8bhW5XbI8RhK4GcmQLfMiJ9vWnbSSDUnqiv7rk=; b=nqa3iaNa8xOmaO4BOxSLJ6f3XEntIZ59TxHBtbDlmPacrxSLshjXfgKbpv9quqWqjr pMQ9qoPJCEAROJ8aIv8XhygiERNkrMXH9QYizJhaUa8K8Zm2uuHBj8TISKgxAp3uGBf+ 9d1mEUgIeTxL8iGZ67ws6vfnNy71WIENFK0Luk91vDb1MdFliiHYrZo8fD17EY6TVRlr YnAk9O1Fx9CzO0YRtVINAZQb8AOqDFZ82c72sg4Bs6TIH5hYc6FmKFGOKJ/1u1ftsDE7 mEttvenxzy9KqeZAL18W04zXa3bDpQO6Khoj1DEVajTlQf9sZFXhMGF3spkFStC+6cRg FOWw== X-Forwarded-Encrypted: i=1; AJvYcCUWwHJeMXEGMnoX7rh+QimDlNwmjC5wT4TS8G7wm77Etslhdn9HXMZWkUXb7CLM6njxD0WEZ1C/ADnG7efn@gnu.org X-Gm-Message-State: AOJu0YwIlh8sIMoiSufCiqTNY6E+HX/iowcP+8ZWlGm7KSOOwZ4XM1kF niZ1rLZSstSX2Q4MH2clQj6fJ6Hx+NvMup18EV49vC/1X1mJbk/zZsJ+MQ== X-Google-Smtp-Source: AGHT+IFLVVPCI3xpoAa+Xs9n2ox5i9JtIxws2XeNQtn73hcyv3uNsTmB1R/yL19wVWq0fxzWIWUvIA== X-Received: by 2002:a05:651c:551:b0:2fa:d4ef:f222 with SMTP id 38308e7fff4ca-2fb8320b662mr56240751fa.38.1729581813309; Tue, 22 Oct 2024 00:23:33 -0700 (PDT) Received: from barbar ([193.64.204.56]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fb9ad8c785sm7148331fa.63.2024.10.22.00.23.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2024 00:23:32 -0700 (PDT) From: =?utf-8?Q?Tor-bj=C3=B6rn_Claesson?= To: Ihor Radchenko , emacs-orgmode@gnu.org Subject: Re: Org-cite: Replace basic follow-processor with transient menu? In-Reply-To: <87r08lqlbu.fsf@localhost> (Ihor Radchenko's message of "Sat, 12 Oct 2024 17:31:49 +0000") References: <8734m28l9a.fsf@gmail.com> <874j6h3rw8.fsf@localhost> <877cbamq2q.fsf@gmail.com> <87cykvrgwr.fsf@localhost> <8734lpmkjn.fsf@gmail.com> <87r08lqlbu.fsf@localhost> Date: Tue, 22 Oct 2024 10:23:26 +0300 Message-ID: <87a5ewfvo1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=tclaesson@gmail.com; helo=mail-lj1-x230.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -0.55 X-Spam-Score: -0.55 X-Migadu-Queue-Id: C09D78CC48 X-TUID: QQqv+0n7ZJSW 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. 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 &option= al prefix) "Follow a citation reference. The contents of this transient menu is set in org-cite-basic-follow-actions= ." ,new-value (interactive) (if (or org-cite-basic-follow-ask prefix) (transient-setup 'org-cite-basic-follow nil nil :scope (li= st citation prefix)) (org-cite-basic-goto citation prefix)))) (set-default-toplevel-value option-name new-value))) >> (transient-define-suffix org-cite-basic-follow.open-bibliography (citati= on prefix) >> "Find bibliography entry for citation" >> (interactive (oref (transient-prefix-object) scope)) >> (org-cite-basic-goto citation prefix)) >>=20=20=20 >> ... > > (oref (transient-prefix-object) scope) is equivalent to (transient-scope) > Ah, thanks! >> 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. Best regards, Tor-bj=C3=B6rn