Is there a hook to execute stuff after I've run emacs --daemon? I'd like to keep load stuff only when running emacs --daemon and not when running emacs.

I know it sounds like using square wheels, but I do have my reasons.


1 Answer 1


You can wrap the relevant portions of you init file in a conditional on (daemonp), whose docstring reads:

Return non-nil if the current emacs process is a daemon. If the daemon was given a name argument, return that name.


(when (daemonp)
  • 1
    Note however that this is not equivalent to a server-start hook: that code won't run if server-start is used without using --daemon.
    – YoungFrog
    Jan 11, 2017 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.