OS X下的Emacs Deamon模式设置

本文介绍如何通过 Emacs 的 daemon 模式显著提升启动速度。包括安装 Emacs、创建 daemon 和 client 应用的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

由于Emacs插件配置越来越多,启动速度都快赶超IDE了。所以试验了下daemon模式,效果不错。除了第一次启动daemon比较慢,后面的基本上是秒启。

一、安装emacs
没安装Emacs的可以从[Emacs for Mac OS X]: [url]http://emacsformacosx.com/builds[/url]下载安装。

二、创建一个daemon应用
打开AppleScript编辑器,粘贴如下内容:

tell application "Terminal"
do shell script "/Applications/Emacs.app/Contents/MacOS/Emacs --daemon >/dev/null 2>&1 &"
end tell

保存到/Applications目录下,名字为“Emacs Daemon”,[color=red]文件格式为“应用程序”[/color]。

三、创建一个client应用
打开AppleSciprt编辑器,粘贴如下内容:

tell application "Terminal"
try
set frameVisible to do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -e '(<= 2 (length (visible-frame-list)))'"
if frameVisible is not "t" then
do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c -n"
end if
on error
do shell script "/Applications/Emacs.app/Contents/MacOS/Emacs --daemon"
do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c -n"
end try
end tell
tell application "Emacs" to activate

保存到/Applications目录下,名字为“Emacs Client”,[color=red]文件格式为“应用程序”[/color]。

配置完毕。启动的时候先启动Emacs Daemon应用。之后都是使用Emacs Client启动就可以了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值