emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* small patch for ox-bibtex.el in contrib
@ 2020-04-24 10:59 Eric S Fraga
  2020-04-24 20:25 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Eric S Fraga @ 2020-04-24 10:59 UTC (permalink / raw)
  To: Emacs Org mode mailing list

[-- 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
configuration.

Thank you,
eric

-- 
: 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)
       t)))
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: small patch for ox-bibtex.el in contrib
  2020-04-24 10:59 small patch for ox-bibtex.el in contrib Eric S Fraga
@ 2020-04-24 20:25 ` Nicolas Goaziou
  2020-04-27  7:55   ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2020-04-24 20:25 UTC (permalink / raw)
  To: Emacs Org mode mailing list

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> 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
> configuration.

Thank you. I eventually pushed a different fix as I noticed other issues
in the code. Could you confirm it still solves your problem?

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: small patch for ox-bibtex.el in contrib
  2020-04-24 20:25 ` Nicolas Goaziou
@ 2020-04-27  7:55   ` Eric S Fraga
  0 siblings, 0 replies; 3+ messages in thread
From: Eric S Fraga @ 2020-04-27  7:55 UTC (permalink / raw)
  To: Emacs Org mode mailing list

On Friday, 24 Apr 2020 at 22:25, Nicolas Goaziou wrote:
> Thank you. I eventually pushed a different fix as I noticed other issues
> in the code. Could you confirm it still solves your problem?

Yes, thank you.  Jumping to an entry in my bibliography file works
perfectly. I've not tested anything else yet but will let you know if I
run into anything strange.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-546-gb4e91b


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-27  8:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 10:59 small patch for ox-bibtex.el in contrib Eric S Fraga
2020-04-24 20:25 ` Nicolas Goaziou
2020-04-27  7:55   ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).