summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-07-09 09:43:30 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-07-09 09:43:30 -0700
commit0f5a2fb0754d3a0429b05060d7e22bc2313a5f2b (patch)
treea6b36c77e9b519ef0caddb29766302c327b96226
parentb44ecb51a49add65abbe7cf6a4846d0e4be99e75 (diff)
downloadorg-mode-0f5a2fb0754d3a0429b05060d7e22bc2313a5f2b.tar.gz
ob-tangle: fixed recently introduced issue with org-babel-load-file
* lisp/ob-tangle.el (org-babel-tangle): applying optional target-file argument through integration into the default header arguments (allowing overwriting through standard header-argument merging), and allowing a default setting of (:tangle . "no") to be overwritten when a target-file is specified.
-rw-r--r--lisp/ob-tangle.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 9bf29bb..7d140db 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -105,6 +105,11 @@ exported source code blocks by language."
(save-buffer)
(save-excursion
(let ((block-counter 0)
+ (org-babel-default-header-args
+ (if target-file
+ (org-babel-merge-params org-babel-default-header-args
+ (list (cons :tangle target-file)))
+ org-babel-default-header-args))
path-collector)
(mapc ;; map over all languages
(lambda (by-lang)
@@ -126,13 +131,12 @@ exported source code blocks by language."
(let* ((tangle (get-spec :tangle))
(she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb))
(get-spec :shebang)))
- (base-name (or (cond
- ((string= "yes" tangle)
- (file-name-sans-extension
- (buffer-file-name)))
- ((string= "no" tangle) nil)
- ((> (length tangle) 0) tangle))
- target-file))
+ (base-name (cond
+ ((string= "yes" tangle)
+ (file-name-sans-extension
+ (buffer-file-name)))
+ ((string= "no" tangle) nil)
+ ((> (length tangle) 0) tangle)))
(file-name (when base-name
;; decide if we want to add ext to base-name
(if (and ext (string= "yes" tangle))