1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-27 10:55:04 +00:00

org-export: Fix Babel unresolved references error

* contrib/lisp/org-export.el (org-export-execute-babel-code): New
  function.
(org-export-as): Use new function.
This commit is contained in:
Nicolas Goaziou 2012-11-25 00:24:25 +01:00
parent 2f4c85e6b4
commit b7053b5f9c

View File

@ -2595,13 +2595,7 @@ Return code as a string."
;; have added some new ones.
(org-macro-initialize-templates)
(org-macro-replace-all org-macro-templates)
;; TODO: Setting `org-current-export-file' is required by
;; Org Babel to properly resolve noweb references. Once
;; "org-exp.el" is removed, modify
;; `org-export-blocks-preprocess' so it accepts the value
;; as an argument instead.
(let ((org-current-export-file (current-buffer)))
(org-export-blocks-preprocess)))
(org-export-execute-babel-code))
;; Update radio targets since keyword inclusion might have
;; added some more.
(org-update-radio-target-regexp)
@ -2929,6 +2923,18 @@ file should have."
(insert (make-string offset ?*)))))))))))
(org-element-normalize-string (buffer-string))))
(defun org-export-execute-babel-code ()
"Execute every Babel code in the visible part of current buffer.
This function will return an error if the current buffer is
visiting a file."
;; Get a pristine copy of current buffer so Babel references can be
;; properly resolved.
(let* (clone-buffer-hook (reference (clone-buffer)))
(unwind-protect (let ((org-current-export-file reference))
(org-export-blocks-preprocess))
(kill-buffer reference))))
;;; Tools For Back-Ends
;;