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

Re: problem with GNU Emacs shell mode


>>>>> "Bart" == Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> writes:
>>>>> "Me" = James B. Crigler <crigler@xxxxxxx> writes:

 Bart> Placing a
 Bart>     (setenv "TERM" "emacs")
 Bart> in your ~/.emacs file seems to fix this.

 Me> Neither of these works for me.  I start a shell and get ^M's and
 Me> "echo $TERM" still returns "dumb".  Next idea?

 Bart> If you C-h v process-environment RET in emacs, what is TERM set
 Bart> to?  Maybe you're stomping on the (setenv ...) with a (setq
 Bart> process-environment ...)  or some such, elsewhere?

Nothing, i.e., there is no TERM in process-environment.  (I start
emacs from my .xinitrc so it will be available immediately---well, as
fast as emacs comes up, anyway.)

 Bart> Try this:

 Bart> ;; Don't set TERM=dumb, it bugs zsh.
 Bart> (require 'comint)
 Bart> (defun comint-exec-1 (name buffer command switches)
 Bart>   (let ((process-environment
 Bart> 	 (nconc
 Bart> 	  (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
 Bart> 	      (list "EMACS=t" "TERM=emacs"
 Bart> 		    (format "COLUMNS=%d" (frame-width)))
 Bart> 	    (list "EMACS=t" "TERM=emacs"
 Bart> 		  (format "TERMCAP=emacs:co#%d:tc=unknown" (frame-width))))
 Bart> 	  process-environment)))
 Bart>     (apply 'start-process name buffer command switches)))

This also works.  (The previous solution was to add this:

   [[ $TERM = dumb ]] && unsetopt zle

to .zshrc.  Since you (Bart) are a lot more fluent in zsh stuff than I
am, could you comment on the relative merits of the two approaches?

- -- 
Jim Crigler <crigler@xxxxxxx>
Schwartz Electro-Optics, Inc.   Voice:  (407)298-1802 x200
3404 N. Orange Blossom Tr.        Fax:  (407)290-9666
Orlando FL 32804-3498 USA

Version: 2.6.2
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface


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