6

I recently switched to zsh (with oh-my-zsh) as my primary shell, but running the shell from emacs results in some strange (for lack of a better word) "residural" characters; however changing to bash removes these characters:

➜  ~  ^[[?2004h bash
 bash^[[?2004l
coffee@Lappy:~$

Is there any way for me to keep using zsh in emacs without it looking like absolute garbage?

Electric Coffee
  • 163
  • 1
  • 5

2 Answers2

10

The control sequences ^[[?2004h and ^[[?2004l turn bracketed paste mode on and off.

Shell mode doesn't support bracketed paste mode (with these or any other control sequences), so zsh shouldn't try to turn it on. Shell mode correctly advertises that it doesn't support these control sequences by declaring TERM=dumb. It seems that zsh blindly assumes that the terminal either supports or ignores these two control sequences. That's a bug in zsh, which I can reproduce with zsh from git.

As a workaround, disable bracketed paste mode in your .zshrc if the terminal doesn't support escape sequences.

if [[ $TERM = dumb ]]; then
  unset zle_bracketed_paste
fi
0

This looks like bad color encodings. Try using ansi-color like so http://wikemacs.org/wiki/Shell#More_colors or with M-x ansi-color-for-comint-mode-on.

ps: yes it's possible, I use zsh !

Ehvince
  • 1,091
  • 10
  • 14
  • 1
    No, `^[[?2004h`/`^[[?2004l` isn't related to colors. It's the control sequence to turn on/off [bracketed paste mode](http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode). – Gilles 'SO- stop being evil' Jan 26 '16 at 21:22