在终端中打开emacsclient但无法使用Automator

时间:2018-03-02 23:59:39

标签: emacs terminal automator spacemacs emacsclient

因此,当我尝试使用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” 然而,为什么我在我的终端中尝试该脚本也会给出类似的错误,这对我来说没有多大意义。

如果有人对如何解决这个问题有任何建议,我会非常感激。

1 个答案:

答案 0 :(得分:2)

问题是shell脚本在/ usr / bin中运行旧版本的emacsclient,你需要在Emacs.app/Contents/MacOS/bin/emacsclient中运行它。删除PATH行,您可以使用此处列出的解决方案在automator Running a macOS service for open with emacs failed with "emacsclient: could not get terminal name mac"内运行emacsclient