
对于 Emacs 熟练用户来说,大部分都会选择启动 server 模式,这样可以加速后续的启动时间,为与其他命令行工具组合使用奠定基础。本文介绍一种将 emacsclient 设置为文件默认打开程序的方式,适用平台 macOS。
1. 打开 Automator ,新创建『应用』类型文档2.Action 选择 Run Shell Script , Pass input 设为 as arguments ,并输入以下内容:
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c "$@" &
需要注意,命令最后有个 & ,表示后台执行,应用本身立刻退出。

使用 Automator 创建应用
3. 导出应用4. 在 Finder 中找到需要修改打开程序的文件,按 M-i ,在 Open With 子栏中选择刚才导出的应用,并点击 Change All

修改默认程序
这样以后在打开相同后缀名的文件时,就会用 emacsclient 打开了。
• How to open an EMACS file in OS X by double-clicking on it[1]
• TG 听友群:https://t.me/emacstalk
• 收听方式见:https://emacstalk.github.io/
[1] How to open an EMACS file in OS X by double-clicking on it: https://stackoverflow.com/questions/45548847/how-to-open-an-emacs-file-in-os-x-by-double-clicking-on-it-using-the-emacsclie