From: Benda Xu <heroxbd@gentoo.org>
To: emacs-orgmode@gnu.org
Subject: Bug: cached code blocks should return the same value [8.3.1]
Date: Fri, 18 Sep 2015 19:17:05 +0900 [thread overview]
Message-ID: <87a8sk3uce.fsf@gentoo.org> (raw)
Hi All,
Passing values across code blocks makes Org babel a powerful meta
programming language:
#+name: input
#+BEGIN_SRC sh :results output
echo "3"
#+END_SRC
#+BEGIN_SRC R :var a=input()
a
#+END_SRC
#+RESULTS:
| 3 |
| |
However, this feature does not work with cache. In case that "input"
code block takes a long time to evaluate, it is a good idea to cache the
result. But that returns "nil" in subsequent function calls:
#+name: input
#+BEGIN_SRC sh :results output :cache yes
echo "3"
#+END_SRC
#+RESULTS[f69ecd305ebd448fc39b05809d214261a777c6bc]: input
: 3
#+BEGIN_SRC R :var a=input()
a
#+END_SRC
#+RESULTS:
: nil
Recalling the cached function should return exactly the same result by
definition of "cache".
Or is there a way to circumvent this by referring to the "RESULT" field
directly?
Cheers,
Benda
Emacs : GNU Emacs 24.4.1 (i586-pc-linux-gnu, GTK+ Version 3.14.5)
of 2015-03-08 on binet, modified by Debian
Package: Org-mode version 8.3.1 (8.3.1-dist @ /usr/share/emacs24/site-lisp/org-mode/)
current state:
==============
(setq
org-export-babel-evaluate nil
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
org-latex-format-headline-function 'org-latex-format-headline-default-function
org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
org-archive-location "~/art/gtd/archive.org::From %s"
org-tab-first-hook '(org-hide-block-toggle-maybe org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
org-archive-hook '(org-attach-archive-delete-maybe)
org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-special-blocks org-vm
org-wl org-w3m)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-confirm-babel-evaluate nil
org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
org-babel-pre-tangle-hook '(save-buffer)
org-occur-hook '(org-first-headline-recenter)
org-html-format-headline-function 'org-html-format-headline-default-function
org-metaup-hook '(org-babel-load-in-session-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}" ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("article" "\\documentclass[11pt]{article}" ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("report" "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
)
org-latex-format-drawer-function '(lambda (name contents) contents)
org-format-latex-options '(:foreground default :background default :scale 1.7 :html-foreground "Black" :html-background "Transparent"
:html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-publish-project-alist '(("example" :base-directory "~/art/example" :publishing-directory "~/art/web/projects" :email nil :footnotes
nil :section-numbers nil :table-of-contents nil :preserve-breaks t :sub-superscript nil :style
"<link rel=\"stylesheet\" href=\"pro.css\" media=\"screen\" type=\"text/css\">")
("MoGURA" :base-directory "~/art/MoGURA" :publishing-directory "~/art/web/projects" :email nil :footnotes nil
:section-numbers nil :headline-levels 3 :table-of-contents nil :preserve-breaks t :sub-superscript nil
:style "<link rel=\"stylesheet\" href=\"pro.css\" media=\"screen\" type=\"text/css\">")
)
org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes org-mode-reftex-setup)
org-latex-pdf-process '("latexmk -f -pdf %f")
org-ascii-format-drawer-function '(lambda (name contents width) contents)
org-footnote-define-inline t
org-html-format-drawer-function '(lambda (name contents) contents)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-agenda-files '("~/art/react/thesis/neutrino.org" "~/art/refBook.org")
org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) ("\\.pdf\\'" . default)
("\\.pdf::\\([0-9]+\\)\\'" . "okular \"%s\" -p %1"))
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
org-footnote-auto-label nil
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el") ("elisp" . "el"))
org-babel-load-languages '((emacs-lisp . t) (R . t) (python . t) (sh . t))
org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
org-confirm-shell-link-function 'yes-or-no-p
)
next reply other threads:[~2015-09-18 10:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 10:17 Benda Xu [this message]
2015-10-30 9:53 ` Bug: cached code blocks should return the same value [8.3.1] Aaron Ecay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a8sk3uce.fsf@gentoo.org \
--to=heroxbd@gentoo.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).