Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2016-12-10 01:02:06 +01:00
commit 24219e93fb
2 changed files with 20 additions and 19 deletions

View File

@ -442,25 +442,25 @@ non-nil, return the full association list to be used by
(intern (concat "org-babel-variable-assignments:" src-lang))) (intern (concat "org-babel-variable-assignments:" src-lang)))
(body (body
;; Run the tangle-body-hook. ;; Run the tangle-body-hook.
(with-temp-buffer (let ((body (if (org-babel-noweb-p params :tangle)
(insert (org-babel-expand-noweb-references info)
;; Expand body in language specific manner. (nth 1 info))))
(let ((body (if (org-babel-noweb-p params :tangle) (with-temp-buffer
(org-babel-expand-noweb-references info) (insert
(nth 1 info)))) ;; Expand body in language specific manner.
(cond ((assq :no-expand params) body) (cond ((assq :no-expand params) body)
((fboundp expand-cmd) (funcall expand-cmd body params)) ((fboundp expand-cmd) (funcall expand-cmd body params))
(t (t
(org-babel-expand-body:generic (org-babel-expand-body:generic
body params (and (fboundp assignments-cmd) body params (and (fboundp assignments-cmd)
(funcall assignments-cmd params))))))) (funcall assignments-cmd params))))))
(when (string-match "-r" extra) (when (string-match "-r" extra)
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward (while (re-search-forward
(replace-regexp-in-string "%s" ".+" cref-fmt) nil t) (replace-regexp-in-string "%s" ".+" cref-fmt) nil t)
(replace-match ""))) (replace-match "")))
(run-hooks 'org-babel-tangle-body-hook) (run-hooks 'org-babel-tangle-body-hook)
(buffer-string))) (buffer-string))))
(comment (comment
(when (or (string= "both" (cdr (assq :comments params))) (when (or (string= "both" (cdr (assq :comments params)))
(string= "org" (cdr (assq :comments params)))) (string= "org" (cdr (assq :comments params))))

View File

@ -63,11 +63,12 @@
"df|sed '1d'|awk '{print $5 \" \" $6}'|sort -n |tail -1|awk '{print $2}'")) "df|sed '1d'|awk '{print $5 \" \" $6}'|sort -n |tail -1|awk '{print $2}'"))
(org-narrow-to-subtree) (org-narrow-to-subtree)
(org-babel-tangle) (org-babel-tangle)
(with-temp-buffer (should (unwind-protect
(insert-file-contents "babel.sh") (with-temp-buffer
(goto-char (point-min)) (insert-file-contents "babel.sh")
(should (re-search-forward (regexp-quote tangled) nil t))) (goto-char (point-min))
(delete-file "babel.sh")))) (re-search-forward (regexp-quote tangled) nil t))
(when (file-exists-p "babel.sh") (delete-file "babel.sh")))))))
(ert-deftest ob-tangle/expand-headers-as-noweb-references () (ert-deftest ob-tangle/expand-headers-as-noweb-references ()
"Test that references to headers are expanded during noweb expansion." "Test that references to headers are expanded during noweb expansion."