summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-12-23 14:03:47 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-12-23 14:03:47 +0100
commit774e553f115ecd67ee9fa5d31036aa3b664b369d (patch)
tree78c59a9e4e616e4568c630b933457e2a701d1bda
parent7e77560ebb53d33db05e3e677db3737f4c000f44 (diff)
parentd9125e435f09128bf9593fa598c3fc8a9c48c8d0 (diff)
downloadorg-mode-774e553f115ecd67ee9fa5d31036aa3b664b369d.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/ob-core.el4
-rw-r--r--testing/lisp/test-ob.el38
2 files changed, 40 insertions, 2 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index bc3c255..d1ff500 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2790,7 +2790,9 @@ block but are passed literally to the \"example-block\"."
(lambda (i)
;; Expand body of code blocked
;; represented by block info I.
- (let ((b (org-babel-expand-noweb-references i)))
+ (let ((b (if (org-babel-noweb-p (nth 2 i) :eval)
+ (org-babel-expand-noweb-references i)
+ (nth 1 i))))
(if (not comment) b
(let ((cs (org-babel-tangle-comment-links i)))
(concat (funcall c-wrap (car cs)) "\n"
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index af0a71a..bc065d3 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -721,7 +721,43 @@ x
#+begin_src sh :noweb-sep \"\"
(+ 1 1)
#+end_src"
- (org-babel-expand-noweb-references)))))
+ (org-babel-expand-noweb-references))))
+ ;; Handle recursive expansion.
+ (should
+ (equal "baz"
+ (org-test-with-temp-text "
+#+begin_src emacs-lisp :noweb yes<point>
+ <<foo>>
+#+end_src
+
+#+name: foo
+#+begin_src emacs-lisp :noweb yes
+ <<bar>>
+#+end_src
+
+#+name: bar
+#+begin_src emacs-lisp
+ baz
+#+end_src"
+ (org-babel-expand-noweb-references))))
+ ;; During recursive expansion, obey to `:noweb' property.
+ (should
+ (equal "<<bar>>"
+ (org-test-with-temp-text "
+#+begin_src emacs-lisp :noweb yes<point>
+ <<foo>>
+#+end_src
+
+#+name: foo
+#+begin_src emacs-lisp :noweb no
+ <<bar>>
+#+end_src
+
+#+name: bar
+#+begin_src emacs-lisp
+ baz
+#+end_src"
+ (org-babel-expand-noweb-references)))))
(ert-deftest test-ob/splitting-variable-lists-in-references ()
(org-test-with-temp-text ""