gpt4 book ai didi

emacs - 可移植 Emacs? (Emacs 服务器不工作)

转载 作者:行者123 更新时间:2023-12-04 12:15:32 30 4
gpt4 key购买 nike

我看到了一些关于使 emacs 便携(在 Windows 上)的建议。我的 site-start.el 中有这个:

(defvar program-dir (substring data-directory 0 -4))

(setq inhibit-startup-message t)
(setenv "HOME" program-dir)

我更改了 HOME 变量,这样不仅可以读取我的 .emacs init 文件(和其他 init 文件),而且 emacs 生成的所有内容都将保留在程序目录中,不需要我一一指定所有内容的路径。

嗯,这很好用,但 emacs 服务器不工作;我收到错误消息“无法建立连接,因为目标机器主动拒绝它。”如果我不更改我的 HOME 变量,那么 emacs 服务器就可以工作。有没有办法解决这个问题?

最佳答案

报价 the Emacs manual :

When you start the Emacs server (by calling server-start), Emacs creates a file with information about TCP connection to the server: the host where Emacs is running, the port where it is listening, and an authentication string. emacsclient uses this information if it needs to connect to the server via TCP. By default, the file goes in the ~/.emacs.d/server/ directory. You can specify the file name to use with the `-f file' or `--server-file=file' options, or by setting EMACS_SERVER_FILE environment variable to the file name.


换句话说:无论您在何处调用 emacsclient从,您必须告诉它使用 ${program-dir}/.emacs.d/server/ 中的文件, 要么与 -f或设置 EMACS_SERVER_FILE环境变量。 (在您启动 emacsclient 的环境中,而不是在 Emacs 中。)
[你也可以用 -s 告诉 Emacsclient 在正确的地方查找对于“套接字”,但这在 Windows 上不起作用。而在 Unix 上(至少在带有 Aquamacs 的 Mac OS X 上),套接字将在类似 /tmp/emacs501/server 的地方。 (501 是我的 UID)。]

[哦,顺便说一句,看看这个问题: How can I have a portable Emacs?也许有些东西会对您有所帮助,或者您可以添加一些东西:-)]

关于emacs - 可移植 Emacs? (Emacs 服务器不工作),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/359497/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com