From e902a75a2327084ff067f826871e9f8f6e2fdf92 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Tue, 29 Nov 2011 08:56:27 -0700 Subject: [PATCH] improved warnings of bibtex errors during multi-headline export * lisp/org-bibtex.el (org-bibtex): Now catches bibtex errors and directs the user to the location of the error. --- lisp/org-bibtex.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el index c9d62fb22..71a3bd07d 100644 --- a/lisp/org-bibtex.el +++ b/lisp/org-bibtex.el @@ -525,9 +525,20 @@ Headlines are exported using `org-bibtex-export-headline'." "Bibtex file: " nil nil nil (file-name-nondirectory (concat (file-name-sans-extension (buffer-file-name)) ".bib"))))) - (let ((bibtex-entries (remove nil (org-map-entries #'org-bibtex-headline)))) - (with-temp-file filename - (insert (mapconcat #'identity bibtex-entries "\n"))))) + ((lambda (error-point) + (when error-point + (goto-char error-point) + (message "Bibtex error at %S" (nth 4 (org-heading-components))))) + (catch 'bib + (let ((bibtex-entries (remove nil (org-map-entries + (lambda () + (condition-case foo + (org-bibtex-headline) + (error (throw 'bib (point))))))))) + (with-temp-file filename + (insert (mapconcat #'identity bibtex-entries "\n"))) + (message "Successfully exported %d bibtex entries to %s" + (length bibtex-entries) filename) nil)))) (defun org-bibtex-check (&optional optional) "Check the current headline for required fields. -- 2.11.4.GIT