0

I've been trying to get shell code blocks with sessions to work, but not entirely succeeding.

My setup: emacs 26.1 (spacemacs) org-mode 9.2.2 default shell: zsh 5.7.1

Everything seems to work fine with sh but it fails with shell.

Ordinary, non-session execution works:

#+begin_src shell
  echo ${TERM}
  echo ${0}
#+end_src

#+RESULTS:
| dumb         |
| /usr/bin/zsh |

However, when I try to add a session I don't get the result I expect

#+begin_src shell :session s1
  FOO=bar
  echo ${TERM}
  echo ${0}
#+end_src

#+RESULTS:
|                                                       |
| magthecomp% 

[?2004hmagthecomp% FOO=bar[?2004l |

and on further use of that session emacs freezes up and I have to interrupt it (<Ctrl-g>), for instance if I try to execute

#+begin_src shell :session s1
  echo ${FOO}
#+end_src

When I take a look at the session buffer I see the following after running those blocks

FOO=bar
magthecomp% echo ${TERM}
magthecomp% FOO=bar
echo ${0}
echo ${0}
echo 'org_babel_sh_eoe'
echo 'org_babel_sh_eoe'
magthecomp% echo ${TERM}echo ${0}
dumbecho /usr/bin/zsh
            echo 'org_babel_sh_eoe'
org_babel_sh_eoe
magthecomp% echo ${FOO}
echo ${FOO}echo 'org_babel_sh_eoe'
            echo ${FOO}echo 'org_babel_sh_eoe'

(some colour is lost when copying it)

I already toned down the theme for my shell prompt when ${TERM} == "dumb", but apparently that isn't enough. Any pointers on how to adjust my zsh config to make it work would be much appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.