forked from mirrors/org-mode
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.
This commit is contained in:
parent
b44ecb51a4
commit
0f5a2fb075
|
@ -105,6 +105,11 @@ exported source code blocks by language."
|
||||||
(save-buffer)
|
(save-buffer)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((block-counter 0)
|
(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)
|
path-collector)
|
||||||
(mapc ;; map over all languages
|
(mapc ;; map over all languages
|
||||||
(lambda (by-lang)
|
(lambda (by-lang)
|
||||||
|
@ -126,13 +131,12 @@ exported source code blocks by language."
|
||||||
(let* ((tangle (get-spec :tangle))
|
(let* ((tangle (get-spec :tangle))
|
||||||
(she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb))
|
(she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb))
|
||||||
(get-spec :shebang)))
|
(get-spec :shebang)))
|
||||||
(base-name (or (cond
|
(base-name (cond
|
||||||
((string= "yes" tangle)
|
((string= "yes" tangle)
|
||||||
(file-name-sans-extension
|
(file-name-sans-extension
|
||||||
(buffer-file-name)))
|
(buffer-file-name)))
|
||||||
((string= "no" tangle) nil)
|
((string= "no" tangle) nil)
|
||||||
((> (length tangle) 0) tangle))
|
((> (length tangle) 0) tangle)))
|
||||||
target-file))
|
|
||||||
(file-name (when base-name
|
(file-name (when base-name
|
||||||
;; decide if we want to add ext to base-name
|
;; decide if we want to add ext to base-name
|
||||||
(if (and ext (string= "yes" tangle))
|
(if (and ext (string= "yes" tangle))
|
||||||
|
|
Loading…
Reference in New Issue