emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leonard Randall <leonard.a.randall@gmail.com>
To: emacs-orgmode@gnu.org, Bastien <bzg@gnu.org>
Subject: Re: Bug: Error with org-bibtex export with tags when using custom bibtypes [8.2.5h (8.2.5h-82-gd91d4b-elpaplus @ /Users/leonardaveryrandall/.emacs.d/elpa/org-plus-contrib-20140324/)]
Date: Sat, 19 Apr 2014 14:51:10 +0100	[thread overview]
Message-ID: <CAMRQoAkJS=SneKZrQOMgE1k4jicSUKfN7u=XnF94S33Nm9GY=g@mail.gmail.com> (raw)
In-Reply-To: <CAMRQoAkeMtrMm5bjtC1KMocTZ6sk3JU-vDz=6NZbcUSf9icw0Q@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 916 bytes --]

Hi Bastien et. al,
I figured out how to fix the bug i reported awhile ago. The problem was
that when making the keyword field for entries without keywords defined in
the `:PROPERTIES:' drawer,  org-bibtex uses `bibtex-make-field' from
`bibtex.el'. This function sends up an error if there are no fields defined
for the type of bib entry you are calling it on. In order to make it work
on non-standard bib types you would have to define the fields associated
with these types in `bibtex-entry-alist'.
One way to deal with this would be to mention this in the appropriate
docstrings. However this would leave org-bibtex somewhat unstable and
dependent on variables outside of `org'.  I think a better solution is to
make the keyword field without calling `bibtex-make-field'. This can be
done with a couple simple regexp functions.

Here is the patch that I came up with. Let me know what you think.
All best,
Leonard

[-- Attachment #1.2: Type: text/html, Size: 1036 bytes --]

[-- Attachment #2: org-bibtex.patch --]
[-- Type: application/octet-stream, Size: 591 bytes --]

diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 82eecdb..abcf0b4 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -385,7 +385,9 @@ and `org-exclude-tags-from-inheritence'."
 	    (bibtex-beginning-of-entry)
 	    (if (re-search-forward "keywords.*=.*{\\(.*\\)}" nil t)
 		(progn (goto-char (match-end 1)) (insert ", "))
-	      (bibtex-make-field "keywords" t t))
+	      (progn (re-search-forward ",\\(\n\\)" nil t) 
+		  (insert "  keywords={},\n"))
+	      (re-search-backward "}," nil t))
 	    (insert (mapconcat #'identity tags ", ")))
 	  (buffer-string))))))
 

  reply	other threads:[~2014-04-19 13:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25 21:03 Bug: Error with org-bibtex export with tags when using custom bibtypes [8.2.5h (8.2.5h-82-gd91d4b-elpaplus @ /Users/leonardaveryrandall/.emacs.d/elpa/org-plus-contrib-20140324/)] Leonard Randall
2014-04-19 13:51 ` Leonard Randall [this message]
2014-04-19 14:42   ` Bastien
2014-04-19 15:45     ` Leonard Randall
2014-04-19 18:11       ` Bastien
     [not found]         ` <CAMRQoAni6bs8DrTRN-_esu7ck49vYa=fwES7TBMLbhcuZ9ad6Q@mail.gmail.com>
     [not found]           ` <87lhv0qzom.fsf@bzg.ath.cx>
2014-04-20 15:18             ` Leonard Randall
  -- strict thread matches above, loose matches on Subject: below --
2014-03-25 15:47 Leonard Randall

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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='CAMRQoAkJS=SneKZrQOMgE1k4jicSUKfN7u=XnF94S33Nm9GY=g@mail.gmail.com' \
    --to=leonard.a.randall@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

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