Emacs:流浪汉不起作用 [英] Emacs: Tramp doesn't work

查看:25
本文介绍了Emacs:流浪汉不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过 Emacs 通过 TRAMP 打开远程文件.

(需要 'tramp)(setq tramp-default-method "ssh")

我收到来自 Emacs 的消息

<块引用>

Tramp:等待来自远程 shell 的提示

Emacs 挂了,之后没有响应任何操作

Emacs 安装在 Windows 上;远程文件在 Linux 机器上.

解决方案

如果您连接的帐户使用了一些奇怪的花哨的 shell 提示,那么很有可能就是这就是造成流浪者旅行的原因.

以root身份登录,然后输入

PS1=">"

(这是一个普通的标准 shell(ZSH、BASH、younameit)提示符,tramp 会理解的)然后切换到用户帐户,并启动 emacs -q(以确保您的 .emacs 不会造成这种混乱)并尝试 Cx Cf/sudo:root@localhost:/etc/hosts 看看是什么.

你也可以(不推荐)自定义定义tramp期望的正则表达式:

M-x 自定义变量 RET tramp-terminal-prompt-regexp

我的方法:

  1. 确保变量 tramp-terminal-type 设置为哑"

M-x 自定义变量 RET tramp-terminal-type

  1. 在您的 .*shrc 中测试它并提供正确的提示:

<块引用>

case "$TERM" in哑的")PS1=">";;xterm*|rxvt*|eterm*|screen*)PS1="我喜欢的多行 
 提示 > ";;*)PS1=">";;esac

I tried to open a remote file via Emacs via Tramp.

(require 'tramp)
(setq tramp-default-method "ssh")

I get a message from Emacs

Tramp: Waiting for prompts from remote shell

Emacs hung and did not respond to any action after that

Emacs was installed on Windows; the remote file was on a Linux machine.

解决方案

If the account you're connecting to uses some weird fancy shell prompt, then there is a good chance that this is what makes tramp trip.

Log in as root, then enter

PS1="> "

(that's a normal, standard shell (ZSH, BASH, younameit) prompt, one that tramp will understand) then switch to the user account, and launch emacs -q (to make sure that your .emacs is not causing this mess) and try to C-x C-f /sudo:root@localhost:/etc/hosts and see what's what.

You can (not recommended) also customize the regexp that defines what tramp expects :

M-x customize-variable RET tramp-terminal-prompt-regexp

My approach :

  1. Make sure the variable tramp-terminal-type is set to "dumb"

M-x customize-variable RET tramp-terminal-type

  1. Test that in your .*shrc and serve the correct prompt :

case "$TERM" in
"dumb")
    PS1="> "
    ;;
xterm*|rxvt*|eterm*|screen*)
    PS1="my fancy multi-line 
 prompt > "
    ;;
*)
    PS1="> "
    ;;
esac

这篇关于Emacs:流浪汉不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆