From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: BUG org-bibtex error for importing bibtex conference entries Date: Thu, 24 Nov 2011 03:09:10 -0500 Message-ID: <19104.1322122150@alphaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTUMy-0000vS-2q for emacs-orgmode@gnu.org; Thu, 24 Nov 2011 03:09:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTUMt-0003Kn-Bd for emacs-orgmode@gnu.org; Thu, 24 Nov 2011 03:09:20 -0500 Received: from g4t0017.houston.hp.com ([15.201.24.20]:23461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTUMs-0003KS-Ug for emacs-orgmode@gnu.org; Thu, 24 Nov 2011 03:09:15 -0500 In-Reply-To: Message from Torsten Wagner of "Thu, 24 Nov 2011 13:36:06 +0900." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Torsten Wagner Cc: nicholas.dokos@hp.com, Org Mode Mailing List Torsten Wagner wrote: > Hi, > I was going to convert my bibtex file into an org-mode file. > I receive an error message for conference entries. > E.g. > I can read in by org-bibtex-read > > @CONFERENCE{foo11, > author = {foo, A. and faa, B}, > title = {This is the title}, > booktitle = {Proceeding of the 5th Org-mode conference}, > year = {2011}, > month = Jul, > day = {4--5}, > conference_name = {org-mode V}, > keywords = {published}, > location = {Somewhere, org-land}, > presentation = {Oral} > } > I think the problem is in the reading: after org-bibtex-read, *org-bibtex-entries* is still nil. I presume that's why org-bibtex-write fails. > However, org-bibtex-write results in the following output > > * > and a debug error-log [1]: > > By changing the bibtex type to e.g., INPROCEEDINGS the import works correct. > I tried to debug this but I can't see why it works for inproceedings > and not for conference. > ... and after org-bibtex-read in this case, *org-bibtex-entries* is not nil. org-bibtex-read calls bibtex-parse-entry and that one returns nil on the conference entry above: are you sure it's a legal bibtex type? Or maybe bibtex-parse-entry just does not know about it and needs fixing. Nick > As a side note, I noticed that the importer is rather quite about > errors. If I try to import an mal-formated BibTeX entry I often > receive an result for which some keyword-entries are simply missing. > E.g. try > > @INPROCEEDINGS{foo11, > author = {foo, A. and faa, B}, > title = {This is the title}, > booktitle = {Proceeding of the 5th Org-mode conference}, > year = {2011}, > month = Jul, > day = (4--5), > conference_name = {org-mode V}, > keywords = {published}, > location = {Somewhere, org-land}, > presentation = {Oral} > } > note the round instead of curl brackets around day. An import will > skip silently everything behind the month line. > Wouldn't it make more sens to issue a warning whenever the parser has > trouble to read something? I noticed that the beamer.el from > beamer-mode is involved in parsing. Thus, I have no idea whether > org-mode is capable to notice such a problem. You might argue that > BibTeX is specifies the correct syntax very well, but many other tools > export and import to BibTeX too and an error in these programs might > still allow them to import nd export entries with wrong syntax, a > import in org-mode however, could result finally in fatal data loose. > Thus, I vote for an error or warning message whenever there is > something which requires human attentions. > As for now, I have to carefully check, that all entries moved into the > org-mode file, which is a bit tiring and error prone. > > All the best > > Torsten > > > > [1] Debug log: > > Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil) > insert(nil) > (progn (fset (quote togtag) (function* (lambda (tag) (block togtag > (org-toggle-tag tag (quote on)))))) (org-insert-heading) (insert (val > :title)) (org-bibtex-put "TITLE" (val :title)) (org-bibtex-put > org-bibtex-type-property-name (downcase (val :type))) (dolist (pair > entry) (case (car pair) (:title nil) (:type nil) (:key (org-bibtex-put > org-bibtex-key-property (cdr pair))) (:keywords (if > org-bibtex-tags-are-keywords (mapc (lambda (kw) (togtag ...)) > (split-string (cdr pair) ", *")) (org-bibtex-put (car pair) (cdr > pair)))) (otherwise (org-bibtex-put (car pair) (cdr pair))))) (mapc > (function togtag) org-bibtex-tags)) > (unwind-protect (progn (fset (quote togtag) (function* (lambda (tag) > (block togtag (org-toggle-tag tag (quote on)))))) (org-insert-heading) > (insert (val :title)) (org-bibtex-put "TITLE" (val :title)) > (org-bibtex-put org-bibtex-type-property-name (downcase (val :type))) > (dolist (pair entry) (case (car pair) (:title nil) (:type nil) (:key > (org-bibtex-put org-bibtex-key-property (cdr pair))) (:keywords (if > org-bibtex-tags-are-keywords (mapc (lambda ... ...) (split-string ... > ", *")) (org-bibtex-put (car pair) (cdr pair)))) (otherwise > (org-bibtex-put (car pair) (cdr pair))))) (mapc (function togtag) > org-bibtex-tags)) (if --cl-letf-bound-- (fset (quote togtag) > --cl-letf-save--) (fmakunbound (quote togtag)))) > (let* ((--cl-letf-bound-- (fboundp (quote togtag))) > (--cl-letf-save-- (and --cl-letf-bound-- (symbol-function (quote > togtag))))) (unwind-protect (progn (fset (quote togtag) (function* > (lambda (tag) (block togtag (org-toggle-tag tag ...))))) > (org-insert-heading) (insert (val :title)) (org-bibtex-put "TITLE" > (val :title)) (org-bibtex-put org-bibtex-type-property-name (downcase > (val :type))) (dolist (pair entry) (case (car pair) (:title nil) > (:type nil) (:key (org-bibtex-put org-bibtex-key-property (cdr pair))) > (:keywords (if org-bibtex-tags-are-keywords (mapc ... ...) > (org-bibtex-put ... ...))) (otherwise (org-bibtex-put (car pair) (cdr > pair))))) (mapc (function togtag) org-bibtex-tags)) (if > --cl-letf-bound-- (fset (quote togtag) --cl-letf-save--) (fmakunbound > (quote togtag))))) > (letf (((symbol-function (quote togtag)) (function* (lambda (tag) > (block togtag (org-toggle-tag tag (quote on))))))) > (org-insert-heading) (insert (val :title)) (org-bibtex-put "TITLE" > (val :title)) (org-bibtex-put org-bibtex-type-property-name (downcase > (val :type))) (dolist (pair entry) (case (car pair) (:title nil) > (:type nil) (:key (org-bibtex-put org-bibtex-key-property (cdr pair))) > (:keywords (if org-bibtex-tags-are-keywords (mapc (lambda (kw) (togtag > ...)) (split-string (cdr pair) ", *")) (org-bibtex-put (car pair) (cdr > pair)))) (otherwise (org-bibtex-put (car pair) (cdr pair))))) (mapc > (function togtag) org-bibtex-tags)) > (progn (fset (quote val) (function* (lambda (field) (block val (cdr > (assoc field entry)))))) (letf (((symbol-function (quote togtag)) > (function* (lambda (tag) (block togtag (org-toggle-tag tag ...)))))) > (org-insert-heading) (insert (val :title)) (org-bibtex-put "TITLE" > (val :title)) (org-bibtex-put org-bibtex-type-property-name (downcase > (val :type))) (dolist (pair entry) (case (car pair) (:title nil) > (:type nil) (:key (org-bibtex-put org-bibtex-key-property (cdr pair))) > (:keywords (if org-bibtex-tags-are-keywords (mapc (lambda ... ...) > (split-string ... ", *")) (org-bibtex-put (car pair) (cdr pair)))) > (otherwise (org-bibtex-put (car pair) (cdr pair))))) (mapc (function > togtag) org-bibtex-tags))) > (unwind-protect (progn (fset (quote val) (function* (lambda (field) > (block val (cdr (assoc field entry)))))) (letf (((symbol-function > (quote togtag)) (function* (lambda (tag) (block togtag ...))))) > (org-insert-heading) (insert (val :title)) (org-bibtex-put "TITLE" > (val :title)) (org-bibtex-put org-bibtex-type-property-name (downcase > (val :type))) (dolist (pair entry) (case (car pair) (:title nil) > (:type nil) (:key (org-bibtex-put org-bibtex-key-property (cdr pair))) > (:keywords (if org-bibtex-tags-are-keywords (mapc ... ...) > (org-bibtex-put ... ...))) (otherwise (org-bibtex-put (car pair) (cdr > pair))))) (mapc (function togtag) org-bibtex-tags))) (if > --cl-letf-bound-- (fset (quote val) --cl-letf-save--) (fmakunbound > (quote val)))) > (let* ((--cl-letf-bound-- (fboundp (quote val))) (--cl-letf-save-- > (and --cl-letf-bound-- (symbol-function (quote val))))) > (unwind-protect (progn (fset (quote val) (function* (lambda (field) > (block val (cdr ...))))) (letf (((symbol-function (quote togtag)) > (function* (lambda ... ...)))) (org-insert-heading) (insert (val > :title)) (org-bibtex-put "TITLE" (val :title)) (org-bibtex-put > org-bibtex-type-property-name (downcase (val :type))) (dolist (pair > entry) (case (car pair) (:title nil) (:type nil) (:key (org-bibtex-put > org-bibtex-key-property ...)) (:keywords (if > org-bibtex-tags-are-keywords ... ...)) (otherwise (org-bibtex-put ... > ...)))) (mapc (function togtag) org-bibtex-tags))) (if > --cl-letf-bound-- (fset (quote val) --cl-letf-save--) (fmakunbound > (quote val))))) > (letf (((symbol-function (quote val)) (function* (lambda (field) > (block val (cdr (assoc field entry))))))) (letf (((symbol-function > (quote togtag)) (function* (lambda (tag) (block togtag (org-toggle-tag > tag ...)))))) (org-insert-heading) (insert (val :title)) > (org-bibtex-put "TITLE" (val :title)) (org-bibtex-put > org-bibtex-type-property-name (downcase (val :type))) (dolist (pair > entry) (case (car pair) (:title nil) (:type nil) (:key (org-bibtex-put > org-bibtex-key-property (cdr pair))) (:keywords (if > org-bibtex-tags-are-keywords (mapc (lambda ... ...) (split-string ... > ", *")) (org-bibtex-put (car pair) (cdr pair)))) (otherwise > (org-bibtex-put (car pair) (cdr pair))))) (mapc (function togtag) > org-bibtex-tags))) > (letf* (((symbol-function (quote val)) (function* (lambda (field) > (block val (cdr (assoc field entry)))))) ((symbol-function (quote > togtag)) (function* (lambda (tag) (block togtag (org-toggle-tag tag > (quote on))))))) (org-insert-heading) (insert (val :title)) > (org-bibtex-put "TITLE" (val :title)) (org-bibtex-put > org-bibtex-type-property-name (downcase (val :type))) (dolist (pair > entry) (case (car pair) (:title nil) (:type nil) (:key (org-bibtex-put > org-bibtex-key-property (cdr pair))) (:keywords (if > org-bibtex-tags-are-keywords (mapc (lambda (kw) (togtag ...)) > (split-string (cdr pair) ", *")) (org-bibtex-put (car pair) (cdr > pair)))) (otherwise (org-bibtex-put (car pair) (cdr pair))))) (mapc > (function togtag) org-bibtex-tags)) > (flet ((val (field) (cdr (assoc field entry))) (togtag (tag) > (org-toggle-tag tag (quote on)))) (org-insert-heading) (insert (val > :title)) (org-bibtex-put "TITLE" (val :title)) (org-bibtex-put > org-bibtex-type-property-name (downcase (val :type))) (dolist (pair > entry) (case (car pair) (:title nil) (:type nil) (:key (org-bibtex-put > org-bibtex-key-property (cdr pair))) (:keywords (if > org-bibtex-tags-are-keywords (mapc (lambda (kw) (togtag ...)) > (split-string (cdr pair) ", *")) (org-bibtex-put (car pair) (cdr > pair)))) (otherwise (org-bibtex-put (car pair) (cdr pair))))) (mapc > (function togtag) org-bibtex-tags)) > (let ((entry (pop *org-bibtex-entries*)) (org-special-properties > nil)) (flet ((val (field) (cdr (assoc field entry))) (togtag (tag) > (org-toggle-tag tag (quote on)))) (org-insert-heading) (insert (val > :title)) (org-bibtex-put "TITLE" (val :title)) (org-bibtex-put > org-bibtex-type-property-name (downcase (val :type))) (dolist (pair > entry) (case (car pair) (:title nil) (:type nil) (:key (org-bibtex-put > org-bibtex-key-property (cdr pair))) (:keywords (if > org-bibtex-tags-are-keywords (mapc (lambda ... ...) (split-string ... > ", *")) (org-bibtex-put (car pair) (cdr pair)))) (otherwise > (org-bibtex-put (car pair) (cdr pair))))) (mapc (function togtag) > org-bibtex-tags))) > org-bibtex-write() > call-interactively(org-bibtex-write t nil) > execute-extended-command(nil) > call-interactively(execute-extended-command nil nil) >