mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 18:00:49 +00:00
more efficient org-babel-with-temp-filebuffer
* lisp/ob-tangle.el (org-babel-with-temp-filebuffer): Don't execute macro argument multiple times.
This commit is contained in:
parent
62bf9cace0
commit
1952afa6ed
|
@ -122,13 +122,15 @@ represented in the file."
|
|||
`progn', then kill the FILE buffer returning the result of
|
||||
evaluating BODY."
|
||||
(declare (indent 1))
|
||||
(let ((temp-result (make-symbol "temp-result"))
|
||||
(let ((temp-path (make-symbol "temp-path"))
|
||||
(temp-result (make-symbol "temp-result"))
|
||||
(temp-file (make-symbol "temp-file"))
|
||||
(visited-p (make-symbol "visited-p")))
|
||||
`(let (,temp-result ,temp-file
|
||||
(,visited-p (get-file-buffer ,file)))
|
||||
(org-babel-find-file-noselect-refresh ,file)
|
||||
(setf ,temp-file (get-file-buffer ,file))
|
||||
`(let* ((,temp-path ,file)
|
||||
(,visited-p (get-file-buffer ,temp-path))
|
||||
,temp-result ,temp-file)
|
||||
(org-babel-find-file-noselect-refresh ,temp-path)
|
||||
(setf ,temp-file (get-file-buffer ,temp-path))
|
||||
(with-current-buffer ,temp-file
|
||||
(setf ,temp-result (progn ,@body)))
|
||||
(unless ,visited-p (kill-buffer ,temp-file))
|
||||
|
|
Loading…
Reference in a new issue