0

I have configured my ~/.emacs so: It either launches default emacs via the default init.el, or runs the Spacemacs init.el

I run Spacemacs via a spacemacs shell script, ~/bin/spacemacs

#!/bin/sh
export USE_SPACEMACS="1";
emacs $1

and this is the content of ~/.emacs

(setq use-spacemacs (getenv "USE_SPACEMACS"))
(when (> (length use-spacemacs) 0)
    (setq user-emacs-directory "~/.spacemacs.d/"))   ; defaults to ~/.emacs.d/
(load (expand-file-name "init.el" user-emacs-directory))

How can I run emacs --daemon with the configuration from the ~/spacemacs.d/init.el? I may have to adjusted to disable stuff like the server-start and other such options.

For the meantime I have settled on starting Spacemacs in background screen terminal and running the emacsclient commands in my regular terminals.

1
  1. Just pass --daemon to your wrapper script?

  2. You should change emacs $1 to emacs "$@"

  3. (setq use-spacemacs (getenv "USE_SPACEMACS"))
    (when (> (length use-spacemacs) 0)
    

    could be

    (when (getenv "USE_SPACEMACS")
    
  • What is the effect of running (require 'server) (unless (server-running-p) (server-start))) in daemon mode? Is running in daemon mode equivalent in having server-running-p? – vfclists Jun 20 '17 at 7:02
  • Yes, that code has no effect when emacs was started as a daemon. – phils Jun 20 '17 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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