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

时间:2009-12-11 22:22:47

标签: emacs emacsclient

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

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

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

2 个答案:

答案 0 :(得分: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.

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

答案 1 :(得分:1)

有人在2008年9月将a small patch to allow customizing the server port发布到了Emacs Bugs列表中。但是,补丁没有进入Emacs 23.1,也没有出现在CVS Emacs中。您现在最好的选择可能是在本地修补server.el版本。