emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alain.Cochard@unistra.fr
To: Ihor Radchenko <yantar92@posteo.net>
Cc: alain.cochard@unistra.fr, Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: 2 'echo' bash instructions produce a table
Date: Sun, 13 Nov 2022 21:41:16 +0100	[thread overview]
Message-ID: <25457.22124.839301.412560@gargle.gargle.HOWL> (raw)
In-Reply-To: <87tu3ba40w.fsf@localhost>

Ihor Radchenko writes on Mon  7 Nov 2022 02:31:

 > If you want to force string output, use :results output.
 > 
 > By default, ob-shell tries to guess the output type.  In the case
 > of two commands returning output, the guess is yielding the
 > table. In the case of a single command, the guess is yielding a
 > single string output.

Thanks a lot.

I find it strange, though, that the default is not as what one gets
from running the code from a terminal.  I imagine there are good
reasons for that, but I think this should be made clear (or at least
clearer) in the manual.  I browsed through section 16 of the manual,
with particular attention to 16.5 (Evaluating Code Blocks) and 16.6
(Results of Evaluation), but still cannot see where this is said or
hinted; if it is there, I missed it or do not know enough to
understand it.

For the sake of newcomers, it seems to me that something along the
line of what you write above would fit somewhere in 16.6, with a first
short mention/warning (and reference to it) next to that excerpt in
16.5:

   Org captures the results of the code block evaluation and inserts
   them in the Org file, right after the code block.

Regards.

PS1

In section 16.3 of the manual (Using Header Arguments):

   System-wide values of header arguments can be specified by
   customizing the ‘org-babel-default-header-args’ variable, which
   defaults to the following values:

	:session    => "none"
	:results    => "replace"
	:exports    => "code"
	:cache      => "no"
	:noweb      => "no"


but the docstring of 'org-babel-default-header-args' says:

   org-babel-default-header-args is a variable defined in ‘ob-core.el’.
   Its value is
   ((:session . "none")
    (:results . "replace")
    (:exports . "code")
    (:cache . "no")
    (:noweb . "no")
    (:hlines . "no")
    (:tangle . "no"))

so I was wondering if there should be

   :hlines      => "no"
   :tangle      => "no"

added above.

PS2

In section 16.6 (Results of Evaluation)
   
   [The ‘results’ header argument] accepts four classes of options
   [Collection, Type, Format, Handling]

   Each code block can take only one option per class:

Now, the paragraphs related to Collection, Type, & Format all contain
the statement

   "Choose one of the options; they are mutually exclusive".

I thought this statement was saying the same thing as the "only one
option per class" above, but then why not also repeat the statement in
the Handling paragraph?

PS3

In section 16.4 (Environment of a Code Block)

    A simple named list.

	 #+NAME: example-list
	 - simple
	   - not
	   - nested
	 - list

	 #+BEGIN_SRC emacs-lisp :var x=example-list
	   (print x)
	 #+END_SRC

	 #+RESULTS:
	 | simple | list |

But if I evaluate the code, I get

	 #+RESULTS:
	 | simple | (unordered (not) (nested)) |
	 | list   |                            |

PS4

In 16.5 (Evaluating Code Blocks), in this code

   #+NAME: random
   #+BEGIN_SRC R :cache yes
     runif(1)
   #+END_SRC

the (1) seems to be understood as a footnote in Info, at least for me.
E.g., <RET> on it goes to the footnote

   (1) The option ‘org-babel-no-eval-on-ctrl-c-ctrl-c’ [...]

and <RET> on this (1) goes back to the above code instead of to the
actual call

   "Org provides many ways to execute code blocks.  ‘C-c C-c’ or ‘C-c
   C-v e’ with the point on a code block(1)"

     
-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]



  reply	other threads:[~2022-11-13 20:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06  6:58 2 'echo' bash instructions produce a table Alain.Cochard
2022-11-07  2:31 ` Ihor Radchenko
2022-11-13 20:41   ` Alain.Cochard [this message]
2022-11-14  3:59     ` Ihor Radchenko
2022-11-15  6:00       ` [RFC] :var x=list-name should be resolved into simple lists (item1 item2 ...); not nested ((item1) (item2) ...) (was: 2 'echo' bash instructions produce a table) Ihor Radchenko
2022-11-26  1:54         ` Ihor Radchenko
2022-11-16  1:24       ` 2 'echo' bash instructions produce a table Ihor Radchenko
2022-11-21  9:04         ` Ihor Radchenko
2022-11-21  9:05         ` Ihor Radchenko
2022-11-16 16:35       ` Alain.Cochard
2022-11-19 12:28         ` Rudolf Adamkovič
2022-11-20  5:05           ` Ihor Radchenko
2022-11-22  8:16         ` Ihor Radchenko
2022-11-22 19:13           ` Alain.Cochard
2022-11-24  1:55             ` Ihor Radchenko
2022-11-22  8:31         ` [RFC] Backend vs. back-end (was: 2 'echo' bash instructions produce a table) Ihor Radchenko
2023-02-20 10:07           ` Ihor Radchenko
2023-02-20 14:54             ` Alain.Cochard
2023-04-06  9:57               ` Ihor Radchenko
2023-04-20 12:17                 ` Ihor Radchenko
2023-04-06 23:43           ` Samuel Wales
2022-11-22  8:37         ` [BUG] Make source block auto-completion work for all the loaded babel backends " 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

  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=25457.22124.839301.412560@gargle.gargle.HOWL \
    --to=alain.cochard@unistra.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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).