Browse Source

Babel: Stop tangling failing in an indirect buffer

* ob-tangle.el (org-babel-tangle): Make it work in an indirect buffer.

The problem was that the message generated after tangling included the
file name of the current buffer which was nil in an indirect buffer.

TINYCHANGE
Shaun Johnson 14 years ago
parent
commit
de63411264
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lisp/ob-tangle.el

+ 2 - 1
lisp/ob-tangle.el

@@ -243,7 +243,8 @@ exported source code blocks by language."
        (org-babel-tangle-collect-blocks lang))
        (org-babel-tangle-collect-blocks lang))
       (message "tangled %d code block%s from %s" block-counter
       (message "tangled %d code block%s from %s" block-counter
                (if (= block-counter 1) "" "s")
                (if (= block-counter 1) "" "s")
-	       (file-name-nondirectory (buffer-file-name (current-buffer))))
+	       (file-name-nondirectory
+		(buffer-file-name (or (buffer-base-buffer) (current-buffer)))))
       ;; run `org-babel-post-tangle-hook' in all tangled files
       ;; run `org-babel-post-tangle-hook' in all tangled files
       (when org-babel-post-tangle-hook
       (when org-babel-post-tangle-hook
 	(mapc
 	(mapc