I send off a bug report against emacs to the emacs maintainers, and got a patch back.
Here's my report, and the patch, delimited by =-=-=-=-= lines Austin =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From: [EMAIL PROTECTED] (Austin Donnelly) Newsgroups: gnu.emacs.bug Subject: ange-ftp doesn't set TERM=dumb in inner shell Date: 6 Dec 1995 07:39:47 -0500 Lines: 71 Message-ID: <[EMAIL PROTECTED]> In GNU Emacs 19.29.1 (i486-debian-linuxaout, X toolkit) of Wed Sep 20 1995 on imagine configured using --prefix=/usr --with-pop=yes --with-x=yes --with-x-toolkit=lucid i486-debian-linuxaout The standard Debian /usr/bin/ftp has readline support, which is very nice. However, this means that it outputs control codes to make full use of the terminal. The problem is that ange-ftp can't parse the ftp output when it has all these control sequences in it. /usr/bin/ftp will keep quiet if TERM is set to "dumb", but as things stand, it believes TERM to be "xterm", so it outputs "turn keypad on" and "turn keypad off" codes when giving prompts. This means that emacs running (with -nw) out of an xterm, or running in X fully can't do ange-ftp. Starting emacs by typing: bash$ TERM=dumb emacs & solves the problem. However, this isn't a long-term solution. I think the best solution would be to start the ftp client in an environment where TERM=dumb. I include the error messages from ange-ftp for completeness below: (Note that both these buffers contain ESC control characters. I have also provided uuencoded copies of them in case they get mangled in transit). ------------------- buffer: *ftp [EMAIL PROTECTED] --------------------- [?1h=open src.doc.ic.ac.uk ftp> [?1l>Connected to phoenix.doc.ic.ac.uk. 220 sunsite.doc.ic.ac.uk FTP server (Version wu-2.4(23) Sun Jul 9 23:09:29 BST 1995) ready. Remote system type is UNIX. Using binary mode to transfer files. [?1h=ftp> ---------------------------------------------------------------------------- begin 644 ftp-buffer M&UL_,6@;/6]P96X@<W)C+F1O8RYI8RYA8RYU:PIF='`^(!M;/S%L&SY#;VYN [EMAIL PROTECTED]&\@<&AO96YI>"YD;V,N:6,N86,N=6LN"C(R,"!S=6YS:71E+F1O M8RYI8RYA8RYU:R!&5%`@<V5R=F5R("A697)S:6]N('=U+3(N-"@R,[EMAIL PROTECTED] M($IU;"`Y(#(S.C`Y.C(Y($)35"`Q.3DU*2!R96%D>2X*4F5M;W1E('-Y<W1E M;2!T>7!E(&ES([EMAIL PROTECTED]"E5S:6YG(&)I;F%R>2!M;V1E('1O('1R86YS9F5R 5(&9I;&[EMAIL PROTECTED];6S\Q:!L]9G1P/B`* ` end ---------------------------------------------------------------------------- ------------------------------ buffer: *Messages* -------------------------- Loading ange-ftp... Loading ange-ftp...done Opening FTP connection to src.doc.ic.ac.uk... FTP Error: OPEN request failed: [?1l>Connected to phoenix.doc.ic.ac.uk. ---------------------------------------------------------------------------- begin 644 message-buffer M3&]A9&EN9R!A;F=E+69T<"[EMAIL PROTECTED],;V%D:6YG(&%N9V4M9G1P+BXN9&]N90I/ M<&5N:6YG($944"!C;VYN96-T:6]N('1O('-R8RYD;V,N:6,N86,N=6LN+BX* M1E10($5R<F]R.B!/4$5.(')E<75E<[EMAIL PROTECTED];&5D.B`;6S\Q;!L^0V]N;F5C ==&5D('1O('!H;V5N:[EMAIL PROTECTED]&[EMAIL PROTECTED] ` end ---------------------------------------------------------------------------- Thanks, Austin =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Date: Thu, 7 Dec 1995 01:18:18 -0500 From: Richard Stallman <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Re: ange-ftp doesn't set TERM=dumb in inner shell Thanks. Does this fix it? cd ~/e19/lisp/ diff -c /rms/e19/lisp/ange-ftp.el.\~1\~ /rms/e19/lisp/ange-ftp.el *** /rms/e19/lisp/ange-ftp.el.~1~ Thu Nov 16 17:27:14 1995 --- /rms/e19/lisp/ange-ftp.el Wed Dec 6 18:28:40 1995 *************** *** 1778,1784 **** ;; It would be nice to make process-connection-type nil, ;; but that doesn't work: ftp never responds. ;; Can anyone find a fix for that? ! (let ((process-connection-type t)) (if use-gateway (if ange-ftp-gateway-program-interactive (setq proc (ange-ftp-gwp-start host user name args)) --- 1778,1787 ---- ;; It would be nice to make process-connection-type nil, ;; but that doesn't work: ftp never responds. ;; Can anyone find a fix for that? ! (let ((process-connection-type t) ! (process-environment process-environment)) ! ;; This tells GNU ftp not to output any fancy escape sequences. ! (setenv "TERM" "dumb") (if use-gateway (if ange-ftp-gateway-program-interactive (setq proc (ange-ftp-gwp-start host user name args)) Diff exited abnormally with code 1 at Wed Dec 6 18:48:56 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= The diff in fact works fine. Could the emacs maintainer (Ian M) include this in the next emacs release, please ? (I think that version 19.30 is out). Alternatively, does Ian M want to give the emacs and emacs-el packages to me ? Austin