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 iIvYLJdXGmdJ8gAAqHPOHw:P1 (envelope-from ) for ; Thu, 24 Oct 2024 14:20:07 +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 iIvYLJdXGmdJ8gAAqHPOHw (envelope-from ) for ; Thu, 24 Oct 2024 16:20:07 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=bernoul.li header.s=sel2011a header.b=UmRv3bNb; dmarc=pass (policy=reject) header.from=bernoul.li; 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=1729779607; a=rsa-sha256; cv=none; b=jO3+ZnADnpaiH47gttCSH+E0m3WSUIes8M+I6uofiZ22fjjoVuvUmAZmxlZ8CCa1eqSzEP SrdDAEdhpUoC0pXoLMN1lk1OqUIfDQ1iTWN5hIRgpBkGow2jEG/KwaRQnYSUlaRGV3lqnQ 9Yc9/JtumXidrAhXh3KPPJjmExYJEYH4gq0wVNvgHhj2XVvkCSaFsoXgShiTBEYWRXyBmb +xwv+6tSKXSHLE9Ilavw4s/nSQHtUmeBP0Bc0stsaGedRZTACsE3gQaXaVkmQl5d3crhYM DQe3YQ68sx+JAbU/k6qZD1lw6TktfQ5wKypnA2+G24a5t5D/ioDqvGRRGrS6ZQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=bernoul.li header.s=sel2011a header.b=UmRv3bNb; dmarc=pass (policy=reject) header.from=bernoul.li; 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=1729779607; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=3IguiezRuCi6ydDkVGpe7+ulTr6jo++EPtrmylF21hU=; b=rwilYtEhqbnB48DL9VbJPNUcCwT5ncfnf7gy4C8R4j/I3eJWMmSRhece63RmDfcak8T5Uv 0yaZ3N5g+rRGzIOu0YTr7bPlXkX0A4T3oebBsKMrQiH5SrYQfnL4LQneRFlpzbjBR+wqoN fPStOSnTHtCMcewnP2pChlWiiT4DbxlqveA3Iyg7GFvu/9sZ4Ht6FQilz/J2D1uFzmKE7m Bzi7pAkKPSUDnn4uR6JGHDbxZcLsimnCjh0QvlDXP9SEpw8zMK/yO1Jn4qGP8ZHzQWg7Bf +4nTvGQOaEHEeL7iHyZXba7EzyEVPJDJuW57Vofyo6BOZkAphj90s9sCS8HtRQ== 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 9ED971D225 for ; Thu, 24 Oct 2024 16:20:07 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3ygL-0007ak-Ut; Thu, 24 Oct 2024 10:19:23 -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 1t3ygJ-0007ab-PM for emacs-orgmode@gnu.org; Thu, 24 Oct 2024 10:19:19 -0400 Received: from mail.hostpark.net ([212.243.197.30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3ygH-0005xa-Gi for emacs-orgmode@gnu.org; Thu, 24 Oct 2024 10:19:19 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 8D5681666C; Thu, 24 Oct 2024 16:18:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from; s=sel2011a; t=1729779537; bh=SKtbWLqJ8mXG+WDPusNZl87QV/0Q2IJzVdY8NCdqjbw=; b= UmRv3bNbkSgAkaYLPrK5vi2Io51EVAuy9003M7snC5CB8u8IeALiKhzS+/jCB8Xh UCpxKANXSRuWqXM1+sYOEmh2zxFBtXBQYeVGT0N6IUdzI4XgibEw4CB4CakOwLWC kis+dNOFsTK9A3M+ToPAujLI8DBOKOjoGlkmyarGC4E= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id S5gRf0CwYSXH; Thu, 24 Oct 2024 16:18:57 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 0DD6316400; Thu, 24 Oct 2024 16:18:55 +0200 (CEST) From: Jonas Bernoulli To: =?utf-8?Q?Tor-bj=C3=B6rn?= Claesson , Ihor Radchenko , emacs-orgmode@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: Thu, 24 Oct 2024 16:18:55 +0200 Message-ID: <87r085vb1s.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=212.243.197.30; envelope-from=jonas@bernoul.li; helo=mail.hostpark.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1.51 X-Spam-Score: 1.51 X-Migadu-Queue-Id: 9ED971D225 X-Migadu-Scanner: mx12.migadu.com X-TUID: kwPMmaGMCe2b > (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. > > This can be customized directly using the customization > interface. Use setopt instead of setq if you change this option > 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 &optional 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 (list citation prefix)) > (org-cite-basic-goto citation prefix)))) > (set-default-toplevel-value option-name new-value))) (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)]] ...) (transient-define-prefix org-cite-basic-follow (citation &optional prefix) [org-cite-basic-follow-actions] (interactive) (if (or org-cite-basic-follow-ask prefix) (transient-setup 'org-cite-basic-follow nil nil ;; (off-topic) Add \n here ---^ :scope (list citation prefix)) (org-cite-basic-goto citation prefix)))) I use something similar in Forge (forge--lists-group et al.), but there the purpose is to share groups between different prefixes, not to make them customizable. To let users choose what commands to offer in the menu, I would recommend directing users towards Transient's "layer" mechanism instead of adding an option. See [[info:transient#Enabling and Disabling Suffixes]]. To try it enter any prefix (magit-diff would do) and type "C-x l". Usage information is displayed after that. > :scope (list citation prefix) Shouldn't that be just be :scope citation and then (interactive (list (magit-scope))) to access it? >> 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. Yes, obviously you have to call transient-scope somewhere. I haven't seen enough of the commands you want to add as suffixes to know whether it would make sense, and is even possible, to add an abstraction, and the few examples I have seen already contain non-commands and "find as pdf" doesn't even exist as a named function. That being said, if there are multiple commands like (defun do-something-with-citation (citation) (interactive (list (read-citation "Do something with citation: "))) ...) it might make sense to change read-citation like this (defun read-citation (prompt) (if (eq transient-current-prefix 'org-cite-basic-follow) (org-element-property :key (transient-scope)) ...old body here...)) Cheers, Jonas