emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Emacs Org mode mailing list <emacs-orgmode@gnu.org>
Subject: small patch for ox-bibtex.el in contrib
Date: Fri, 24 Apr 2020 11:59:40 +0100	[thread overview]
Message-ID: <87v9lpkv37.fsf@ucl.ac.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]

Dear all,

the contrib package ox-bibtex.el has a function for jumping to a
specific bibtex citation key.  The current regex assumes a particular
indentation style (leading spaces) and only one space between the
CUSTOM_ID key and the value of that key.  This small patch (hopefully)
generalizes the search regex.

I've done only some simple testing but seems to work for my

Thank you,

: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-520-ge69937

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-generalize-search-pattern-for-finding-bibtex-entry.patch --]
[-- Type: text/x-diff, Size: 1111 bytes --]

From a5439ba716978a447274993a2b77cf8e2898c530 Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fraga@ucl.ac.uk>
Date: Fri, 24 Apr 2020 11:46:28 +0100
Subject: [PATCH] generalize search pattern for finding bibtex entry

* ox-bibtex.el (org-bibtex-goto-citation): The search regex for
finding a particular citation assumed a particular indentation style
for properties.  This change generalizes the regex to work
independently of the indentation style.
 contrib/lisp/ox-bibtex.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/ox-bibtex.el b/contrib/lisp/ox-bibtex.el
index 47e2d5dcc..16d538ee5 100644
--- a/contrib/lisp/ox-bibtex.el
+++ b/contrib/lisp/ox-bibtex.el
@@ -163,7 +163,7 @@ to `org-bibtex-citation-p' predicate."
     (find-file (or org-bibtex-file
 		   (error "`org-bibtex-file' has not been configured")))
     (goto-char (point-min))
-    (when (re-search-forward (format "  :CUSTOM_ID: %s" citation) nil t)
+    (when (re-search-forward (format "[ \t]*:CUSTOM_ID:[ \t]+%s" citation) nil t)
       (outline-previous-visible-heading 1)

             reply	other threads:[~2020-04-24 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 10:59 Eric S Fraga [this message]
2020-04-24 20:25 ` small patch for ox-bibtex.el in contrib Nicolas Goaziou
2020-04-27  7:55   ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9lpkv37.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).