LoginSignup
3
3

More than 5 years have passed since last update.

シェルからEmacsを立ち上げるときの起動を速くする

Posted at

Emacsを一つ立ち上げっぱなしにして、シェルからファイルを編集するときにいちいちEmacsを新しく立ち上げないで、その立ち上がっているEmacsで編集できるようにする設定をします。

.emacs.d/init.d
;;; emacsclient
(server-start)
(defun iconify-emacs-when-server-is-done ()
  (unless server-clients (iconify-frame)))
;; 編集が終了したらEmacsをアイコン化する
(add-hook 'server-done-hook 'iconify-emacs-when-server-is-done)
;;  C-x C-cに割り当てる
(global-set-key (kbd "C-x C-c") 'server-edit)
;; M-x exitでEmacsを終了できるようにする
(defalias 'exit 'save-buffers-kill-emacs)

再起動してEmacsを立ち上げます。シェルから下記を実行すると最初に立ち上げたEmacsで編集ができるようになります。

$ emacsclinet test.txt

ちょっとした設定ファイルをいじるときはemacsだと起動が遅かったのでviを使っていたのですが、これでemacsでもよくなりそうです。

参照

「Emacsテクニックバイブル」P91

3
3
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
3
3