Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Short loops?



On Feb 27, 10:32am, Peter Stephenson wrote:
} Subject: Re: Short loops?
}
} "Bart Schaefer" wrote:
} > Peter, how about adding something about this to the FAQ as well?
} 
} It looks like I should be adding two things to the FAQ.  This is the
} deyodled text.
} 
} 3.6: Why does zsh not work in an Emacs shell mode any more?
} 
}   Placing a
} 
}     (setenv "TERM" "emacs")
} 
}   in your ~/.emacs file seems to fix this.

This may not be universal, based on the discussion on zsh-users.  It
appears to work for the default shell-mode (shell.el) but not for the
enhanced shell-mode supplied by comint (comint.el).

Looking at the lisp code in comint.el, it appears emacs forces TERM=dumb
for systems where emacs is compiled with terminfo, and TERM=emacs for
those where it's compiled with termcap.  There's no hook to override
this; you can only redefine comint-exec-1 as in the sample I sent, which
is bad if comint gets upgraded.

This:

}   that are run from within emacs, you can instead use
} 
}     (setenv "ESHELL" "~/bin/eshell")
} 
}   and then put `TERM=emacs exec zsh' in the file ~/bin/eshell.

ought to work in either case, though for the FAQ I'd restate it as

    and then put

      #!/bin/sh
      TERM=emacs exec zsh

   in the file ~/bin/eshell, and `chmod +x ~/bin/eshell'.

Finally I'd add (via Alain Caron <alainc@xxxxxxxxx>):

   If none of the above works, place

      [[ -n "$EMACS" ]] && unsetopt zle

   in your $ZDOTDIR/.zshrc file.

If you want to say something about terminal mode:

   [[ -n "$EMACS" ]] && {
     [[ "$TERM" = eterm ]] && TERM=vt100 || unsetopt zle
   }

} 3.16: How does the alternative loop syntax, e.g. `while {...} {...}' work?

I agree with Zoltan's remarks about this; particularly about stronger
admonition to avoid the short forms in scripts.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern



Messages sorted by: Reverse Date, Date, Thread, Author