如何从 Mac OS X 上的 Dock(或者也可能从终端)启动带有 GUI 的 Emacsclient?
EmacsWiki describes如何使用 Automator 创建“Emacs from Dock”应用程序。它对我有用,但我不想启动 Emacs 而是 Emacsclient。所以,我尝试更换 /Applications/Emacs.app/Contents/MacOS/Emacs
与两者 /Applications/Emacs.app/Contents/MacOS/bin/emacsclient
和 /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c
但两者都不起作用。
最佳答案
从终端
你可以找到合适的路径到emacsclient
使用 type
在您的 shell 中(假设 emacsclient -c
在所述 shell 中工作):
$ type emacsclient
emacsclient is /usr/local/bin/emacsclient
然后我们可以添加适当的 emacsclient 标志(详见 $ man emacsclient
)来打开 GUI:/usr/local/bin/emacsclient -n -c -a ""
从 macOS GUI
推出
emacsclient
从例如 Dock 或 Spotlight,它很容易使用 Automator。 Automator 内置于 macOS。选择制作一个“Application”,然后选择“Run Shell Script”,将上述调用的修改版添加到
emacsclient
:/usr/local/bin/emacsclient -n -c -a "" -- "$@"
然后更改“传递输入”:使用“作为参数”而不是“到标准输入”。已添加
"$@"
是放置传递给此 shell 脚本的任何可选参数的位置。在这里,这允许您传递文件名以使用 emacsclient
打开. Automator 会自动传递此文件名,例如,当您使用我们刚刚制作的应用程序单击打开文件时。这还允许您将应用程序设置为某些文件类型的默认应用程序。从任何地方,灵活
运行上述 shell 命令的另一种方法是使用
skhd
(link) . skhd
学习要复杂得多,但最终可以更轻松地设置大量具有快速访问权限的 shell 命令。例如,您可以在 macOS 的任何位置让“Ctrl-o”进入您命名的模式
open_app
,您可以从中按“e”打开 emacsclient
, "d"打开 emacs --debug-init
, "t"运行 emacs --adv-timers
,“f”打开 Firefox,“F”打开第二个 Firefox 配置文件,等等。
关于macos - 在 Mac OS X 上使用 GUI(从 Dock)启动 Emacsclient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39464975/