Make Emacs-Server Write a PID File

Oddly, emacs-server doesn’t seem to have an option to write a PID file when it starts up. Here’s some ELisp you can drop into your init file to make it happen:

This entry was posted in Howto and tagged , , . Bookmark the permalink.
  • http://theadmin.org edavis10

    This is what I’ve been using for awhile now.

    https://github.com/edavis10/emacs-config/blob/master/desktop.el#L14

    • http://avdi.org Avdi Grimm

      I believe most of what that file is doing is automatic these days. I don’t
      find I need conditional server-starting; passing -a “” (-a with an empty
      string) to emacsclient takes care of that.

      In any case, my stuff is for a slightly different case; I have a makefile
      where I want it to restart the edit server if the config file has been
      updated. For that I needed a pidfile to a) tell it what to kill; and b) give
      it a timestamp of when the server was last started to compare against the
      init file.