emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2014-03-25 15:47 Leonard Randall
  0 siblings, 0 replies; 7+ messages in thread
From: Leonard Randall @ 2014-03-25 15:47 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

When I attempt to run M-x org-bibtex on a .org file with non-standard
bibtex types that have a tag, they fail to export if
org-bibtex-tags-are-keywords is set to t. This persists even if I add the
bibtex type to org-bibtex-types.  I checked, and this problem persists with
a minimal init file, and a minimal org file. I have also checked, and I get
the same problem with Emacs 24.3.5 from emacsforosx.  I just started using
org-bibtex so I do not know how far the bug goes back.

Here is a minimal example that gets the bug.


** Critique of Practical Reason :ex:
:PROPERTIES:
:TITLE: Critique of Practical Reason
:BOOKTITLE: Practical Philosophy
:BTYPE: bookinbook
:CUSTOM_ID: Kant:1996a
:AUTHOR: Kant, Immanuel
:PAGES: 133--276
:TRANSLATOR: Gregor, Mary J
:EDITOR: Gregor, Mary J
:YEAR:  1996
:PUBLISHER: Cambridge University Press
:ADDRESS: Cambridge UK
:END:



I press ``M-x org-bibtex'' it returns ``Bibtex error on "Critique of
Practical Reason"". This error does not occur if I change ``BTYPE" to
``book'' or if I remove the tag ``:ex:'' from the headline. As I noted
above, I added ``bookinbook'' to the org-bibtex-types and added the
appropriate fields there and in org-bibtex-fields.



Here is a minimal init:

(setq org-bibtex-types
  '((:article
     (:description . "An article from a journal or magazine")
     (:required :author :title :journal :year)
     (:optional :volume :number :pages :month :note :annote :url :abstract
:keywords :file :uri))
    (:book
     (:description . "A book with an explicit publisher")
     (:required (:editor :author) :title :publisher :year)
     (:optional (:volume :number) :series (:address :location) :edition
:month :note :annote :url :abstract :keywords :file :uri))
    (:bookinbook
     (:description . "A part of a book, which could be, and once was, its
own book.")
     (:required :title (:chapter :pages) :publisher :year :booktitle)
     (:optional :crossref :author :editor :volume :translator :number
:series :type :address :location :edition :note :annote :url :abstract
:keywords :file :uri))
    (:booklet
     (:description . "A work that is printed and bound, but without a named
publisher or sponsoring institution.")
     (:required :title)
     (:optional :author :howpublished (:address :location) :month :year
:note :annote :url :abstract :keywords :file :uri))
    (:conference
     (:description . "")
     (:required :author :title :booktitle :year)
     (:optional :editor :pages :organization :publisher (:address
:location) :month :note :annote :url :abstract :keywords :file :uri))
    (:inbook
     (:description . "A part of a book, which may be a chapter (or section
or whatever) and/or a range of pages.")
     (:required (:author :editor) :title (:chapter :pages) :publisher :year)
     (:optional :crossref (:volume :number) :series :type (:address
:location) :edition :month :note :annote :url :abstract :keywords :file
:uri))
        (:incollection
     (:description . "A part of a book having its own title.")
     (:required :author :title :booktitle :publisher :year)
     (:optional :crossref :editor (:volume :number) :series :type :chapter
:pages (:address :location) :edition :month :note :annote :url :abstract
:keywords :file :uri))
    (:inproceedings
     (:description . "An article in a conference proceedings")
     (:required :author :title :booktitle :year)
     (:optional :crossref :editor (:volume :number) :series :pages
(:address :location) :month :organization :publisher :note :annote :url
:abstract :keywords :file :uri))
    (:manual
     (:description . "Technical documentation.")
     (:required :title)
     (:optional :author :organization (:address :location) :edition :month
:year :note :annote :url :abstract :keywords :file :uri))
    (:mastersthesis
     (:description . "A Masterâ EURO (tm)s thesis.")
     (:required :author :title :school :year)
     (:optional :type (:address :location) :month :note :annote :url
:abstract :keywords :file :uri))
    (:misc
     (:description . "Use this type when nothing else fits.")
     (:required)
     (:optional :author :crossref :booktitle :date :title :howpublished
:month :year :note :annote :location :url :abstract :keywords :file :uri))
    (:phdthesis
     (:description . "A PhD thesis.")
     (:required :author :title :school :year)
     (:optional :type (:address :location) :month :note :annote :url
:abstract :keywords :file :uri))
    (:proceedings
     (:description . "The proceedings of a conference.")
     (:required :title :year)
     (:optional :editor (:volume :number) :series (:address :location)
:month :organization :publisher :note :annote :url :abstract :keywords
:file :uri))
    (:techreport
     (:description . "A report published by a school or other institution.")
     (:required :author :title :institution :year)
     (:optional :type (:address :location) :month :note :annote :url
:abstract :keywords :file :uri))
    (:unpublished
     (:description . "A document having an author and title, but not
formally published.")
     (:required :author :title :note)
     (:optional :month :year :annote :url :abstract :keywords :file :uri)))
)

(setq org-bibtex-fields
  '((:address      . "Usually the address of the publisher or other type of
institution.  For major publishing houses, van Leunen recommends omitting
the information entirely.  For small publishers, on the other hand, you can
help the reader by giving the complete address.")
    (:annote       . "An annotation.  It is not used by the standard
bibliography styles, but may be used by others that produce an annotated
bibliography.")
    (:author       . "The name(s) of the author(s), in the format described
in the LaTeX book.  Remember, all names are separated with the and keyword,
and not commas.")
    (:booktitle    . "Title of a book, part of which is being cited.  See
the LaTeX book for how to type titles.  For book entries, use the title
field instead.")
    (:chapter      . "A chapter (or section or whatever) number.")
    (:crossref     . "The database key of the entry being cross
referenced.")
    (:edition      . "The edition of a book for example, 'Second'.  This
should be an ordinal, and should have the first letter capitalized, as
shown here; the standard styles convert to lower case when necessary.")
    (:editor       . "Name(s) of editor(s), typed as indicated in the LaTeX
book.  If there is also an author field, then the editor field gives the
editor of the book or collection in which the reference appears.")
    (:howpublished . "How something strange has been published.  The first
word should be capitalized.")
    (:institution  . "The sponsoring institution of a technical report.")
    (:journal      . "A journal name.")
    (:key          . "Used for alphabetizing, cross-referencing, and
creating a label when the author information is missing.  This field should
not be confused with the key that appears in the \cite command and at the
beginning of the database entry.")
    (:month        . "The month in which the work was published or, for an
unpublished work, in which it was written.  You should use the standard
three-letter abbreviation,")
    (:note         . "Any additional information that can help the reader.
 The first word should be capitalized.")
    (:number       . "Any additional information that can help the reader.
 The first word should be capitalized.")
    (:organization . "The organization that sponsors a conference or that
publishes a manual.")
    (:pages        . "One or more page numbers or range of numbers, such as
42-111 or 7,41,73-97 or 43+ (the â EURO ~+â EURO (tm) in this last example indicates
pages following that donâ EURO (tm)t form simple range). BibTEX requires double
dashes for page ranges (--).")
    (:publisher    . "The publisherâ EURO (tm)s name.")
    (:school       . "The name of the school where a thesis was written.")
    (:series       . "The name of a series or set of books.  When citing an
entire book, the the title field gives its title and an optional series
field gives the name of a series or multi-volume set in which the book is
published.")
    (:title        . "The workâ EURO (tm)s title, typed as explained in the LaTeX
book.")
    (:type         . "The type of a technical report for example, 'Research
Note'.")
    (:volume       . "The volume of a journal or multi-volume book.")
    (:year         . "The year of publication or, for an unpublished work,
the year it was written.  Generally it should consist of four numerals,
such as 1984, although the standard styles can handle any year whose last
four nonpunctuation characters are numerals, such as '(about 1984)'")
    (:url          . "A URL for the reference")
    (:uri          . "Another common url field")
    (:annote       . "Annotation is typically not exported")
    (:abstract     . "Abstract for annotated bibliography")
    (:keywords     . "Keywords for sorting with ebib")
    (:file         . "A local file path used by ebib to open the reference
in an appropriate application")
    (:location     . "The location published")

))

(setq org-bibtex-tags-are-keywords t)
(setq org-bibtex-export-arbitrary-fields nil)
(setq org-bibtex-prefix nil)



It may also be useful to note that if I set ``org-bibtex-prefix'' to "bib"
and set ``org-bibtex-export-arbitrary-fields'' to t (and of course edit the
property names in my .org file appropriately), I get an error even with
standard bib types.

Below is the bug report.

Thanks so much for your help,
All the best,
Leonard


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------


Emacs  : GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, NS
apple-appkit-1265.19)
 of 2014-03-15 on macintosh-2.home
Package: Org-mode version 8.2.5h (8.2.5h-82-gd91d4b-elpaplus @
/Users/leonardaveryrandall/.emacs.d/elpa/org-plus-contrib-20140324/)

current state:
==============
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
      org-src-native-tab-command-maybe
      org-babel-hide-result-toggle-maybe
      org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
     org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook org-show-block-all
    append local]
   5]
 #[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook
    org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
  org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-hide-inline-tasks org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-bibtex-tags-are-keywords t
 )

[-- Attachment #2: Type: text/html, Size: 17284 bytes --]

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

* 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/)]
@ 2014-03-25 21:03 Leonard Randall
  2014-04-19 13:51 ` Leonard Randall
  0 siblings, 1 reply; 7+ messages in thread
From: Leonard Randall @ 2014-03-25 21:03 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

When I attempt to run M-x org-bibtex on a .org file with non-standard
bibtex types that have a tag, they fail to export if
org-bibtex-tags-are-keywords is set to t. This persists even if I add the
bibtex type to org-bibtex-types.  I checked, and this problem persists with
a minimal init file, and a minimal org file. I have also checked, and I get
the same problem with Emacs 24.3.5 from emacsforosx.  I just started using
org-bibtex so I do not know how far the bug goes back.

Here is a minimal example that gets the bug.


** Critique of Practical Reason  :ex:
:PROPERTIES:
:TITLE: Critique of Practical Reason
:BOOKTITLE: Practical Philosophy
:BTYPE: bookinbook
:CUSTOM_ID: Kant:1996a
:AUTHOR: Kant, Immanuel
:PAGES: 133--276
:TRANSLATOR: Gregor, Mary J
:EDITOR: Gregor, Mary J
:YEAR:  1996
:PUBLISHER: Cambridge University Press
:ADDRESS: Cambridge UK
:END:



I press ``M-x org-bibtex'' it returns ``Bibtex error on "Critique of
Practical Reason"". This error does not occur if I change ``BTYPE" to
``book'' or if I remove the tag ``:ex:'' from the headline. As I noted
above, I added ``bookinbook'' to the org-bibtex-types and added the
appropriate fields there and in org-bibtex-fields.



Here is a minimal init:

(setq org-bibtex-types
  '((:article
     (:description . "An article from a journal or magazine")
     (:required :author :title :journal :year)
     (:optional :volume :number :pages :month :note :annote :url :abstract
:keywords :file :uri))
    (:book
     (:description . "A book with an explicit publisher")
     (:required (:editor :author) :title :publisher :year)
     (:optional (:volume :number) :series (:address :location) :edition
:month :note :annote :url :abstract :keywords :file :uri))
    (:bookinbook
     (:description . "A part of a book, which could be, and once was, its
own book.")
     (:required :title (:chapter :pages) :publisher :year :booktitle)
     (:optional :crossref :author :editor :volume :translator :number
:series :type :address :location :edition :note :annote :url :abstract
:keywords :file :uri))
    (:booklet
     (:description . "A work that is printed and bound, but without a named
publisher or sponsoring institution.")
     (:required :title)
     (:optional :author :howpublished (:address :location) :month :year
:note :annote :url :abstract :keywords :file :uri))
    (:conference
     (:description . "")
     (:required :author :title :booktitle :year)
     (:optional :editor :pages :organization :publisher (:address
:location) :month :note :annote :url :abstract :keywords :file :uri))
    (:inbook
     (:description . "A part of a book, which may be a chapter (or section
or whatever) and/or a range of pages.")
     (:required (:author :editor) :title (:chapter :pages) :publisher :year)
     (:optional :crossref (:volume :number) :series :type (:address
:location) :edition :month :note :annote :url :abstract :keywords :file
:uri))
        (:incollection
     (:description . "A part of a book having its own title.")
     (:required :author :title :booktitle :publisher :year)
     (:optional :crossref :editor (:volume :number) :series :type :chapter
:pages (:address :location) :edition :month :note :annote :url :abstract
:keywords :file :uri))
    (:inproceedings
     (:description . "An article in a conference proceedings")
     (:required :author :title :booktitle :year)
     (:optional :crossref :editor (:volume :number) :series :pages
(:address :location) :month :organization :publisher :note :annote :url
:abstract :keywords :file :uri))
    (:manual
     (:description . "Technical documentation.")
     (:required :title)
     (:optional :author :organization (:address :location) :edition :month
:year :note :annote :url :abstract :keywords :file :uri))
    (:mastersthesis
     (:description . "A Masterâ EURO (tm)s thesis.")
     (:required :author :title :school :year)
     (:optional :type (:address :location) :month :note :annote :url
:abstract :keywords :file :uri))
    (:misc
     (:description . "Use this type when nothing else fits.")
     (:required)
     (:optional :author :crossref :booktitle :date :title :howpublished
:month :year :note :annote :location :url :abstract :keywords :file :uri))
    (:phdthesis
     (:description . "A PhD thesis.")
     (:required :author :title :school :year)
     (:optional :type (:address :location) :month :note :annote :url
:abstract :keywords :file :uri))
    (:proceedings
     (:description . "The proceedings of a conference.")
     (:required :title :year)
     (:optional :editor (:volume :number) :series (:address :location)
:month :organization :publisher :note :annote :url :abstract :keywords
:file :uri))
    (:techreport
     (:description . "A report published by a school or other institution.")
     (:required :author :title :institution :year)
     (:optional :type (:address :location) :month :note :annote :url
:abstract :keywords :file :uri))
    (:unpublished
     (:description . "A document having an author and title, but not
formally published.")
     (:required :author :title :note)
     (:optional :month :year :annote :url :abstract :keywords :file :uri)))
)

(setq org-bibtex-fields
  '((:address      . "Usually the address of the publisher or other type of
institution.  For major publishing houses, van Leunen recommends omitting
the information entirely.  For small publishers, on the other hand, you can
help the reader by giving the complete address.")
    (:annote       . "An annotation.  It is not used by the standard
bibliography styles, but may be used by others that produce an annotated
bibliography.")
    (:author       . "The name(s) of the author(s), in the format described
in the LaTeX book.  Remember, all names are separated with the and keyword,
and not commas.")
    (:booktitle    . "Title of a book, part of which is being cited.  See
the LaTeX book for how to type titles.  For book entries, use the title
field instead.")
    (:chapter      . "A chapter (or section or whatever) number.")
    (:crossref     . "The database key of the entry being cross
referenced.")
    (:edition      . "The edition of a book for example, 'Second'.  This
should be an ordinal, and should have the first letter capitalized, as
shown here; the standard styles convert to lower case when necessary.")
    (:editor       . "Name(s) of editor(s), typed as indicated in the LaTeX
book.  If there is also an author field, then the editor field gives the
editor of the book or collection in which the reference appears.")
    (:howpublished . "How something strange has been published.  The first
word should be capitalized.")
    (:institution  . "The sponsoring institution of a technical report.")
    (:journal      . "A journal name.")
    (:key          . "Used for alphabetizing, cross-referencing, and
creating a label when the author information is missing.  This field should
not be confused with the key that appears in the \cite command and at the
beginning of the database entry.")
    (:month        . "The month in which the work was published or, for an
unpublished work, in which it was written.  You should use the standard
three-letter abbreviation,")
    (:note         . "Any additional information that can help the reader.
 The first word should be capitalized.")
    (:number       . "Any additional information that can help the reader.
 The first word should be capitalized.")
    (:organization . "The organization that sponsors a conference or that
publishes a manual.")
    (:pages        . "One or more page numbers or range of numbers, such as
42-111 or 7,41,73-97 or 43+ (the â EURO ~+â EURO (tm) in this last example indicates
pages following that donâ EURO (tm)t form simple range). BibTEX requires double
dashes for page ranges (--).")
    (:publisher    . "The publisherâ EURO (tm)s name.")
    (:school       . "The name of the school where a thesis was written.")
    (:series       . "The name of a series or set of books.  When citing an
entire book, the the title field gives its title and an optional series
field gives the name of a series or multi-volume set in which the book is
published.")
    (:title        . "The workâ EURO (tm)s title, typed as explained in the LaTeX
book.")
    (:type         . "The type of a technical report for example, 'Research
Note'.")
    (:volume       . "The volume of a journal or multi-volume book.")
    (:year         . "The year of publication or, for an unpublished work,
the year it was written.  Generally it should consist of four numerals,
such as 1984, although the standard styles can handle any year whose last
four nonpunctuation characters are numerals, such as '(about 1984)'")
    (:url          . "A URL for the reference")
    (:uri          . "Another common url field")
    (:annote       . "Annotation is typically not exported")
    (:abstract     . "Abstract for annotated bibliography")
    (:keywords     . "Keywords for sorting with ebib")
    (:file         . "A local file path used by ebib to open the reference
in an appropriate application")
    (:location     . "The location published")

))

(setq org-bibtex-tags-are-keywords t)
(setq org-bibtex-export-arbitrary-fields nil)
(setq org-bibtex-prefix nil)



It may also be useful to note that if I set ``org-bibtex-prefix'' to "bib"
and set ``org-bibtex-export-arbitrary-fields'' to t (and of course edit the
property names in my .org file appropriately), I get an error even with
standard bib types.

Below is the bug report.

Thanks so much for your help,
All the best,
Leonard

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------


Emacs  : GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, NS
apple-appkit-1265.19)
 of 2014-03-15 on macintosh-2.home
Package: Org-mode version 8.2.5h (8.2.5h-82-gd91d4b-elpaplus @
/Users/leonardaveryrandall/.emacs.d/elpa/org-plus-contrib-20140324/)

current state:
==============
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
      org-src-native-tab-command-maybe
      org-babel-hide-result-toggle-maybe
      org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
     org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook org-show-block-all
    append local]
   5]
 #[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook
    org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
  org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-hide-inline-tasks org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-bibtex-tags-are-keywords t
 )

[-- Attachment #2: Type: text/html, Size: 20218 bytes --]

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

* 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/)]
  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
  2014-04-19 14:42   ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Leonard Randall @ 2014-04-19 13:51 UTC (permalink / raw)
  To: emacs-orgmode, Bastien


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

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

* 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/)]
  2014-04-19 13:51 ` Leonard Randall
@ 2014-04-19 14:42   ` Bastien
  2014-04-19 15:45     ` Leonard Randall
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2014-04-19 14:42 UTC (permalink / raw)
  To: Leonard Randall; +Cc: emacs-orgmode

Hi Leonard,

Leonard Randall <leonard.a.randall@gmail.com> writes:

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

I fixed this by ignoring the error, since the field is inserted
anyway.

Thanks for reporting this and the suggested fix!

-- 
 Bastien

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

* 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/)]
  2014-04-19 14:42   ` Bastien
@ 2014-04-19 15:45     ` Leonard Randall
  2014-04-19 18:11       ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Leonard Randall @ 2014-04-19 15:45 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

Hi Bastien,

Bastien <bzg@altern.org> wrote:

> I fixed this by ignoring the error, since the field is inserted
> anyway.

For some reason ignoring errors doesn't work for me. The new function,
doesn't add a keywords field to non-standard bib entry types, it just puts
the tags before the beginning of the bibtex entry, which would mess up the
resulting bibtex file.

The regexp functions I used are based on standard bibtex syntax, so they
should work in all circumstances. I tested my fix under various conditions
and with various variables set and it worked everywhere I tried it.

If you are worried about licensing, you could wait  to apply the patch
until I receive and sign the license, but I think that it is a sufficiently
small change that it should not be an issue.

All best,

Leonard

[-- Attachment #2: Type: text/html, Size: 1184 bytes --]

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

* 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/)]
  2014-04-19 15:45     ` Leonard Randall
@ 2014-04-19 18:11       ` Bastien
       [not found]         ` <CAMRQoAni6bs8DrTRN-_esu7ck49vYa=fwES7TBMLbhcuZ9ad6Q@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2014-04-19 18:11 UTC (permalink / raw)
  To: Leonard Randall; +Cc: emacs-orgmode

Hi Leonard,

Leonard Randall <leonard.a.randall@gmail.com> writes:

> For some reason ignoring errors doesn't work for me. The new
> function, doesn't add a keywords field to non-standard bib entry
> types, it just puts the tags before the beginning of the bibtex
> entry, which would mess up the resulting bibtex file.

Can you provide a minimal example where I reproduce this bug,
along with your Emacs and Org versions?  It works fine here.

> The regexp functions I used are based on standard bibtex syntax, so
> they should work in all circumstances. I tested my fix under various
> conditions and with various variables set and it worked everywhere I
> tried it.

I trust you on that, it's just that using re-search-forward here
does not seem necessary -- also, you could send an email to the
bibtex.el maintainers about the error being cryptic anyway, and
maybe not needed at all.

> If you are worried about licensing, you could wait  to apply the
> patch until I receive and sign the license, but I think that it is a
> sufficiently small change that it should not be an issue.

I'd rather wait till the paperwork is done, it gives us more time
to sort this out properly.

Thanks again,

-- 
 Bastien

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

* 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/)]
       [not found]           ` <87lhv0qzom.fsf@bzg.ath.cx>
@ 2014-04-20 15:18             ` Leonard Randall
  0 siblings, 0 replies; 7+ messages in thread
From: Leonard Randall @ 2014-04-20 15:18 UTC (permalink / raw)
  To: Bastien, emacs-orgmode

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

Thanks!


On 20 April 2014 07:31, Bastien <bzg@altern.org> wrote:

> Hi Leonard,
>
> (you forgot to copy the list I think.)
>
> I finally committed your solution, convinced by your tests.
>
> Now we reached the limit for the changes, let's wait until the
> FSF confirms you can contribute more code.
>
> Thanks again,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 736 bytes --]

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

end of thread, other threads:[~2014-04-20 15:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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