diff options
author | Eric Schulte <eric.schulte@gmx.com> | 2011-11-29 08:56:27 -0700 |
---|---|---|
committer | Eric Schulte <eric.schulte@gmx.com> | 2011-11-29 08:56:55 -0700 |
commit | e902a75a2327084ff067f826871e9f8f6e2fdf92 (patch) | |
tree | 2f66c3af75c603b1c1c205d4100b75c0a0dbc656 | |
parent | 0b51c3d6a9f2a758a7e49a6e9f333ea273f345bc (diff) | |
download | org-mode-e902a75a2327084ff067f826871e9f8f6e2fdf92.tar.gz |
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.
-rw-r--r-- | lisp/org-bibtex.el | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el index c9d62fb..71a3bd0 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. |