在现有 emacs 框架中打开文件 (Windows)

Rya*_*yan 6 windows emacs emacs24

我在 Windows 8 上使用 Emacs 24.3。我希望能够右键单击一个文件并选择“使用 Emacs 编辑”并在现有的 emacs 框架中打开该文件。下面列出了我到目前为止所做的所有步骤。大部分内容来自WindowsEmacs 文档页面

以下是我用来将“使用 Emacs 编辑”添加到上下文菜单中的注册表项:

[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\openwemacs]
@="&Edit with Emacs"
[HKEY_CLASSES_ROOT\*\shell\openwemacs\command]
@="C:\\Portable Software\\emacs-24.3\\bin\\emacsclientw.exe -n \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs]
@="Edit &with Emacs"
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs\command]
@="C:\\Portable Software\\emacs-24.3\\bin\\emacsclientw.exe --alternate-editor=\"C:\\Portable Software\\emacs-24.3\\bin\\runemacs.exe\" -n \"%1\""
Run Code Online (Sandbox Code Playgroud)

我还将ALTERNATE_EDITOR环境变量设置为C:\\path\\to\\runemacs.exe

在我的开头,我.emacs根据这个答案添加了以下代码。

(require 'server)
(or (server-running-p)
     (server-start))
Run Code Online (Sandbox Code Playgroud)

添加这在打开第二个文件时消除了“服务器已经运行”错误,但它仍然在新框架中打开。

那么让 emacs 在现有框架中打开新文件我错过了什么?

Rya*_*yan 5

我在尝试synctex使用 SumatraPDF修复时不小心想到了这一点。看起来除了指向 的ALTERNATE_EDITOR环境变量之外runemacs.exe,您还必须创建一个EMACS_SERVER_FILE指向服务器文件的环境变量(我的文件存储在.emacs.d\server目录中)。一旦我这样做了,我告诉用 Emacs 打开的文件在现有框架中打开,而不是创建它们自己的。