Getting Tramp in Emacs to work with zsh as default shell

I was trapped by this issue for around one hour, until I finally discovered the solution from EmacsWiki:

If you use zsh and Tramp hangs every time you try to connect, try placing this in your .zshrc from the remote computer:

[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ '

Update
I found the configuration above failed to work today. The below is working for me now.

if [[ "$TERM" == "dumb" ]]
then
  unsetopt zle
  unsetopt prompt_cr
  unsetopt prompt_subst
  unfunction precmd
  unfunction preexec
  PS1='$ '
fi
Advertisements
Getting Tramp in Emacs to work with zsh as default shell