1

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?

5

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
  • Elegant and simple solution that did the trick, thanks! – Electric Coffee Jan 26 '16 at 23:37
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 !

  • 1
    No, ^[[?2004h/^[[?2004l isn't related to colors. It's the control sequence to turn on/off bracketed paste mode. – Gilles Jan 26 '16 at 21:22

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.