[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] running a source code by name
From: |
Berry, Charles |
Subject: |
Re: [O] running a source code by name |
Date: |
Mon, 28 May 2018 20:30:58 +0000 |
OK, I have to note that this will also do the job that the OP requested:
#+begin_src emacs-lisp :results silent :var result=myRcode
#+end_src
although it seems a little strange to write an empty src block for its side
effects.
I suppose I should have suggested this in the first place:
#+begin_src emacs-lisp :results silent :noweb yes
<<myRcode()>>
#+end_src
although the return value from the noweb reference could be troublesome
depending on what else is included in the latter src block.
Chuck
> On May 28, 2018, at 1:16 PM, John Kitchin <address@hidden> wrote:
>
> Here is yet another variation, that may be suitable for what you want:
>
>
> #+name: myPyCode
> #+BEGIN_SRC python
> print('Hello')
> #+END_SRC
>
>
> #+BEGIN_SRC emacs-lisp :var results=myPyCode
> results
> #+END_SRC
>
> #+RESULTS:
> : Hello
>
>
> John
>
> -----------------------------------
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
> On Mon, May 28, 2018 at 9:25 AM, Berry, Charles <address@hidden> wrote:
>
>
> > On May 28, 2018, at 7:35 AM, Eric S Fraga <address@hidden> wrote:
> >
> > On Monday, 28 May 2018 at 11:13, Julian M. Burgos wrote:
> >> Dear list,
> >>
> >> I have an org file with an R source code block. I want to have a second
> >> code block with an elisp call to run that first code. Something like this
> >>
> >>
> >> #+begin_src emacs-lisp :results silent :tangle no
> >>
> >> ... Some elisp code to run the "myRcode" block.
> >
> > Something along the lines of:
> >
> > (org-babel-goto-named-src-block "myRcode")
> > (org-babel-execute-src-block)
> >
> > should do the job?
>
> Maybe wrap it in
>
> (save-excursion ... )
>
> or use
>
> (org-sbe "myRcode")
>
> or
>
> (org-babel-ref-resolve "myRcode")
>
> which both can also pass :var args.
>
> HTH,
>
> Chuck
>
>
>
>
>
Re: [O] running a source code by name, Nick Dokos, 2018/05/28