[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] eval source blocks in a subtree when opening file
From: |
Cook, Malcolm |
Subject: |
Re: [O] eval source blocks in a subtree when opening file |
Date: |
Fri, 7 Aug 2015 18:47:08 +0000 |
> > On Tue, 4 Aug 2015, Tamas Papp wrote:
> >
> >> I would like to do the following: whenever I open the file in Emacs,
> >> I would like to eval all the source blocks under the heading Setup.
> >>
> >> I have found org-babel-execute-subtree, but I cannot figure out how
> >> to call it on the subtree "Setup" from a local eval.
> >
> > Name the first block in the subtree "start setup" (say).
> >
> > Then
> >
> > # Local Variables:
> > # eval: (org-babel-goto-named-src-block "start setup") # eval:
> > (org-babel-execute-subtree) # End:
>
> Thanks! I found that I can also assign an ID to the section, and then use
>
> # eval: (progn (org-id-goto ...some-id...) (org-babel-execute-subtree))
>
> It looks like I need the progn for it to work reliably (don't know why).
>
> I am wondering if it would be possible to break a line in Local Variables,
> but
>
> # eval: (progn (org-id-goto ...some-id...) \
> # (org-babel-execute-subtree))
>
> didn't work.
>
[Cook, Malcolm]
Ditch the line continuation character. This works in my hands with emacs
24.4.1 to set foo to bar:
# Local Variables:
# eval: (setq foo
# "bar")
# End:
> Best,
>
> Tamas