diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2010-10-04 08:39:10 -0600 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2010-10-04 08:39:10 -0600 |
commit | 093e8cf58e8ceda1d4558f9dc438663939e70c24 (patch) | |
tree | d15547680a8a9c9dd1dea9c277753b44644fb76f | |
parent | 8bac197bb3330a164b9306ffa1a0232115acc23b (diff) | |
download | org-mode-093e8cf58e8ceda1d4558f9dc438663939e70c24.tar.gz |
ob-exp: only jump to export-file if original buffer is visiting a file
Thanks to Puneeth for insisting upon the existence of this error
* lisp/ob-exp.el (org-babel-exp-src-blocks): don't jump back to
export-file if exporting from a buffer which is not visiting a file
-rw-r--r-- | lisp/ob-exp.el | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index c1b2bf5..3b5410d 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -105,27 +105,29 @@ none ----- do not display either code or results upon export" (org-babel-clean-text-properties (mapconcat #'identity (cdr (split-string raw-header)) " ")))) (heading (nth 4 (ignore-errors (org-heading-components)))) - (link (org-make-link-string - (if heading - (concat org-current-export-file "::" heading) - org-current-export-file))) + (link (when org-current-export-file + (org-make-link-string + (if heading + (concat org-current-export-file "::" heading) + org-current-export-file)))) (export-buffer (current-buffer))) ;; bail if we couldn't get any info from the block (when info - ;; resolve parameters in the original file so that headline - ;; and file-wide parameters are included - ;; attempt to go to the same heading in the original file - (set-buffer (get-file-buffer org-current-export-file)) - (save-restriction - (org-open-link-from-string link) - (setf (nth 2 info) - (org-babel-merge-params - org-babel-default-header-args - (org-babel-params-from-buffer) - (org-babel-params-from-properties lang) - (if (boundp lang-headers) (eval lang-headers) nil) - raw-params))) - (set-buffer export-buffer) + (when link + ;; resolve parameters in the original file so that headline + ;; and file-wide parameters are included + ;; attempt to go to the same heading in the original file + (set-buffer (get-file-buffer org-current-export-file)) + (save-restriction + (org-open-link-from-string link) + (setf (nth 2 info) + (org-babel-merge-params + org-babel-default-header-args + (org-babel-params-from-buffer) + (org-babel-params-from-properties lang) + (if (boundp lang-headers) (eval lang-headers) nil) + raw-params))) + (set-buffer export-buffer)) ;; expand noweb references in the original file (setf (nth 1 info) (if (and (cdr (assoc :noweb (nth 2 info))) |