在终端中打开 emacsclient 工作但不适用于 Automator

Mas*_*son 5 emacs terminal automator emacsclient spacemacs

因此,当我尝试使用 Automator 服务打开新的 emacs(带有 spacemacs 的 GNU 版本 25.2)缓冲区时,出现了一些非常奇怪的行为。

在我的终端中,该命令emacsclient -a '' -c按预期工作,通过 emacsclient 打开一个新缓冲区。但是,当我在 Automator 中创建一个仅运行 ( /bin/bash) shell 脚本的服务时: emacsclient -a '' -c 我收到一条错误消息: The action “Run Shell Script” encountered an error: “emacsclient: could not get terminal name”

由于怀疑这是由于 Automator 没有使用某些默认PATH变量,我尝试了以下操作: PATH=/usr/local/bin:$PATH emacsclient -c 它产生了与以前相同的错误。

接下来我尝试 PATH=/usr/bin:/usr/local/bin export PATH; emacsclient -c 产生了不同的错误消息: The action “Run Shell Script” encountered an error: “emacsclient: invalid option -- c Try `emacsclient --help' for more information” 但是为什么我在终端中尝试该脚本它也给出了一个类似的错误,这对我来说没有多大意义。

如果有人对如何解决此问题有建议,我将不胜感激。

小智 3

问题是 shell 脚本正在 /usr/bin 中运行旧版本的 emacsclient,您需要运行 Emacs.app/Contents/MacOS/bin/emacsclient 中的版本。删除 PATH 行,您可以使用此处列出的解决方案在 automator 内运行 emacsclient 运行使用 emacs 打开的 macOS 服务失败,并显示“emacsclient:无法获取终端名称 mac”