diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 8141943ca..9f0e2de7f 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 e750ba036..afd7b212f 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)