简体   繁体   English

如何设置Emacs Server使用的端口?

[英]How can I set the port that the Emacs Server uses?

I use Emacs to do most of my development work, I'd like to be able to connect to the Emacs server running on my office workstation from home. 我使用Emacs完成大部分开发工作,我希望能够从家里连接到办公室工作站上运行的Emacs服务器。 I connect to my office network over a VPN, I think this is mostly safe. 我通过VPN连接到我的办公室网络,我认为这大多是安全的。

Anyway, I have a script that copies the server authentication file out, but it looks like the port changes every time. 无论如何,我有一个脚本可以复制服务器身份验证文件,但看起来端口每次都会更改。 Our VPN is pretty locked down, I need to tell our sysadmin what ports I want open to which machines. 我们的VPN已被锁定,我需要告诉我们的系统管理员我想要哪些端口打开哪些机器。

Is there a way to set the port that the Emacs server listens on? 有没有办法设置Emacs服务器侦听的端口?

Looks like this is now fixed. 看起来现在已经修复了。 I'm using Emacs 24.3.1 and there is now a variable server-port : 我正在使用Emacs 24.3.1,现在有一个可变的server-port

Ch v server-port RET Ch v server-port RET

gives the following documentation: 提供以下文档:

Documentation:
The port number that the server process should listen on.
This variable only takes effect when the Emacs server is using
TCP instead of local sockets.  A nil value means to use a random
port number.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 24.1 of Emacs.

so a (setq server-port 12345) in your init file should do the trick. 所以你的init文件中的(setq server-port 12345)应该可以解决问题。

Someone posted a small patch to allow customizing the server port to the Emacs Bugs list in September 2008. However, the patch didn't make it into Emacs 23.1 nor does it appear in CVS Emacs as of yet. 有人发布了一个小补丁,允许在2008年9月将服务器端口自定义到Emacs Bugs列表。但是,补丁没有进入Emacs 23.1,也没有出现在CVS Emacs中。 Your best bet for now might be to patch your version of server.el locally. 您现在最好的选择可能是在本地修补您的server.el版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM