在macOS下,为了方便用Emacs打开任何文件,我用Automator创建了一个服务“Open in Emacs”。服务其实就是个脚本:
/usr/local/Cellar/emacs/25.3/bin/emacsclient -nc "$@"
但是当实际运行这个服务的时候,会出现如下错误:
emacsclient: could not get terminal name
这个问题有人碰到过么?
在macOS下,为了方便用Emacs打开任何文件,我用Automator创建了一个服务“Open in Emacs”。服务其实就是个脚本:
/usr/local/Cellar/emacs/25.3/bin/emacsclient -nc "$@"
但是当实际运行这个服务的时候,会出现如下错误:
emacsclient: could not get terminal name
这个问题有人碰到过么?
应该是差不多的原因。
加上参数 -s ${TMPDIR}emacs${UID}/server"
。
这个解决方案似乎有点缺陷(我忘了具体有什么缺陷了),但是副作用最小。
如果你用的是 emacs-mac 版的话,它本身是支持 AppleScript 的:
osascript -e 'tell application "Emacs"
to open location "mailto:[email protected]"'
多谢回复!
在我这里测试了一下,貌似不解决问题…
改成用如下Shell脚本测试OK:
open -a Emacs "$@"
GG。最简单的办法。
多谢,试了一下,的确也可以。
完美解决方案:/usr/local/bin/../Cellar/emacs/25.3/bin/emacsclient -nc "$@" --display ns