emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org alters output of bash code blocks when run with :session


From: Nicolas Goaziou
Subject: Re: [O] org alters output of bash code blocks when run with :session
Date: Mon, 26 Feb 2018 11:27:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello,

Tyler Smith <address@hidden> writes:

> I am running a short bash command from an org mode code block, using
> the program `fold` to wrap it at 60 characters. If I run the code
> without a session argument, the results display as expected. However,
> when I set the session argument (which I have to do in the context of
> the long literate analysis I'm doing), some of the output characters
> don't appear.
>
> Steps to reproduce:
>
>     emacs -Q
>
> Open the following file and execute each code block in turn:
>
> +------------------------
>
>     #+BEGIN_SRC elisp setup
>     (org-babel-do-load-languages
>      'org-babel-load-languages
>      '((shell . t)))
>     #+END_SRC
>
>     
>     #+RESULTS:
>     
>
>     #+BEGIN_SRC bash no session :results replace verbatim
>      echo 
> 'CCCC8,,CEFGDF,,,CC,CF:,,address@hidden:B3CDFGGGFGGCFDGGGFCF:,FF9>FEC,F<FEG*?FFFFFGGG*CFEEECGGGGC+>FDGGDGFDFFEEFGEGC5>5?C*CGGF+3:*<7*2>+*<9CGCD::address@hidden<C9<)7*9.5<@BA*7'
>  | fold -w 60
>     #+END_SRC
>
>     
>     #+RESULTS:
>     : CCCC8,,CEFGDF,,,CC,CF:,,C8CFGFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
>     : address@hidden:B3CDFGGGFGGCFD
>     : GGGFCF:,FF9>FEC,F<FEG*?FFFFFGGG*CFEEECGGGGC+>FDGGDGFDFFEEFGE
>     : GC5>5?C*CGGF+3:*<7*2>+*<9CGCD::address@hidden<C9<)7*9.5<@BA*7
>     
>
>     #+BEGIN_SRC bash session :results replace verbatim :session my-session
>      echo 
> 'CCCC8,,CEFGDF,,,CC,CF:,,address@hidden:B3CDFGGGFGGCFDGGGFCF:,FF9>FEC,F<FEG*?FFFFFGGG*CFEEECGGGGC+>FDGGDGFDFFEEFGEGC5>5?C*CGGF+3:*<7*2>+*<9CGCD::address@hidden<C9<)7*9.5<@BA*7'
>  | fold -w 60
>     #+END_SRC
>
>     
>     #+RESULTS:
>     : CCCC8,,CEFGDF,,,CC,CF:,,C8CFGFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
>     : address@hidden:B3CDFGGGFGGCFD
>     : FEC,F<FEG*?FFFFFGGG*CFEEECGGGGC+>FDGGDGFDFFEEFGE
>     : 5?C*CGGF+3:*<7*2>+*<9CGCD::address@hidden<C9<)7*9.5<@BA*7
> +------------------------
>
> Notice the difference between the two bash results blocks. In the
> first, the input string is folded at column 60, without any other
> changes. In the second, a string of characters has been deleted:
>
> - `GGGFCF:,FF9>` from the beginning of the third line 
> - `GC5>` from the beginning of the fourth line
>
> The fact that the deleted strings both start at the beginning of
> a line and end with a `>` suggests that the session thinks they should
> be redirected somehow, and in the process is dropping them completely.
> However, when I look at the session buffer, the output appears as
> expected, with no missing characters.
>
> How do I force the babel session to leave the output alone, and print
> it verbatim into the org file?

It may be related to other problems related to prompt in shell sessions.
See for example
<http://lists.gnu.org/r/emacs-orgmode/2018-02/msg00081.html>,
<http://lists.gnu.org/r/emacs-orgmode/2018-01/msg00415.html>, and for
step forward a solution
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-04/msg00147.html>.

Patches welcome!

Regards,

-- 
Nicolas Goaziou



reply via email to

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