DONE Why are referenced source blocks evaluated twice?

  • State "DONE" from "PROPOSED" 2010-03-27 Sat 17:00
  • State "PROPOSED" from "" 2010-03-20 Sat 12:48

Fixed at 47571965d4b4977d72781f8a80ac29c6a609e731

Example

return 'from python'
x

With this debugging patch

diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el
index d01e6d6..40331a0 100644
--- a/contrib/babel/lisp/org-babel.el
+++ b/contrib/babel/lisp/org-babel.el
@@ -198,6 +198,7 @@ block."
   (interactive)
   ;; (message "supplied params=%S" params) ;; debugging
   (let* ((info (or info (org-babel-get-src-block-info)))
+        (remove-me (message (concat "\n" (pp info) "\n")))
          (lang (first info))
         (params (setf (third info)
                        (sort (org-babel-merge-params (third info) params)

We get this output

("emacs-lisp" "x\n"
 ((:comments . "")
  (:shebang . "")
  (:cache . "no")
  (:noweb . "no")
  (:tangle . "")
  (:exports . "code")
  (:results . "replace")
  (:var . "x=python-block")
  (:session . "none"))
 "")


("emacs-lisp" "x\n"
 ((:comments . "")
  (:shebang . "")
  (:cache . "no")
  (:noweb . "no")
  (:tangle . "")
  (:exports . "code")
  (:results . "replace")
  (:var . "x=python-block")
  (:session . "none"))
 "")
 [2 times]
executing emacs-lisp code block...
("python" "return 'from python'\n"
 ((:comments . "")
  (:shebang . "")
  (:cache . "no")
  (:noweb . "no")
  (:tangle . "")
  (:exports . "code")
  (:results . "replace")
  (:session . "none"))
 "" "python-block")


("python" "return 'from python'\n"
 ((:comments . "")
  (:shebang . "")
  (:cache . "no")
  (:noweb . "no")
  (:tangle . "")
  (:exports . "code")
  (:results . "replace")
  (:session . "none"))
 "" "python-block")
 [2 times]
executing Python source code block
"from python"
("python" "return 'from python'\n"
 ((:comments . "")
  (:shebang . "")
  (:cache . "no")
  (:noweb . "no")
  (:tangle . "")
  (:exports . "code")
  (:results . "replace")
  (:session . "none"))
 "" "python-block")


("python" "return 'from python'\n"
 ((:comments . "")
  (:shebang . "")
  (:cache . "no")
  (:noweb . "no")
  (:tangle . "")
  (:exports . "code")
  (:results . "replace")
  (:session . "none"))
 "" "python-block")
 [2 times]
executing Python source code block
"from python"
finished