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 qBFeODpiWWfcMwAA62LTzQ:P1 (envelope-from ) for ; Wed, 11 Dec 2024 09:58:19 +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 qBFeODpiWWfcMwAA62LTzQ (envelope-from ) for ; Wed, 11 Dec 2024 10:58:19 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Oe03o9tz; 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=1733911098; 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=qouNNBdCILPRcrdKWhWlETLqn6V/Gycb7Ev/z7PUih8=; b=h8E6ii7d9NsXgdLjaZs2upjHOir/Zb+0RhqDJdZfpWs/QSJ0bXfxy0XgD0yp+q7uuolTDe hQZAgrn8thnz04XptKI26vlaB+K54s+d3U1KVFEIzvpEELfxChV4R/lUp4GJvDz9NH1TFr w7bfKqjShFv3WW1ZU6mYoDv1oY+iyGl3AebBPt1B2qORzz9rOmTlQBe9WDZiC9QcfKl5Xd RSGDG1hjIjOylrUkyUmU5Q5OR75tpHFBv3IrExtCOlxVxspgKFidHCsGh4+HD/INEh21dM h70o5JdlPrHIZTT53YcCADfXt9xtex3zqGpByQ7IhMqWABJ0qneZj3BPOPHoMA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Oe03o9tz; 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=1733911098; a=rsa-sha256; cv=none; b=WN1UDK/6J9m4740j6Kt0PkR0pVA+zS49qOAniL1t8i+0vVIdFuDTECMuAdB2hhHLGDiFLw 5VUwyZP1Ts4cmMkf5TBzmHMrECsOZ89El3hvN2SbM4xlYYzu8siQQZG3cavJW1V3a3SPt5 KPGM60V56hLFWUUfC7Yn1eqGgTU/AtbNEkXasBo7x20IMHUIbm7vIwhTCuDA85AKkSLrjr Bq1vTxY2Xo6TE451BuZLMlKfGiVXqhiqmmUEqvRtO+0h5k12YJTW5WOFIMp1i60NrP8CVd xnAb5SmesGVVYFUZpa9FfHmKBZpf9e1TREOI58AYd9cygo+3kkePZBSP9IvNiQ== 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 A7B154536D for ; Wed, 11 Dec 2024 10:58:18 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLJTH-0000xA-14; Wed, 11 Dec 2024 04:57:33 -0500 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 1tLJTC-0000vJ-TD for emacs-orgmode@gnu.org; Wed, 11 Dec 2024 04:57:27 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLJTB-0005lK-5n for emacs-orgmode@gnu.org; Wed, 11 Dec 2024 04:57:26 -0500 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-3002c324e7eso49812201fa.3 for ; Wed, 11 Dec 2024 01:57:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733911041; x=1734515841; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qouNNBdCILPRcrdKWhWlETLqn6V/Gycb7Ev/z7PUih8=; b=Oe03o9tzYrurQ+TuyX08VcVZUm6GFURVxDSaZkRybJZZzHnZKtqnbFdPrs5puf3gj4 SczT6f3FOqwdEb6f4GlUksDwJ3XsDFJWvW5oYJI6u1fmk47EzUkzcET0sPc8gbI6L5VW VB74o+Pj0/9NnKka9EBkgKLMo86akRGPeD9AjIPPL5H+nCknhyQaYxsY/Jvevvmxlky3 6T04ul2LKcF5efF06Zm51Nx9XugH3JPUfXxOppgYyTORBi89Bcst5X0JgNzt2XdSgUYD 8VBU3f/O9MvJxfYYotNATOIepIgwzLI12W9B66e7zVILjb7br5MdCtUZexoO5TDeh0+c GJyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733911041; x=1734515841; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qouNNBdCILPRcrdKWhWlETLqn6V/Gycb7Ev/z7PUih8=; b=VxPE0hCeDbXQ/Xn7K3x8Ymg5VWcjPk45YvsF4mVLB0C6wjFyPA9i/HNF0P17ca8gRO 8SxstXjnrrm7L8NZ6v/haYTksKedaWZAmWCFwLmJWPVy49N+IDhanKTx42OvrkJkunvk asvpUy4Jekuwk4W54DJM5+9Lhdaznl5hTqiyNGInUU5UzHb/MHEly8ZtYv7fgq46zu9e y7yccV/Gucy1LCDRVsKFp8CVpxmvCsLEx/txQ+bRBv3V1cvz7oatibN9inlWu+E0fgU3 LPram68kuat5tfc5VeSow9CNYaX3UDjabX4iGA3czTRiwS/Sr4D3APHaRSLjUjhyTuN6 6pBw== X-Gm-Message-State: AOJu0Yy/kdcc/0Z4svuIA1emmWBSgJpzXF+xgpf4R8DwbEJih1weeyCb 1HIugzv/8zCys/hpKt//RzViG+PY2c+mVVqWTEKHYllqdldh2X9YDi6nrA== X-Gm-Gg: ASbGnctIc95xkgqu46j0tXEYv28968BtaWBirUu0EsG+Vjgn2SQBqAG01Fuws/DYy+T VSIyxScWmyLs1m6y25A2doeADC1T6wFEwKb3ieJNwuQfDuoHwfZS16EzdGQ6AIHKCo21/O+aT+i 6OtWbYirocprl6AR1Rs/DBFnu/HV/pIsAMTZQAwET9M4tlSupxe319q06J4bFfN2DL+kFWg1qGU 7aNjphg4IeUaWUul3bwmeCKUBuQeQ7EU237U8nJXeNuBQ== X-Google-Smtp-Source: AGHT+IEUlQVki/c1tIFMnBqpr+hIfH0QjrfDQajhnq5YYWQnK91SgZVgxV2bA0Yk/YtG2ZZGYIdFIQ== X-Received: by 2002:a05:651c:996:b0:302:3021:9b03 with SMTP id 38308e7fff4ca-30240d3cd68mr7525341fa.17.1733911040548; Wed, 11 Dec 2024 01:57:20 -0800 (PST) Received: from barbar ([193.64.204.56]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-300377700a9sm14618501fa.40.2024.12.11.01.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 01:57:19 -0800 (PST) From: =?utf-8?Q?Tor-bj=C3=B6rn_Claesson?= To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: Fwd: Org-cite: Replace basic follow-processor with transient menu? In-Reply-To: <87o71jwdxz.fsf@localhost> (Ihor Radchenko's message of "Tue, 10 Dec 2024 19:11:36 +0000") References: <8734m28l9a.fsf@gmail.com> <87a5eievav.fsf@localhost> <87wmhlmp83.fsf@gmail.com> <871pzte929.fsf@localhost> <87v7x548ri.fsf@gmail.com> <87y120daue.fsf@localhost> <874j4m9ep6.fsf@gmail.com> <87h68gfqj1.fsf@localhost> <87pln3f3cc.fsf@localhost> <87jzd9ojj0.fsf@localhost> <87cyj0ajm9.fsf@gmail.com> <87zfm4s50x.fsf@localhost> <87wmh8s358.fsf@localhost> <87y11nwp9z.fsf@gmail.com> <87v7wd9a2h.fsf@localhost> <878qt7fbki.fsf@gmail.com> <87o71jwdxz.fsf@localhost> Date: Wed, 11 Dec 2024 11:57:14 +0200 Message-ID: <871pyefsp1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) 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::22e; envelope-from=tclaesson@gmail.com; helo=mail-lj1-x22e.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: -4.20 X-Spam-Score: -4.20 X-Migadu-Queue-Id: A7B154536D X-TUID: HJ1fLP0tdHT7 Ihor Radchenko writes: >> +(defcustom org-cite-basic-follow-actions >> + '[["Open" >> + ("b" "bibliography entry" (org-cite-basic-goto !citation !prefix))] >> + ["Copy" >> + ("d" "DOI" >> + (kill-new >> + (save-excursion >> + (with-temp-buffer >> + (mapc #'insert-file-contents org-cite-global-bibliography) >> + (bibtex-set-dialect (parsebib-find-bibtex-dialect) t) >> + (bibtex-search-entry (org-element-property :key !citation)) >> + (setq doi (bibtex-autokey-get-field "doi")) >> + (replace-regexp-in-string "^http://dx.doi.org/" "" doi)))))]] >> + "Actions in the `org-cite-basic-follow' transient menu. > > Two comments here: > 1. It should not be a lambda. Better have a function or even command > 2. The logic is not right. You should better follow > `org-cite-basic--key-completion-table': > `org-cite-basic--parse-bibliography', `org-cite-basic--get-entry', > and `org-cite-basic--get-field'. Thanks for taking the time to look at this. This was originally stolen from org-ref, but can be greatly simplified using org-cite-basic--get-field. I am not sure how to go about getting the citation key from the citation. In the attached patch I introduce a org-cite-basic--get-key helper function, which takes the behaviour of org-cite-basic-goto to extract citation keys from a citation-or-citation-reference. The other option is of course to just use (org-element-property :key !citation). Which approach would be better? Cheers, Tor-bj=C3=B6rn