From: "Johan Tolö" <johan@toloe.se>
To: Henrik Frisk <frisk.h@gmail.com>
Cc: Bill Burdick <bill.burdick@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Adding #+name to result block in babel
Date: Sun, 04 Dec 2022 13:25:28 +0100 [thread overview]
Message-ID: <871qpfnydu.fsf@toloe.se> (raw)
In-Reply-To: <CAO0LSb6yLNXh7AdQs9nUbHg875cMRWg4RBpw6b-MwRWO_v8V1g@mail.gmail.com>
Henrik Frisk <frisk.h@gmail.com> writes:
[snipped]
>> Then you can use the result like this:
>>
>> #+begin_src sh :var value=my_result
>> echo $value
>> #+end_src
>>
>> #+RESULTS:
>> : hello
>>
This does not use the result but rather reevaluates the
"my_result" code block.
> Thank you! That was good to be reminded of, but I should have
> been more explicit in my first email. I'm working with a
> language (sclang)
> that for various reasons does not have support for variables in
> this way. The only option I have to include the results from one
> block is by
> using a noweb referens:
>
> #+begin_src shell
> echo "Hello"
> #+end_src
>
> #+RESULTS:
> #+name: my_result
> : Hello
>
> #+begin_src sclang :noweb yes
> <<my_result>>
> #+end_src
You could try adapting the examples for using :post at the end of:
https://orgmode.org/manual/Results-of-Evaluation.html
But in my (limited) experience it is difficult to get the output
right.
Another suggestion is to use a templating system for generating
the src block and include the #+name: part in the template. I use
yasnippet for this.
--
Johan Tolö
prev parent reply other threads:[~2022-12-04 12:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 1:10 Adding #+name to result block in babel Henrik Frisk
2022-11-29 5:19 ` Bill Burdick
2022-11-29 22:13 ` Henrik Frisk
2022-12-04 12:25 ` Johan Tolö [this message]
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=871qpfnydu.fsf@toloe.se \
--to=johan@toloe.se \
--cc=bill.burdick@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=frisk.h@gmail.com \
/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).