summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-11-04 12:19:45 +0100
committerBastien Guerry <bzg@altern.org>2013-11-04 12:19:45 +0100
commit56d405a41c3ce0d4c181bdc920e7a8a7647330b2 (patch)
tree26fe6a2a985add6637f031036707dd5a2f663f31
parent757f00811d0bdf1e17562eeb4331d872d720f136 (diff)
downloadorg-mode-56d405a41c3ce0d4c181bdc920e7a8a7647330b2.tar.gz
org.el (org-babel-load-file): Set `exported-file' correctly
* org.el (org-babel-load-file): Set `exported-file' correctly, in case the file as been tangled using a buffer-local value. * ob-tangle.el (org-babel-tangle-file): Return the list of tangled files. Thanks to Sam Flint for reporting this.
-rw-r--r--lisp/ob-tangle.el16
-rw-r--r--lisp/org.el3
2 files changed, 11 insertions, 8 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 8141943..9f0e2de 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -144,16 +144,18 @@ evaluating BODY."
Source code blocks are extracted with `org-babel-tangle'.
Optional argument TARGET-FILE can be used to specify a default
export file for all source blocks. Optional argument LANG can be
-used to limit the exported source code blocks by language."
+used to limit the exported source code blocks by language.
+Return a list whose CAR is the tangled file name."
(interactive "fFile to tangle: \nP")
(let ((visited-p (get-file-buffer (expand-file-name file)))
to-be-removed)
- (save-window-excursion
- (find-file file)
- (setq to-be-removed (current-buffer))
- (org-babel-tangle nil target-file lang))
- (unless visited-p
- (kill-buffer to-be-removed))))
+ (prog1
+ (save-window-excursion
+ (find-file file)
+ (setq to-be-removed (current-buffer))
+ (org-babel-tangle nil target-file lang))
+ (unless visited-p
+ (kill-buffer to-be-removed)))))
(defun org-babel-tangle-publish (_ filename pub-dir)
"Tangle FILENAME and place the results in PUB-DIR."
diff --git a/lisp/org.el b/lisp/org.el
index e750ba0..afd7b21 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -198,7 +198,8 @@ file to byte-code before it is loaded."
;; tangle if the org-mode file is newer than the elisp file
(unless (and (file-exists-p exported-file)
(> (funcall age file) (funcall age exported-file)))
- (org-babel-tangle-file file exported-file "emacs-lisp"))
+ (setq exported-file
+ (car (org-babel-tangle-file file exported-file "emacs-lisp"))))
(message "%s %s"
(if compile
(progn (byte-compile-file exported-file 'load)