Skip to content

Instantly share code, notes, and snippets.

@avdi
Created June 17, 2011 19:36
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save avdi/1032136 to your computer and use it in GitHub Desktop.
Write pidfile on emacs-server startup
(setq pidfile "emacs-server.pid")
(add-hook 'emacs-startup-hook
(lambda ()
(with-temp-file pidfile
(insert (number-to-string (emacs-pid))))))
(add-hook 'kill-emacs-hook
(lambda ()
(when (file-exists-p pidfile)
(delete-file pidfile))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment