From 4a5059ba54ae483647a8a56e295cf32c201f5d0f Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 29 Jun 2016 12:36:54 +0200 Subject: emacs: added a systemd unit file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I finally got to fix the crash that I was having when trying to execute Emacs as a daemon. For this reason, now starting Emacs as a daemon during startup should be sensible enough. Signed-off-by: Miquel Sabaté Solà --- emacs/emacs.service | 11 +++++++++++ emacs/init.el | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 emacs/emacs.service (limited to 'emacs') diff --git a/emacs/emacs.service b/emacs/emacs.service new file mode 100644 index 0000000..d611118 --- /dev/null +++ b/emacs/emacs.service @@ -0,0 +1,11 @@ +[Unit] +Description=Emacs: the extensible, self-documenting text editor + +[Service] +Type=forking +ExecStart=/usr/bin/emacs --daemon +ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" +Restart=always + +[Install] +WantedBy=default.target diff --git a/emacs/init.el b/emacs/init.el index 750dbaa..0172a03 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -129,7 +129,15 @@ (set-frame-font "Droid Sans Mono Dotted for Powerline-10") (add-to-list 'default-frame-alist '(font . "Droid Sans Mono Dotted for Powerline-10")) -(set-face-attribute 'default t :font "Droid Sans Mono Dotted for Powerline-10") + +; Emacs in daemon mode does not like `set-face-attribute` because this is only +; applied if there is a frame in place, which doesn't happen when starting the +; daemon. Thus, we should call that after the frame has been created (e.g. by +; emacsclient). +; See: https://lists.gnu.org/archive/html/help-gnu-emacs/2015-03/msg00016.html +(add-hook 'after-make-frame-functions-hook + (lambda () + (set-face-attribute 'default t :font "Droid Sans Mono Dotted for Powerline-10"))) ;; Disable C-z. It will later on be picked up by Evil's config as the escape ;; sequence. This is here to make sure that it will be disabled even if Evil -- cgit v1.2.3