From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ADFBGubl5F/7TQAA0tVLHw (envelope-from ) for ; Thu, 24 Dec 2020 19:03:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 260fFubl5F++eAAAB5/wlQ (envelope-from ) for ; Thu, 24 Dec 2020 19:03:02 +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 887B89403E6 for ; Thu, 24 Dec 2020 19:02:58 +0000 (UTC) Received: from localhost ([::1]:49446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksVt3-0003jO-8d for larch@yhetil.org; Thu, 24 Dec 2020 14:02:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksVs2-0003iX-M9 for emacs-orgmode@gnu.org; Thu, 24 Dec 2020 14:01:54 -0500 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:40115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksVs0-0007T5-V6 for emacs-orgmode@gnu.org; Thu, 24 Dec 2020 14:01:54 -0500 Received: by mail-qk1-x72b.google.com with SMTP id z11so2715648qkj.7 for ; Thu, 24 Dec 2020 11:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:user-agent:from:to:subject:message-id:date:mime-version; bh=ZRJHtYjkOjUZGIaS4aeV1ifv2NixdQBxAAWMEGUecLg=; b=LTXIbBVG+Yej9ZvWIPkCw3Kjm/yLlzYcW2fU3dZMYUaM+HzKWUKisD+4fwguRyjrws bjkGHAT06Z6eaqSI1frdNbYcAJibt2T9MAYs9QZFIn7JImEllGqpPuKfXl0UoG0BPRCh miwLlXxplNrr09y0WoApwKkT/XkaFMGBn6WOr9O2rFZXidhqR7an4hBzm/UVdUXaQ9iF VdMKUEDzkhNFRtUyvbzQIy3b+veiCJ73oZdo/0L2Mrqy+9tOp4ejW7FgSZNNPRPSHs7H fxfAABJiYZuwcFVrmCsSgR8seP1cf3PSb+WlAmPRXQpWC7MtQ1aEx3oDy7w/ZSqdMgno AR6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:user-agent:from:to:subject:message-id :date:mime-version; bh=ZRJHtYjkOjUZGIaS4aeV1ifv2NixdQBxAAWMEGUecLg=; b=AcsSOjGAzBKz1wlW2dbGwLFcAKug4KL6mY3rvMNZ4oh1faye21nEl0PW02eGYwcfDP s3klBTcXXp3PUXwRLTJD+APGS5+fgzlNu06aMYTz9S4Y6I8ThQckqjaLw1JRB3vAlCWd n/A7JWSZsvmxphieBZJG6qi6EJF70AaKUMutBthDbNtmXxOeNHMlu7qU2VkZulI3AeB1 geO7GPnE9gcvpYVOclrw0romgvSJU2tgipLQbL9YeU0sykPkX37Mhacyg/JgePziFZ22 +eky9trhIwo2HkS6y5xAuSnFvbayNCZar9X5W8etgOitpVE4Giapke/v5YQKTw7mep0x D/rg== X-Gm-Message-State: AOAM530nVAk0Yzdmoob8Qd3ywn0MqpiOpvF3jx3tNoiKb57hctvKYSuc NRejmmCAEghGIVNbWcTdEpwXrsMmoK3mUg== X-Google-Smtp-Source: ABdhPJxzSA7gliP13pDIb3KU4qEE+vKqaVLdQdP4ro/rgNlUtqqbymc9vZGtrCfdemL2WEe8YaHgLQ== X-Received: by 2002:a37:7f02:: with SMTP id a2mr31626235qkd.356.1608836508414; Thu, 24 Dec 2020 11:01:48 -0800 (PST) Received: from gusbrs-laptop ([156.146.42.64]) by smtp.gmail.com with ESMTPSA id m13sm16730201qtu.93.2020.12.24.11.01.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Dec 2020 11:01:47 -0800 (PST) User-agent: mu4e 1.4.13; emacs 27.1 From: Gustavo Barros To: emacs-orgmode@gnu.org Subject: [FR] Generalize org-reftex-citation Message-ID: <87sg7vkoyv.fsf@gmail.com> Date: Thu, 24 Dec 2020 16:01:44 -0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=gusbrs.2016@gmail.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, 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 X-Migadu-Spam-Score: 0.28 Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=gmail.com header.s=20161025 header.b=LTXIbBVG; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: 887B89403E6 X-Spam-Score: 0.28 X-Migadu-Scanner: scn1.migadu.com X-TUID: rgRtmkDMynjA Hi All, It's been some time since included in my todos to cook something to insert citations in Org using RefTeX's infrastructure. As I set this morning to do so, I found out it already existed: `org-reftex-citation'. Alas, it is not enough for me (and certainly also others), because it uses a simple regexp search for "#+BIBLIOGRAPHY:", thus only being able to find the .bib file with that specific form of declaration. In particular, it does not support biblatex (as far as I can tell). Before I found out the function existed, I had a general idea of letting RefTeX work in the exported .tex file. It turns out it is easy to adapt `org-reftex-citation' to do precisely that. And in so doing, being thus able to do anything RefTeX is able to support in its native environment, on top of anything Org is able to export. The only disadvantage I see, and which I consider minor, is that the .tex file has to exist. My take on this neat little idea so far is: #+begin_src emacs-lisp (defvar gb/org--rds nil) (defun gb/org-reftex-citation () "Use `reftex-citation' to insert a citation into the buffer. The bibliography sources for the base Org file are found by RefTeX itself parsing the corresponding exported \".tex\" file, which is required to exist. Those are passed to `reftex-citation' to insert a citation into the base Org buffer." (interactive) (unless (derived-mode-p 'org-mode) (user-error "Not an Org buffer")) (let ((tex-file (org-export-output-file-name ".tex"))) (if (file-readable-p tex-file) (find-file-noselect tex-file) (user-error "TeX file not available, export first to %S" tex-file)) (let ((reftex-docstruct-symbol 'gb/org--rds) gb/org--rds) (with-current-buffer (get-file-buffer tex-file) (reftex-access-scan-info nil) (setq gb/org--rds (symbol-value reftex-docstruct-symbol))) (call-interactively 'reftex-citation)))) #+end_src Still lightly tested, but looks good with what I tried out. So, I thought it was a good idea to send this to the list as suggestion / feature request. Best regards, Gustavo.