开发者

Emacs on Windows + SSH: subshell spurios characters?

I'm trying to connect via SSH to a remote shell, using Emacs on Windows XP. I'm currently using Putty, but I'd like to switch to Emacs.

I can't find a way which works right. The best I've achieved is running Plink (command line version of Putty) as a subshell, but I'm still getting spurious characters and duplicated prompts like this:

Last login: Fri 开发者_StackOverflow社区Jun 18 11:09:11 2010 from XXXXX
^]0;root@XXXXX:~^[root@XXXXX ~]# ls
ls
file-1.cfg              file-10.log         file-100.pcap
^]0;root@XXXXX:~^[root@XXXXX ~]# 
^]0;root@XXXXX:~^[root@XXXXX ~]# 

I guess those sequences with a "^" prefix are escape characters, but I can't find a way to get them translated, or to get rid of them. I've tried this:

(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(let ((explicit-shell-file-name "C:/Programmi/Putty/plink")
      (explicit-plink-args '("root@XXXXX")))
    (shell))

Any hint? Have you got a way to run a Secure Shell inside a native Windows version of Emacs?

Software: GNU Emacs 23.1.1, plink.exe version 0.60, Windows XP SP3

Thanks.


http://www.emacswiki.org/emacs/AnsiTermHints describes how to use ansi-term-mode for ssh connections to remote hosts.

The problematic sequences look (vaguely) like the standard Bash prompt to set the title bar in xterm to the current directory etc. You may be able to get a different default prompt by setting the TERM environment variable when creating the SSH connection, so that Bash won't think your terminal is an xterm. Try with TERM=emacs (adapt to the syntax of your shell as necessary). If you succeed, you might not need ansi-term-mode at all, although it could still be useful if you have ls directory listing colorization etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜