From: Tyler Smith <tyler@plantarum.ca>
To: Emacs Org-Mode Help <emacs-orgmode@gnu.org>
Subject: org alters output of bash code blocks when run with :session
Date: Wed, 21 Feb 2018 17:10:01 -0500 [thread overview]
Message-ID: <1519251001.2394682.1278948176.74D79AA2@webmail.messagingengine.com> (raw)
Hi,
(originally posted to emacs.stackexchange[1] with no answers, )
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:,,C8CFGFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGCFGGGG@GGGGGGGGGGGGGGGGGGGGGGGGGGGGG+FF:B3CDFGGGFGGCFDGGGFCF:,FF9>FEC,F<FEG*?FFFFFGGG*CFEEECGGGGC+>FDGGDGFDFFEEFGEGC5>5?C*CGGF+3:*<7*2>+*<9CGCD::C=*@DCFCFFGG<C9<)7*9.5<@BA*7' | fold -w 60
#+END_SRC
#+RESULTS:
: CCCC8,,CEFGDF,,,CC,CF:,,C8CFGFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
: GGGGGGCFGGGG@GGGGGGGGGGGGGGGGGGGGGGGGGGGGG+FF:B3CDFGGGFGGCFD
: GGGFCF:,FF9>FEC,F<FEG*?FFFFFGGG*CFEEECGGGGC+>FDGGDGFDFFEEFGE
: GC5>5?C*CGGF+3:*<7*2>+*<9CGCD::C=*@DCFCFFGG<C9<)7*9.5<@BA*7
#+BEGIN_SRC bash session :results replace verbatim :session my-session
echo 'CCCC8,,CEFGDF,,,CC,CF:,,C8CFGFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGCFGGGG@GGGGGGGGGGGGGGGGGGGGGGGGGGGGG+FF:B3CDFGGGFGGCFDGGGFCF:,FF9>FEC,F<FEG*?FFFFFGGG*CFEEECGGGGC+>FDGGDGFDFFEEFGEGC5>5?C*CGGF+3:*<7*2>+*<9CGCD::C=*@DCFCFFGG<C9<)7*9.5<@BA*7' | fold -w 60
#+END_SRC
#+RESULTS:
: CCCC8,,CEFGDF,,,CC,CF:,,C8CFGFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
: GGGGGGCFGGGG@GGGGGGGGGGGGGGGGGGGGGGGGGGGGG+FF:B3CDFGGGFGGCFD
: FEC,F<FEG*?FFFFFGGG*CFEEECGGGGC+>FDGGDGFDFFEEFGE
: 5?C*CGGF+3:*<7*2>+*<9CGCD::C=*@DCFCFFGG<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?
Thanks!
Tyler
GNU Emacs 26.0.90
Org mode version 9.1.4
[1] https://emacs.stackexchange.com/questions/38964/org-alters-output-of-bash-code-blocks-when-run-with-session
--
plantarum.ca
next reply other threads:[~2018-02-21 22:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 22:10 Tyler Smith [this message]
2018-02-26 10:27 ` org alters output of bash code blocks when run with :session Nicolas Goaziou
2018-03-13 17:24 ` Tyler Smith
2018-03-14 13:51 ` Nicolas Goaziou
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=1519251001.2394682.1278948176.74D79AA2@webmail.messagingengine.com \
--to=tyler@plantarum.ca \
--cc=emacs-orgmode@gnu.org \
/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).