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

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

问题描述

我试图通过Tramp通过Emacs打开一个远程文件。

 (require'tramp)
(setq tramp-default-methodssh)

我收到Emacs的消息


Tramp:等待远程shell的提示


Emacs挂起没有回应任何操作之后



Emacs安装在Windows上;远程文件位于Linux机器上。

解决方案

如果您连接的帐户使用了一些奇怪的外壳提示,有一个很好的机会,这是什么让流浪汉旅行。



以root身份登录,然后输入

  PS1 =>

(这是一个普通的标准shell(ZSH,BASH,younameit)提示,一个流氓将理解)
然后切换到用户帐户,并启动 emacs -q (以确保您的 .emacs 不会导致这个混乱),并尝试 Cx Cf / sudo:root @ localhost:/ etc / hosts



您可以(不推荐)还自定义正则表达式,定义了邮件预期的内容:

  Mx自定义变量RET tramp-terminal-prompt-regexp 

我的方法:


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

Mx自定义变量RET tramp-terminal-type


  1. 测试您的。* shrc并提供正确的提示:

  2. <



      
    dumb中的$ TERM)
    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 tramps 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 \n prompt > "
        ;;
    *)
        PS1="> "
        ;;
    esac
    

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

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