From 94f10ddfd70ee0b5b87cd094fc434bee15477fc0 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 16 Jan 2012 20:39:12 -0700 Subject: [PATCH] don't always replace <> references when :exports both * lisp/ob-exp.el (org-babel-exp-results): Alter a copy of info. * testing/examples/babel.org (an): Example data for test behavior. * testing/lisp/test-ob-exp.el (ob-exp/noweb-no-export-and-exports-both): Confirm proper behavior. --- lisp/ob-exp.el | 3 ++- testing/examples/babel.org | 19 +++++++++++++++++++ testing/lisp/test-ob-exp.el | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index 230124092..c0d95d7e6 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -251,7 +251,8 @@ inhibit insertion of results into the buffer." (when (and org-export-babel-evaluate (not (and hash (equal hash (org-babel-current-result-hash))))) (let ((lang (nth 0 info)) - (body (nth 1 info))) + (body (nth 1 info)) + (info (copy-sequence info))) ;; skip code blocks which we can't evaluate (when (fboundp (intern (concat "org-babel-execute:" lang))) (org-babel-eval-wipe-error-buffer) diff --git a/testing/examples/babel.org b/testing/examples/babel.org index 6adb22515..4307c517f 100644 --- a/testing/examples/babel.org +++ b/testing/examples/babel.org @@ -288,3 +288,22 @@ exporting a code block with a name #+begin_src sh :foo "baz" echo bar #+end_src +* noweb no-export and exports both + :PROPERTIES: + :ID: 8a820f6c-7980-43db-8a24-0710d33729c9 + :END: +Weird interaction. + +here is one block + +#+name: noweb-no-export-and-exports-both-1 +#+BEGIN_SRC sh :exports none + echo 1 +#+END_SRC + +and another + +#+BEGIN_SRC sh :noweb no-export :exports both + # I am inside the code block + <> +#+END_SRC diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el index 9b233d364..ac5792585 100644 --- a/testing/lisp/test-ob-exp.el +++ b/testing/lisp/test-ob-exp.el @@ -217,6 +217,13 @@ elements in the final html." (should (string-match "baz" ascii)) (should (string-match "replace" ascii)))))) +(ert-deftest ob-exp/noweb-no-export-and-exports-both () + (org-test-at-id "8a820f6c-7980-43db-8a24-0710d33729c9" + (org-narrow-to-subtree) + (let ((html (org-export-as-html nil nil nil 'string 'body-only))) + (should (string-match (regexp-quote "noweb-no-export-and-exports-both-1") + html))))) + (provide 'test-ob-exp) ;;; test-ob-exp.el ends here -- 2.11.4.GIT