远程emacs客户端连接,但不会在终端中创建新的帧 [英] remote emacs client connects, but doesn't create new frame in terminal

查看:166
本文介绍了远程emacs客户端连接,但不会在终端中创建新的帧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 添加了(setq server-host10.16 .184.33)(setq server-use-tcp t) to .emacs

  2. code> emacs --daemon

在同一台主机上运行 emacsclient -t 在当前终端中打开一个emacs框架,并运行 emacsclient -c 提供了一个新的图形客户端框架,如预期的那样。



在不同的主机上,运行 emacsclient -t -f〜/ .emacs.d / server / server 要成功连接到远程emacs服务器,但在终端中没有创建框架:

  $ emacsclient -t -f〜/ .emacs.d / server / server 
emacsclient:连接到10.16.184.33的远程套接字

在这一点上,emacsclient在前台运行,Ctrl-c使用SIGTERM停止。



server-客户端变量显示远程emacs客户端已连接:

 服务器客户端的值为
(#<进程服务器< 10.16 .184.33:52710>> #< process server< 10.16.177.8:59460>>)

检查:




  • Emacs和emacsclient的版本:全部24.3

  • 在交换哪些机器是服务器和远程客户端,出现相同的问题,除了...

  • emacsclient打印一个额外的错误消息

      emacsclient:连接到10.16.177.8的远程套接字
    *错误*:无法打开文件:/ dev / pts / 26
    pre>



任何想要检查或配置的内容?

解决方案

没有什么可以检查或配置。您根本不能远程使用 emacsclient ,因为两个进程共享框架,这不明显的原因。



如果客户端连接到Emacs服务器,它实际上并不会创建框架本身。相反,它仅仅告诉服务器要创建什么样的帧,即是GUI帧还是终端帧。然后,服务器根据客户端的请求和参数创建帧。



具体来说,在TTY客户端(即 emacsclient -t )的情况下,服务器尝试创建一个框架客户的TTY。显然,如果服务器在不同的系统上运行,这将不起作用。 TTY是本地的,不可远程访问。



如果Emacs服务器的TCP模式不是用于远程访问的。对于不支持本地Unix套接字(即Windows)的系统而言,这只是一个解决方法。



您甚至不想尝试使其正常工作,因为它是可怕的不安全作为本地协议,Emacs服务器既不支持流量加密也不支持认证。通过运行可远程访问的Emacs服务器,您可以允许任何其他系统在您的计算机上执行任意Emacs Lisp 。



正确的使用Emacs的方法远程是SSH。在远程系统上设置SSH服务器,然后通过SSH连接到系统,并在远程shell中启动 emacsclient -t


I configured and started an emacs server in TCP mode:

  1. Added (setq server-host "10.16.184.33") and (setq server-use-tcp t) to .emacs
  2. ran emacs --daemon

On the same host, running emacsclient -t brings up an emacs frame in the current terminal, and running emacsclient -c brings up a new graphical client frame, as expected.

On a different host, running emacsclient -t -f ~/.emacs.d/server/server appears to successfully connect to the remote emacs server, but no frame is created in the terminal:

$ emacsclient -t -f ~/.emacs.d/server/server
emacsclient: connected to remote socket at 10.16.184.33

At this point, emacsclient is running in the foreground, and a Ctrl-c stops it with a SIGTERM.

the value of the server-client variable shows that remote emacs client is connected:

server-clients's value is
(#<process server <10.16.184.33:52710>> #<process server <10.16.177.8:59460>>)

Things that I've checked:

  • versions of Emacs and emacsclient: all 24.3
  • when swapping which machines are the server and the remote client, the same problem occurs, except...
  • emacsclient prints an extra error message

    emacsclient: connected to remote socket at 10.16.177.8
    *ERROR*: Could not open file: /dev/pts/26
    

Any ideas of what else to check or configure?

解决方案

There is nothing you could "check or configure". You simply cannot use emacsclient remotely, because both processes share the frame, which does not work remotely for obvious reasons.

If a client connects to an Emacs server, it does not actually create the frame itself. Rather, it merely tells the server what kind of frame to create, i.e. whether a GUI frame or a terminal frame. The server then creates the frame based on the client's request and parameters.

Specifically, in case of a TTY client (i.e. emacsclient -t) the server attempts to create a frame on the client's TTY. Obviously this won't work if the server runs on a different system. TTYs are local and not remotely accessible.

FYI, the "TCP mode" of the Emacs server was never intended for remote access. It is simply a workaround for systems which do not support local Unix sockets, that is, Windows.

You don't even want to try and make it work, because it's horribly insecure. Being intended as local protocol, Emacs server does neither support traffic encryption nor authentication. By running a remotely accessible Emacs server, you allow any other system to execute arbitrary Emacs Lisp on your machine.

The right way to use Emacs remotely is SSH. Setup an SSH server on the remote system, then connect to the system via SSH and start emacsclient -t in the remote shell.

这篇关于远程emacs客户端连接,但不会在终端中创建新的帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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