Hi Andreas, 2015ko urriak 28an, Andreas Leha-ek idatzi zuen: > > Hi all, > > Andreas Leha writes: >> Hi all, >> >> babel's :cache seems to be ignored during export. At least on #+call >> lines. >> >> In the example below the caching works fine for interactive evaluation, >> i.e. C-c C-c on the #+call line returns immediately. >> >> If I export the subtree with the #+call line, however, the code block >> gets executed and the export is slow. Export works by making a copy of the org buffer, modifying it in some ways while executing babel code, then exporting the modified buffer copy. The modifications can under some circumstances change the relevant features for the cache, leading to spurious re-evaluation. I tried to write a patch that would do the buffer modifications in such a way that they would not affect the cache. But I was never happy with the patch, and also could not find a nice simple test case for the re-evaluation bug. So this work never went anywhere. (It was also 2 years ago, so things could have changed quite a bit.) The simple patch attached to this message fixes a bug that my testing indicated was responsible for erroneous re-evaluations at least some of the time. I personally regard the babel cache as dangerous and unpredictable in its present form. You’re much better off using language-specific caching/memoization features and/or a disciplined regime of manual reevaluation. >> >> I'd expect no evaluation even during export. >> >> Is this a bug or am I missing something? >> >> Regards, >> Andreas >> >> PS: The example: >> >> * Test Cached Export >> ** A long running code block. >> #+name: foo >> #+begin_src emacs-lisp :var bar="baz" >> (sit-for 15) >> (message "bar=%S" bar) >> #+end_src >> >> #+RESULTS: foo >> : bar="baz" >> >> ** Calling >> >> Exporting this subtree will demonstrate my problem. I expect the call >> line below to not execute anything. This works for interactive >> execution (C-c C-c). But if I export this subtree only, the code is >> executed. >> >> This returns immediately thanks to the cached result. >> #+call: foo("qux") :cache yes >> >> #+results[f2b650eb5296f72a1f7237c2a65b7fb3443acf5f]: >> : bar="qux" > > > I should have added that adding :eval no-export to the #+call line does > not help either. There are two places you could add the :eval option. See (info "(org) Evaluating code blocks") . You may have to experiment with putting it in one or both places in order to get the desired result. (If none of the possible combinations works, then it is a bug IMO.)