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: Sun, 13 Nov 2022 21:41:16 +0100

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

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