all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Matt <matt@excalamus.com>
Cc: Ilya Konovalov <aragaer@gmail.com>,
	emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [BUG] ":sep" header argument doesn't work in ob-shell [9.6.21 ( @ /home/aragaer/.config/emacs/elpa/org-9.6.21/)]
Date: Tue, 12 Mar 2024 14:25:49 +0000	[thread overview]
Message-ID: <87a5n3cys2.fsf@localhost> (raw)
In-Reply-To: <18e322f5c04.c5668358256842.4107681299308039596@excalamus.com>

Matt <matt@excalamus.com> writes:

> ...  According to my notes, :sep and :separator don't work for
> anything beyond basic table layout. I'm not familiar with org-table
> and there isn't much documentation on those keywords in the manual.
> The :sep keyword shows up for Texinfo and LaTeX. It looks like :sep is
> used for export? It's not clear to me how they're supposed to work
> with shell block output, or if that was even a consideration at all.
>
> They were added in
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a60a83fbb65a368bb96ea6aaf1db20706b3e99c5
> claiming "better handling of table in shell scripts" So, it looks like
> their inclusion was intentional.
>
> Maybe someone has deeper insights?

:sep header argument is used to format table result when writing to file:

     By default, Org assumes that a table written to a file has
     TAB-delimited output.  You can choose a different separator with
     the ‘sep’ header argument.

"16.6 Results of Evaluation" section of the manual.
It is only relevant when you have :results file and the evaluation
results are redirected to file instead of Org buffer.

:sep header argument is universal to all babel backends.

:separator argument is used in ob-sqlite and ob-shell.
However, it means different things in ob-sqlite vs. ob-shell.

In ob-sqlite, :separator argument is defining how sqlite formats its
output. AFAIU, it is only needed when sql table data contains "|" - the
default separator.

In ob-shell, :separator argument is _not_ used to format the output.
Instead, it is used to control how ob-shell passes Elisp data shell variables.
However, it is almost never used in practice (also, it is not
documented) - :separator argument only affects how deeply nested Elisp
lists are converted to bash data:

#+begin_src bash :var x='((((1 1)) 3) (4 5)) :results output :cache no :separator "+"
echo keys: ${!x[@]}
echo values: ${x[@]}
#+end_src

#+RESULTS[7de8e7c561edda2dce18a302f4d8beb8a51595df]:
: keys: 4 1+1
: values: 5 3

Normal two-dimentional tables and lists are handled without being
affected by :separator.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  parent reply	other threads:[~2024-03-12 14:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 20:15 [BUG] ":sep" header argument doesn't work in ob-shell [9.6.21 ( @ /home/aragaer/.config/emacs/elpa/org-9.6.21/)] Ilya Konovalov
2024-03-12  9:27 ` Ilya Konovalov
2024-03-12 10:22   ` Matt
2024-03-12 10:41     ` Ilya Konovalov
2024-03-12 14:25     ` Ihor Radchenko [this message]
2024-03-12 14:38 ` Ihor Radchenko

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

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

  git send-email \
    --in-reply-to=87a5n3cys2.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=aragaer@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=matt@excalamus.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.