From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mM52BFLpu2D1XQAAgWs5BA (envelope-from ) for ; Sat, 05 Jun 2021 23:14:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 1jiLO1Hpu2A3HQAA1q6Kng (envelope-from ) for ; Sat, 05 Jun 2021 21:14:57 +0000 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 88F33AF47 for ; Sat, 5 Jun 2021 23:14:57 +0200 (CEST) Received: from localhost ([::1]:35918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpddA-0000uV-H3 for larch@yhetil.org; Sat, 05 Jun 2021 17:14:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpdca-0000u8-RH for emacs-orgmode@gnu.org; Sat, 05 Jun 2021 17:14:20 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:44015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpdcZ-0000Xt-EK for emacs-orgmode@gnu.org; Sat, 05 Jun 2021 17:14:20 -0400 Received: by mail-wr1-x42d.google.com with SMTP id u7so7432822wrs.10 for ; Sat, 05 Jun 2021 14:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=L5nXFXfHkyPpfTW85nYzNVAHTfEcE1OrKvg8qOJ0bZs=; b=sYUJjkE43QpLkGfxN18YnKmm9uCpi8DCX2AMKq5ASjLTX5pT87beiI/4BGvezBbGQq qRucHahok4/fB1EBpGWp1FszaoBALCwyDMKVnwWJVGY1suF8M4rNitF1uZYYd45Zqgg2 HM3/M6cnqLjt0VUo6dgIWOaLeKS7jixGpmsSlaMGOnx9jrsfh5RHn1JHhvSeB+m5Qm7A QdGvk8nDzUprnG9Nw/YHKBWM6E0sgScaXwFZecfH7XOD/frw/GE1AgMRGZfz1ZToXnB1 inAaEqMmkCbsbHl6KT0pRLlw4XK8cO/CGhb1jJSMzv78fC3SmTmbNGACkcCUyDivwiJ4 HQMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=L5nXFXfHkyPpfTW85nYzNVAHTfEcE1OrKvg8qOJ0bZs=; b=fVhLSPTIEKyURh9MNAaHe8+sDeVyR95g2qldoW1/A7Q6iQVqakETPwMLw7FH20Yab9 Ckrn9zezOoQTPDRVzZZP2TksPTY3El4eIXdhjvuOkMtg2beuI+zhX/8YBFr5r/+riUNw vm7I5zwbhEH5kppKNEW139h2hmhjODhV0e15/c8aLVI61aS4Ijp9wIEwMPKTpqaoJUDR /sWAtiIA0FaAIUS5tVmaF5rlYMY3yOHVie0QH+xwbrddvH9xua2n0on2eGW7M266LVeK xcyemTAy0J432q/VO/5/c634RPvQB/VHX5fIMj6vtOx67HhEYmRu/fcMOFYrxOaREHpo u45g== X-Gm-Message-State: AOAM532Ds65WHPXA43TNHwTbwMyN2eZLIMr4likitpnie1JNooQMNAV1 Q0aqV6La3lHN/EMbxLvLsAHY7zsc9vPEoEhaIki3N7HzUFYeFQ== X-Google-Smtp-Source: ABdhPJw0ictR/bRgNqUexo667EhXHstuD/OTwJ5WdAiF64/VWtJDhtiREH0HdW3ioZhP8CnHHz1phPvVYRo44nvxyHI= X-Received: by 2002:adf:fd90:: with SMTP id d16mr9887666wrr.35.1622927657335; Sat, 05 Jun 2021 14:14:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Bruce D'Arcus" Date: Sat, 5 Jun 2021 17:14:06 -0400 Message-ID: Subject: Re: [org-cite] request for coding help on a capf to insert citation key To: org-mode-email Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=bdarcus@gmail.com; helo=mail-wr1-x42d.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.23 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622927697; 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=L5nXFXfHkyPpfTW85nYzNVAHTfEcE1OrKvg8qOJ0bZs=; b=HnWgOqodsO9wcpgn4k/An/L5HkW1tB0FnCib+o5YtnOaFHctLhldOYR8QDQfZexD9PchfR JdPndtW0WiZVRCtJh9SDv85/lZNPhbAWK7+yUDTVmWIJ2IPfL4SdN6RlCi9bUWITcxaANO xi+JjhuchisE0zPaLHpI5OD8NkVyixUX5RPi7OQE3rj2R2Ph8QOSBviTQV0oTV+HP6nw0+ ZmXA+JrcZHRbuFWsSFg2m78LrWTjmkc1qf2FziTUldGFAUgsAj+XkhUUqG+JsVvGJXwMOV pAob5yCCfJarA+2ceeRpDPXHUIRIpB4D3+Co6BZKrCGcbUnE74o8PxQJvrIdBA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622927697; a=rsa-sha256; cv=none; b=Ges3Hb5J4pkLX5mrunNM4FowZjrJJK3HVoI9go3nIUJwk+VYPhuWRWKiHiGtIuOzI3eun4 eOPp7uijcQuIpwUlsAFnUn8gNB66oZuZoEvvC67NZly3X6+DtXlQ08V5yF7LSLL1IMFOES X/z9Q+v9Vcn0q8GnSc936Jb/7WKIPKHUJzGoC9QcolQWHM+gDQuaQMbGUDiiCSy0vMaXgh te2iyEj6HnfRpWwXHjCPFZ+y+WCFM0o01P09P0QA8c7CepUTmfaJSOOFsr7ky2acIKYaZD j34HYcwMtA+JAPhGZ3+USVyOiGnxIsaAF3EsVzhGz8zoItQiUJ+EifsuQvcxkA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=sYUJjkE4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.63 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=sYUJjkE4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 88F33AF47 X-Spam-Score: -1.63 X-Migadu-Scanner: scn0.migadu.com X-TUID: t0qDygvP0Pyf Round 2, which should address the "regex" todo. --8<---------------cut here---------------start------------->8--- (defun bibtex-actions-complete-key-at-point-oc () "Complete org-cite citation key at point. When inserting '@' in a buffer the capf UI will present user with a list of entries, from which they can narrow against a string which includes title, author, etc., and then select one. This function will then return the key 'key', resulting in '@key' at point." ;; FIX exit-function is wrong; results in "no match" (when (and (eq major-mode 'org-mode) (eq (car (org-element-context)) 'citation)) (let* ((candidates (bibtex-actions--get-candidates)) (begin (save-excursion (backward-word) (point))) (end (point))) (list begin end candidates :exclusive 'no :exit-function (lambda (chosen status) (when (eq status 'finished) (cdr (assoc chosen candidates)))))))) --8<---------------cut here---------------end--------------->8---