From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Berry, Charles" Subject: Re: running a source code by name Date: Mon, 28 May 2018 20:30:58 +0000 Message-ID: <790089EC-9901-4115-9F0C-7B9F0A913B0A@ucsd.edu> References: <87h8mrq25l.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNOnZ-0006Sh-CR for emacs-orgmode@gnu.org; Mon, 28 May 2018 16:31:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNOnT-0008Ow-K8 for emacs-orgmode@gnu.org; Mon, 28 May 2018 16:31:21 -0400 Received: from iport-acv6-out.ucsd.edu ([132.239.0.13]:14620) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNOnT-0008OM-3X for emacs-orgmode@gnu.org; Mon, 28 May 2018 16:31:15 -0400 In-Reply-To: Content-Language: en-US Content-ID: <995A9784F778FC42B0D20D2055D2F975@AD.UCSD.EDU> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: Eric S Fraga , "Julian M. Burgos" , emacs-orgmode OK, I have to note that this will also do the job that the OP requested: #+begin_src emacs-lisp :results silent :var result=3DmyRcode #+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 <> #+end_src although the return value from the noweb reference could be troublesome dep= ending on what else is included in the latter src block. Chuck > On May 28, 2018, at 1:16 PM, John Kitchin wrote= : >=20 > Here is yet another variation, that may be suitable for what you want: >=20 >=20 > #+name: myPyCode > #+BEGIN_SRC python > print('Hello') > #+END_SRC >=20 >=20 > #+BEGIN_SRC emacs-lisp :var results=3DmyPyCode > results > #+END_SRC >=20 > #+RESULTS: > : Hello >=20 >=20 > John >=20 > ----------------------------------- > Professor John Kitchin=20 > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu >=20 >=20 > On Mon, May 28, 2018 at 9:25 AM, Berry, Charles wrote: >=20 >=20 > > On May 28, 2018, at 7:35 AM, Eric S Fraga wrote: > >=20 > > On Monday, 28 May 2018 at 11:13, Julian M. Burgos wrote: > >> Dear list, > >>=20 > >> I have an org file with an R source code block. I want to have a seco= nd > >> code block with an elisp call to run that first code. Something like = this > >>=20 > >>=20 > >> #+begin_src emacs-lisp :results silent :tangle no > >>=20 > >> ... Some elisp code to run the "myRcode" block. > >=20 > > Something along the lines of: > >=20 > > (org-babel-goto-named-src-block "myRcode") > > (org-babel-execute-src-block) > >=20 > > should do the job? >=20 > Maybe wrap it in=20 >=20 > (save-excursion ... )=20 >=20 > or use=20 >=20 > (org-sbe "myRcode") >=20 > or >=20 > (org-babel-ref-resolve "myRcode")=20 >=20 > which both can also pass :var args. >=20 > HTH, >=20 > Chuck >=20 >=20 >=20 >=20 >=20