emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bill Burdick <bill.burdick@gmail.com>
To: Henrik Frisk <frisk.h@gmail.com>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: Adding #+name to result block in babel
Date: Tue, 29 Nov 2022 06:19:54 +0100	[thread overview]
Message-ID: <CAP6X8DhjDuSktgmirynBSSyPGg+hBWJpjHKTdyRix38tOCH0Ww@mail.gmail.com> (raw)
In-Reply-To: <CAO0LSb5bYQMTfSdkvbVZ-ioJNZwREn+ZU73x9DTGyQ1Mj0PPDQ@mail.gmail.com>

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

Hi Henrik,

On Tue, Nov 29, 2022 at 2:11 AM Henrik Frisk <frisk.h@gmail.com> wrote:

> Hi,
>
> Maybe I'm missing something obvious but is it possible to have a name be
> added to the result block such as running:
>
> #+begin_src shell
>   echo "Hello"
> #+end_src
>
> results in
>
> #+RESULTS:
> #+name: my_result
> : Hello
>
> Thank you!
>

Name your block, like this:
    #+name: my_result
    #+begin_src sh
    echo hello
    #+end_src

When you evaluate it, you'll get this:

    #+name: my_result
    #+begin_src sh
    echo hello
    #+end_src

    #+RESULTS: my_result
    : hello

Then you can use the result like this:

    #+begin_src sh :var value=my_result
    echo $value
    #+end_src

    #+RESULTS:
    : hello


-- Bill

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

  reply	other threads:[~2022-11-29  5:21 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 [this message]
2022-11-29 22:13   ` Henrik Frisk
2022-12-04 12:25     ` Johan Tolö

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=CAP6X8DhjDuSktgmirynBSSyPGg+hBWJpjHKTdyRix38tOCH0Ww@mail.gmail.com \
    --to=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).