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

Mil*_*les 8 emacs emacsclient

我使用Emacs完成大部分开发工作,我希望能够从家里连接到办公室工作站上运行的Emacs服务器.我通过VPN连接到我的办公室网络,我认为这大多是安全的.

无论如何,我有一个脚本可以复制服务器身份验证文件,但看起来端口每次都会更改.我们的VPN已被锁定,我需要告诉我们的系统管理员我想要哪些端口打开哪些机器.

有没有办法设置Emacs服务器侦听的端口?

Cra*_*on 5

看起来现在已经修复了.我正在使用Emacs 24.3.1,现在有一个变量server-port:

C-h v server-port RET

提供以下文档:

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.
Run Code Online (Sandbox Code Playgroud)

所以(setq server-port 12345)你的init文件中的a应该可以解决问题.