init.elを読み込ませず素の状態のEmacsデーモンをサーバーとして立ち上げる

by supermomonga,
published on

Initial Options - GNU Emacs Manualを参照

-Q オプションをつければ良い。

(require 'server)

(let ((my/server-host (or (getenv "SERVER_HOST") "0.0.0.0"))
      (my/server-port (or (getenv "SERVER_PORT") "1234"))
      (my/server-name (or (getenv "SERVER_NAME") "emacs_server"))
      (my/default-directory (expand-file-name "./emacs.d")))
  (setq server-host my/server-host)
  (setq server-port my/server-port)
  (setq server-name my/server-name)
  (setq default-directory my/default-directory)
  (setq server-use-tcp t)
  (setq server-auth-dir my/default-directory))

(defun server-ensure-safe-dir (dir) t)

(server-start)
emacs -Q -daemon --load=server.el