emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 'echo' bash instructions produce a table


From: Alain . Cochard
Subject: Re: 2 'echo' bash instructions produce a table
Date: Wed, 16 Nov 2022 17:35:19 +0100

Ihor Radchenko writes on Mon 14 Nov 2022 03:59:
 > Alain.Cochard@unistra.fr writes:
 > 
 > > 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.

 > The manual describes generic code execution. If you do not explicitly
 > specify the :results header arg, it is the specific babel backend that
 > specifies the defaults.

 > Will it help if we mention this fact in "16.6 Results of Evaluation"
 > section?

Yes, it would help me.  At least I would been warned.  But it would be
complete only if knew where to read about each specific babel backend.

 > > 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.

 > Talking about ob-shell does not belong to this section of the
 > manual.  Other backends have different behaviour. Have you seen
 > examples in
 > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-shell.html
 > ?  Are they not clear enough?

No, I had not seen this before.  If I had, I might have understood why
I was getting the "strange" output that originated this thread -- but
I do not find it explained as clearly as you explained it:

   "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."

I can now see that the ob-doc-shell.html page is (indirectly) referred
to in 16.9, via
https://orgmode.org/worg/org-contrib/babel/languages/index.html.
Maybe this is enough for some, but for me it is too convoluted.  I had
seen this page, but it was a long time ago, when I checked whether the
languages I use were supported or not.  So why not also refer to it in
16.6, together with the mentioned fact to which you are referring
above?

a.


PS 1: In the manual, I see "backend" and "back-end".  So it is an
issue similar to the "subtree/sub-tree" issue you fixed a few days
ago, to the "heading/headline" issue that was reported recently, and
to many similar cases I met in the past.  So I was wondering if there
could exist some (semi-)automatic way which would ensure that future
maintainers will not inadvertently re-introduce "sub-tree"
occurrences, or the like.  Perhaps some "accepted terminology" list
that would be checked upon?

PS 2: Reading the ob-doc-shell.html page, I understood (kind of) what
was so far a mystery to me : that a "#+begin_src bash" group works as
expected while "#+begin_src ba + C-M-i" fails to complete "ba" to
"bash": namely that all the shells fall inside the "shell" umbrella
keyword.  Still, would not it make sense that the completion mechanism
also work for all those particular shells?

-- 
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 via email to

[Prev in Thread] Current Thread [Next in Thread]