From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.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 AL6LKZuEGmf8pQAA62LTzQ:P1 (envelope-from ) for ; Thu, 24 Oct 2024 17:32:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id AL6LKZuEGmf8pQAA62LTzQ (envelope-from ) for ; Thu, 24 Oct 2024 19:32:11 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=qtc5J7Gh; 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=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1729791131; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=rWqSsRRypqvQEehOECuwQvo+gUjFtrNBnnZPvTDAvfg=; b=U6HuHGoZoun59Xu1OG5b9zyjeZm7l2gykyIZ4UBpC3XgJA9go3pu4QvLRfopOHFGTpS6Di C+ZwMoqXLMWNwDu4PkjiYvNb/j/QLZsVkrFqFycMs2/66xDgKBzPolPf19FDM/vzHak1TY oto16kHFAWFvnswr1+ljGtiCeOFlLn9hg23qlL28cKS2boanDgrhqaiS+85tuSg+BGhFOm CMh7XgihPsUM67rpB48Mjav9V6VLBFHgoPycsSz3XJOXpYXo0/D6smItVsx/l6wNRVUl56 b+YEZtmjmscPxomhFrGlRyHmbK2n9kuyEm565x7pUkpNWFEV8M1L5bsgIwq2ig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=qtc5J7Gh; 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=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729791131; a=rsa-sha256; cv=none; b=UABJs9ZLVo7Ns1GVk/LVofgYXHSOnAQsZrbS5TCbg5ZDaIlKcnN/TLnFFLwgLt5H2rLImg 17W7m+8fOmVTHAfrCHDJV7xMGiU4eIBmXZn1CKfYGKqAQYruHm9GJA5MpIgCupr5SAZC8l 70aT9f6/03i60NCl8FqRiC8ljZ0junxWiqn2+p0juOJPGR5FeGypVsMoUthS/vwHPx8X9R glEhNInTwIdOYRGUf7KunEm0I5emBfnbX62DWJRcDIZmzMq+HR6n/rWK65aX167QoZOoog QVv41W3/ecdjyBg7x0qL/6UBKP7D6a/3rGzbqTgH+J99hRKAcrfaPU9RJ7Eo+g== 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 47E978A91E for ; Thu, 24 Oct 2024 19:32:11 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t41g6-0007cR-6d; Thu, 24 Oct 2024 13:31:18 -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 1t41g4-0007c9-MK for emacs-orgmode@gnu.org; Thu, 24 Oct 2024 13:31:16 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t41g2-0007tc-4m for emacs-orgmode@gnu.org; Thu, 24 Oct 2024 13:31:16 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id AD8B6240101 for ; Thu, 24 Oct 2024 19:31:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1729791070; bh=Twsl4qD2CdZHHruINxkEEcWqazjEuVkh2J+StFL3spA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=qtc5J7Ghv49PO0Fvd3x9IqqsJPUrTAivuB26DJlTBfHJ1kYqhDR6zhi+CHbveFjE+ bGX0S5WUfpbIafp6+N7LHdTJmtj2xYEwXBsVy3TBN0NxfFnkEUaYhtL518egyCye3U tePrTUSmXZLwDJ2GuSTfR8EHRHtkTKmrL5ND4HCoxoaiNk94AZ9rvFem5ewcCDoO2A Jf3DsByeTfjHZliPtyL5bWiFvrjjK5d4S0p89LA1AzKGEITgdY60g3jraej8s2wLTm 3UDxpLatfd2sOffGceI9X5uQRmSV+CPDR6S9TtK7kl/DM1PlbBaRlI9KwGwizP8SV5 udzzN80zL698Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4XZCcs61Wbz9rxF; Thu, 24 Oct 2024 19:31:09 +0200 (CEST) From: Ihor Radchenko To: Jonas Bernoulli Cc: =?utf-8?Q?Tor-bj=C3=B6rn?= Claesson , emacs-orgmode@gnu.org Subject: Re: Org-cite: Replace basic follow-processor with transient menu? In-Reply-To: <87r085vb1s.fsf@bernoul.li> 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> <87r085vb1s.fsf@bernoul.li> Date: Thu, 24 Oct 2024 17:32:55 +0000 Message-ID: <87bjz9o188.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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_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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 1.37 X-Spam-Score: 1.37 X-Migadu-Queue-Id: 47E978A91E X-TUID: nC6d+uHEZdEv 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 &optional prefix) > [org-cite-basic-follow-actions] > ... This is more compact indeed. Thanks! > 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. And this is the problem. See the above :set we have to add in order to re-evaluate the prefix definition. It would be nice if the layout could be calculated dynamically rather than frozen in place in the "defun". > 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. This will indeed help with customizing *pre-existing suffixes*. However, what we really want here is different - we want a minimal set of suffixes to be provided by Org mode, and more suffixes to be contributed by individual packages or by users themselves. In other words, we need some way to add new suffixes to the org-cite-basic-follow prefix menu. >> :scope (list citation prefix) > > Shouldn't that be just be > :scope citation > and then > (interactive (list (magit-scope))) > to access it? We want the [suffix] commands to have information about the prefix argument used to call `org-cite-basic-follow'. > 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...)) This is precisely what I want to avoid. What we want is having normal commands/functions and then allowing to add them as suffixes without having to change their interactive spec or source code in general. Currently, if we want suffix that is calling a function not specially designed with transient support in mind, we need to do the ugly juggle like (transient-append-suffix 'org-cite-basic-follow "b" '("g" "goto" (lambda (citation prefix) (interactive (transient-scope)) (org-cite-basic-goto citation prefix)))) It would be so much nicer to write something simpler like (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." [["Open" ("b" "bibliography entry" org-cite-basic-goto :args (transient-args))]] (interactive) (if (or org-cite-basic-follow-ask prefix) ;; Imaginary :args slot (transient-setup 'org-cite-basic-follow nil nil :args (list citation prefix)) (org-cite-basic-goto citation prefix))) -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at