forked from mirrors/org-mode
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.
This commit is contained in:
parent
757f00811d
commit
56d405a41c
|
@ -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."
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue