From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id yOwhH8GP8mZDUwAAqHPOHw:P1 (envelope-from ) for ; Tue, 24 Sep 2024 10:09:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id yOwhH8GP8mZDUwAAqHPOHw (envelope-from ) for ; Tue, 24 Sep 2024 12:09:05 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=IAZdNBvF; dmarc=pass (policy=none) header.from=gmail.com; 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=1727172545; 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=1/5pv+bn5Ddo/pDxNMoZPmPOClTyJ2PV+3MELp0fS2Q=; b=lC2axASrttAMJra+YJ/MKQ2w573dkAVs5KAtsfQ69y32M+2mqVUL7/t3dh3z7HnaAByMvV lX8os1Rg091XXa3wMVUPeVF5Rwf+OTwT9CfUGgbAaCzvnwaevSrXo6b/KU26ZixNpPcyUA 1qp3vEBDoP5q9qJadrqzftoiOhaw1s3c59+ea4kpWmuDlcYccVHC5D78WyrdBQa9TEhzzJ CF2x5bZbRXBq1R6+nYXhVzP944SbcRIK8TvEU+4irhI74K3G3d94ToAaKB72h3jsV4xdGC dBk0KhZ+3E9A9Znf9Dzy7SNavtSJDTBMG/r0W4jNxXEDMkHOC3pi2Q2f64oqVg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727172545; a=rsa-sha256; cv=none; b=ennrdETiCT/8k8gt2PXMKfVquY0Wo1+XwJxrjImEelFp4+VBtB7Z20A3aY9/n0qJp7IAiS SkHcE7Ix2F9Nf/TMU9/ES0T19TY/jRio4YUr+h5N4oms+tA1gvJUUeMjfOclrMpkQEpwXM nl/Qn8tZcOQxk99bdU4uXEyiU5V+bomvL2E3b0uLh7XxXszStExZ2nW+57m5gw7cAxxzEA 3ipD7dyS4tKq/1LD60OQ/gfiuXUgjXETXKl/WuLu1O2zgd53mcJ0LUTaDK5UMTP7zGcZka nHBA91pqm0VL4/1VIY2nU9e8yQv9MUO6Tdio3njoba4OVlAXAtxIvquYpFnPVg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=IAZdNBvF; dmarc=pass (policy=none) header.from=gmail.com; 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" 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 1E6285D7AA for ; Tue, 24 Sep 2024 12:09:05 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1st2Sp-0003eW-PH; Tue, 24 Sep 2024 06:08:11 -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 1st2Sn-0003Wr-PB for emacs-orgmode@gnu.org; Tue, 24 Sep 2024 06:08:10 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1st2Sl-0003Qg-K5 for emacs-orgmode@gnu.org; Tue, 24 Sep 2024 06:08:09 -0400 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2f761cfa5e6so56039611fa.0 for ; Tue, 24 Sep 2024 03:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727172485; x=1727777285; 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=1/5pv+bn5Ddo/pDxNMoZPmPOClTyJ2PV+3MELp0fS2Q=; b=IAZdNBvFuSYpYbETCkwFcfa5rNOR+XRxOc/b6aR+rFBg8e8cGsGeU7XrqbR0lDHv9x pzo8hzMlvfTPPsG0Zx/W/SwcYNw7wX8Obe1p/kYXhBTMONoq3nmE2bacSw7KlQ423PgD wpH3sT+sGwJKTOMC/gnJKO5E47uzUYx1ZtTrb1aMKLRAk1gb2YNSF0+hmpDmweV/291D 7Mi/bUBTgA9a+lCooe0g3UW5Z+gxdcN8B9CVrXRwJX1yA1Iu+ncifqlXYZh1vqH9rF50 tayGKGsWPbb712xpWBJYRhgDzk6AbCDeVU0ZkYaV46GsnaJ5iQtZrD0qs49+lhZc4WLB z2rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727172485; x=1727777285; 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=1/5pv+bn5Ddo/pDxNMoZPmPOClTyJ2PV+3MELp0fS2Q=; b=udDc87aYONcLVv8Yv8ygI+ryFDgwkQfZv9HM/gaEc0TJZ/l4EQq5wquFL6EkX58wIF ugk9MN8A1HIF/AM8R2/dr8Q0nVEKLBdAPAUEbFBhnIGP2TV1LdpjeHPfDtp6RWkNr883 8Oyk5N2EjALxaIGXHToTFXjREd2kMUiureZHUbs+tLgrYlCoI6dI1YUpgky9+s+2eyqo LjLSxc5dA6cnZmqv1985DrSCRMsyY+KGOutdFdbP9WitEpPkKyQyDWh5n1Ls4iFFnCR1 O95CMBQHQzajLsXAmhrxr3RG/2g3uxzHH/yO3ZNiqhBJWF02bDDlLXnaWVGsME+ePbcs nRxA== X-Forwarded-Encrypted: i=1; AJvYcCUWaGd3fL/b1/a4W7TtFMJDOqntfTbkkcQTsGhC+gZ2csMu6zEm+wNwz+mVF9CG4guNcMNfK4QyaRh1QfZA@gnu.org X-Gm-Message-State: AOJu0YzVel1y/3JDYZQNOAqWOqIgZrSfqaQOdJFD4KeIDNJYj6X871G1 PMUOODheO2MNzyNFezBb31gmfwwEAXJz7J28EEguMQF3wAQm3EIxm7bohg== X-Google-Smtp-Source: AGHT+IEoJx6HAsVBcFrQW7xOKGYGeUUf/kPkHi9kPj+zWSX9EeHlo9G6OfQs6g5E6rGVL8wmBXjyoA== X-Received: by 2002:a2e:bea1:0:b0:2f7:4f58:4a9c with SMTP id 38308e7fff4ca-2f7cb2eda53mr79683231fa.16.1727172484286; Tue, 24 Sep 2024 03:08:04 -0700 (PDT) Received: from barbar (mobile-access-d51ce3-191.dhcp.inet.fi. [213.28.227.191]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f8d289f1bcsm1750651fa.126.2024.09.24.03.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 03:08:03 -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: <87cykvrgwr.fsf@localhost> (Ihor Radchenko's message of "Sun, 22 Sep 2024 12:50:44 +0000") References: <8734m28l9a.fsf@gmail.com> <874j6h3rw8.fsf@localhost> <877cbamq2q.fsf@gmail.com> <87cykvrgwr.fsf@localhost> Date: Tue, 24 Sep 2024 13:07:56 +0300 Message-ID: <8734lpmkjn.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::234; envelope-from=tclaesson@gmail.com; helo=mail-lj1-x234.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-Spam-Score: -4.61 X-Spam-Score: -4.61 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Queue-Id: 1E6285D7AA X-TUID: PiwQ31Thd+8q Ihor Radchenko writes: > Tor-bj=C3=B6rn 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 problem. But my idea may still be used - without prefix argument, > just move to citation record; with prefix argument - invoke the menu. > > Follow processors are provided with prefix argument passed to > `org-open-at-point': > > (defun org-cite-basic-goto (datum _)... > > The "_" argument is the currently ignored prefix argument. > Ah, I did not understand. Thanks for explaining! This has the nice effect of not changing the previous behaviour. I think this should be customizeable. >> I have played some more with this - would it be a good idea to include >> macros to get citekey, datum and _? I would be happy to clean this up a >> bit, add DOI/ISBN/URL-functionality, documentation and prepare a bug rep= ort/patch. >> >> (defmacro org-cite-basic-follow--citekey () >> '(org-element-property :key (car (oref (transient-prefix-object) scope= )))) >> >> (defmacro org-cite-basic-follow--datum () >> '(car (oref (transient-prefix-object) scope))) >> >> (defmacro org-cite-basic-follow--_ () >> '(cadr (oref (transient-prefix-object) scope))) >> >> (transient-define-prefix org-cite-basic-follow (datum _) >> "How should we follow references?" >> [["Open" >> ("b" "bibliography entry" >> (lambda () >> (interactive) >> (org-cite-basic-goto >> (org-cite-basic-follow--datum) >> (org-cite-basic-follow--_))))] > > This looks way too complicated. > 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 feedback, I now ha= ve: (defcustom org-cite-basic-follow-ask nil "Should org-cite-basic ask how to follow citations?" :group 'org-cite :type 'boolean) (transient-define-prefix org-cite-basic-follow (citation &optional prefix) "Follow a citation reference. New actions can be added using transient-append-suffix.=20 The body of such new actions should have the form: (lambda (citation prefix) (interactive (oref (transient-prefix-object) scop= e)) ...)" [["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)]] (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))) (transient-define-suffix org-cite-basic-follow.open-bibliography (citation = prefix) "Find bibliography entry for citation" (interactive (oref (transient-prefix-object) scope)) (org-cite-basic-goto citation prefix)) =20=20 ... 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"))))) Does this start to look ok, and is there something else I should address if this was to be included in org-mode? Cheers, Tor-bj=C3=B6rn