2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macでEmacsの起動を高速化(daemon/emacsclientを使う)

Posted at

設定内容

Emacs daemonをログイン時に起動しておいてemacsclientを使用する。
Emacs daemonが落ちていたら再起動するようにする。

設定方法

Automatorで以下のようにAppleScriptを実行できるようにして, EmacsClientという名前で/Applicationsに保存する[1]。

on run {input, parameters}
	
try
	tell application "Terminal"
		do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -create-frame --alternate-editor=''"
	end tell
on error
	tell application "Terminal"
		do shell script "/Applications/Emacs.app/Contents/MacOS/Emacs --daemon"
		do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient  -create-frame --alternate-editor=''"
	end tell
end try	
	return input
end run

以下のファイルを~/Library/LaunchAgents/gnu.emacs.daemon.plistに保存して, launchctl load -w ~/Library/LaunchAgents/gnu.emacs.daemon.plistを端末から実行する[2]。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>gnu.emacs.daemon</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Applications/Emacs.app/Contents/MacOS/Emacs</string>
      <string>--daemon</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceDescription</key>
    <string>Gnu Emacs Daemon</string>
  </dict>
</plist>

参考ページ

[1] https://gist.github.com/redinger/1394910
[2] https://www.emacswiki.org/emacs/EmacsAsDaemon

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?