summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-07-16 15:55:40 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-07-16 15:56:17 -0700
commita503e031fb3095b51faef6f39ff1222b4343d16f (patch)
treeb473eb3b05edb5a5f2ff08d6f5a3624aaf02386b
parenta3dfb1c626583e5b68c056cb50805d4d045f6a74 (diff)
downloadorg-mode-a503e031fb3095b51faef6f39ff1222b4343d16f.tar.gz
ob-tangle: fixed bug, org-babel-post-tangle-hook was using an undefined macro
* lisp/ob-tangle.el (org-babel-with-temp-filebuffer): a macro for quickly visiting files with cleanup (org-babel-tangle): now using the locally defined with-temp-filebuffer macro
-rw-r--r--lisp/ob-tangle.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 19b1840..8c71620 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -34,7 +34,6 @@
(declare-function org-link-escape "org" (text &optional table))
(declare-function org-heading-components "org" ())
-(declare-function with-temp-filebuffer "org-interaction" (file &rest body))
(defcustom org-babel-tangle-lang-exts
'(("emacs-lisp" . "el"))
@@ -54,6 +53,20 @@ then the name of the language is used."
:group 'org-babel
:type 'hook)
+(defmacro org-babel-with-temp-filebuffer (file &rest body)
+ "Open FILE into a temporary buffer execute BODY there like
+`progn', then kill the FILE buffer returning the result of
+evaluating BODY."
+ (declare (indent 1))
+ (let ((temp-result (make-symbol "temp-result"))
+ (temp-file (make-symbol "temp-file")))
+ `(let (,temp-result ,temp-file)
+ (find-file ,file)
+ (setf ,temp-file (current-buffer))
+ (setf ,temp-result (progn ,@body))
+ (kill-buffer ,temp-file)
+ ,temp-result)))
+
;;;###autoload
(defun org-babel-load-file (file)
"Load Emacs Lisp source code blocks in the Org-mode FILE.
@@ -176,7 +189,7 @@ exported source code blocks by language."
(when org-babel-post-tangle-hook
(mapc
(lambda (file)
- (with-temp-filebuffer file
+ (org-babel-with-temp-filebuffer file
(run-hooks 'org-babel-post-tangle-hook)))
path-collector))
path-collector)))