emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: "Berry, Charles" <ccberry@ucsd.edu>
Cc: Eric S Fraga <esflists@gmail.com>,
	"Julian M. Burgos" <julian.burgos@hafogvatn.is>,
	emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: running a source code by name
Date: Mon, 28 May 2018 13:16:35 -0700	[thread overview]
Message-ID: <CAJ51ETpeOigVOuLu8kQ-tSeSPtmYgjrH3TSUWcTUsWTbNdWyHg@mail.gmail.com> (raw)
In-Reply-To: <A350E706-693B-447F-942D-B4D468971F7D@ucsd.edu>

[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]

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 <ccberry@ucsd.edu> wrote:

>
>
> > On May 28, 2018, at 7:35 AM, Eric S Fraga <esflists@gmail.com> 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
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 2467 bytes --]

  reply	other threads:[~2018-05-28 20:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-28 11:13 running a source code by name Julian M. Burgos
2018-05-28 14:35 ` Eric S Fraga
2018-05-28 16:25   ` Berry, Charles
2018-05-28 20:16     ` John Kitchin [this message]
2018-05-28 20:30       ` Berry, Charles
2018-05-30  6:59         ` Julian M. Burgos
2018-05-30 16:16           ` Berry, Charles
2018-05-28 22:58 ` Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ51ETpeOigVOuLu8kQ-tSeSPtmYgjrH3TSUWcTUsWTbNdWyHg@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=esflists@gmail.com \
    --cc=julian.burgos@hafogvatn.is \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).