[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] "user-error: No language for src block: (unnamed)" when running

From: Aaron Ecay
Subject: Re: [O] "user-error: No language for src block: (unnamed)" when running `org-icalendar-combine-agenda-files`
Date: Fri, 21 Aug 2015 16:13:13 -0400
User-agent: Notmuch/0.20.2+48~ged9ceda (http://notmuchmail.org) Emacs/ (x86_64-unknown-linux-gnu)

Hi Ista,

2015ko abuztuak 21an, Ista Zahn-ek idatzi zuen:
> On Fri, Aug 21, 2015 at 11:04 AM, Nicolas Goaziou
> <address@hidden> wrote:
>> Ista Zahn <address@hidden> writes:
>>> I agree that it is safer. In my case its safer like a 10 MPH speed
>>> limit. Safe yes, but too slow!
>> Doesn't Babel :cache property help here?
> It does actually, to my surprise. I have not been using :cache because
> the documentation says
> "Note that the :cache header argument will not attempt to cache
> results when the :session header argument is used"
> and since I almost always use :session I didn't expect this to work.
> To my surprise it does (at least with R source blocks, I haven't
> tested yet with others). Can I now rely on this to work even with
> :session?

I think it depends on what you mean by “work.”  Specifically, :cache
doesn’t understand dependencies across source blocks when run in a
session.  So in the following document, if you edit the definition of
myvar, the subsequent usage will retain the old value on subsequent


#+begin_src R :session *foo* :cache yes
myvar <- 1

: 1

#+begin_src R :session *foo* :cache yes

: 1


There are also subtle issues related to the fact that in order to export
a document, org:
1) makes a copy of the buffer
2) executes the babel blocks in this copy, destructively modifying the
   buffer as it goes
3) exports the result

In my experience, sometimes the header arguments, and thus the hash
that the cache depends on, can change.  So in addition to the cache not
re-evaluating when it should as above, it might needlessly re-evaluate
a computationally expensive block in the middle of export.

I tried to fix this about 2 years ago by getting the relevant code to
not do any buffer modifications as it goes but rather first evaluate
all the blocks then do all the needed modifications.  However, the
resultant patch was too big, and I ran out of time to work on it.
Since I made that attempt, a second, unmodified copy of the buffer has
been introduced to the process to help with some (nominally different
but related) aspects of babel processing.  This might have solved the
problem, but I’m not sure.

When the cache has not worked as I expected it to in the past, it’s been
in the middle of actually trying to do something with org, usually under
deadline pressure.  Thus, I’ve adopted the conservative approach of
evaluating blocks manually in all circumstances, and not trying to get
caching to work.  So, you might find that these problems have all gone
away as a consequence of other changes.

For purely R-based work, Charles Berry’s ox-ravel package
is a very interesting approach, since it relies on the cache feature of
knitr, which is capable of automatically detecting cross-block
dependencies like the example above under some circumstances
<http://yihui.name/knitr/demo/cache/>.  It would be interesting to see
if that approach could be used to override :cache handling for ob-R,
while falling back on org-babel’s less intelligent features for other
languages (or in R environments that don’t have knitr available).  But
that’s a(nother) big project.  (I’ve also never used ox-ravel in a
serious project, so my impressions are just based on reading the code
and documentation – which is a really excellent example of literate
elisp programming).

TLDR: If the standard of reliance is working as well as other cache-capable
literate programming libraries for R like knitr, in my (possibly out of
date) experience :cache + :session is not up to scratch.

Aaron Ecay

reply via email to

[Prev in Thread] Current Thread [Next in Thread]