How can I set the port that the Emacs Server uses?

别来无恙 提交于 2020-01-03 08:21:30

问题


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. I connect to my office network over a VPN, I think this is mostly safe.

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.

Is there a way to set the port that the Emacs server listens on?


回答1:


Looks like this is now fixed. I'm using Emacs 24.3.1 and there is now a variable server-port:

C-h 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.




回答2:


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. Your best bet for now might be to patch your version of server.el locally.



来源:https://stackoverflow.com/questions/1891257/how-can-i-set-the-port-that-the-emacs-server-uses

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!