用emacs替换ssh + screen +编辑器 [英] replacing ssh+screen+editor with emacs

查看:1192
本文介绍了用emacs替换ssh + screen +编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是远程编写代码。到目前为止,我一直在使用ssh + screen +一个编辑器(例如vim)。



我明白使用本地emacs(或vim),可以编辑远程文件。但是一旦本地emacs关闭,我想重新打开它(或使用另一台电脑打开它),我需要重新打开所有缓冲区。



有没有在远程机器上设置emacs服务器的方式,我可以使用本地emacs客户端简单的访问它?这实际上是模拟屏幕行为。

解决方案

我想你可能会在这里找到你的答案;



http://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html



根据 http://www.gnu.org/software /emacs/manual/html_node/emacs/emacsclient-Options.html#emacsclient-Options ;



Emacs服务器通常使用称为本地套接字来监听连接。某些操作系统(如Microsoft Windows)不支持本地套接字;在这种情况下,Emacs会使用TCP。当您启动Emacs服务器时,Emacs会创建一个包含一些TCP信息的服务器文件,emacsclient需要进行连接。默认情况下,服务器文件位于〜/ .emacs.d / server /中。在Microsoft Windows上,如果emacsclient找不到服务器文件,那么它将在APPDATA环境变量指向的目录的.emacs.d / server /子目录中查找。您可以告诉emacsclient使用具有-f或--server-file选项的特定服务器文件,或通过设置EMACS_SERVER_FILE环境变量。



甚至如果本地套接字可用,您可以通过将变量server-use-tcp设置为t来告诉Emacs使用TCP。 TCP的一个优点是服务器可以接受来自远程机器的连接。为此,您必须(i)将变量服务器主机设置为运行Emacs服务器的计算机的主机名或IP地址,以及(ii)向服务器文件提供emacsclient。 (一个方便的方法是将服务器文件放在网络文件系统上,如NFS。)



当Emacs服务器使用TCP时,变量服务器-port确定要侦听的端口号;默认值nil意味着在服务器启动时选择随机端口。



当然,请确保在服务器端调整防火墙设置,以便客户端可能连接到运行emacs-server的计算机。


My goal is to remotely write code. So far, I have been using ssh + screen + an editor (e.g. vim).

I understand using a local emacs (or vim), one can edit remote files. But once the local emacs is closed and I want to reopen it (or open it using another computer), I would need to reopen all the buffers again.

Is there a way to set up a emacs server on the remote machine and I could simply access it using a local emacs client? Which essentially simulate the screen behavior.

解决方案

I think you might find your answer here;

http://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html

According to http://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html#emacsclient-Options ;

An Emacs server usually uses an operating system feature called a "local socket" to listen for connections. Some operating systems, such as Microsoft Windows, do not support local sockets; in that case, Emacs uses TCP instead. When you start the Emacs server, Emacs creates a server file containing some TCP information that emacsclient needs for making the connection. By default, the server file is in ~/.emacs.d/server/. On Microsoft Windows, if emacsclient does not find the server file there, it looks in the .emacs.d/server/ subdirectory of the directory pointed to by the APPDATA environment variable. You can tell emacsclient to use a specific server file with the ‘-f’ or ‘--server-file’ option, or by setting the EMACS_SERVER_FILE environment variable.

Even if local sockets are available, you can tell Emacs to use TCP by setting the variable server-use-tcp to t. One advantage of TCP is that the server can accept connections from remote machines. For this to work, you must (i) set the variable server-host to the hostname or IP address of the machine on which the Emacs server runs, and (ii) provide emacsclient with the server file. (One convenient way to do the latter is to put the server file on a networked file system such as NFS.)

When the Emacs server is using TCP, the variable server-port determines the port number to listen on; the default value, nil, means to choose a random port when the server starts.

Of course, make sure to adjust your firewall settings on the server side, so that clients may connect to the machine running the emacs-server.

这篇关于用emacs替换ssh + screen +编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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