aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2016-06-29 12:36:54 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2016-06-29 12:36:54 +0200
commit4a5059ba54ae483647a8a56e295cf32c201f5d0f (patch)
treeb4bbd22ce46104f179355933a4a71ff186109d40 /emacs
parent067bebe3e23a7f7f3e005911f6116cc292b0905d (diff)
downloaddotfiles-4a5059ba54ae483647a8a56e295cf32c201f5d0f.tar.gz
dotfiles-4a5059ba54ae483647a8a56e295cf32c201f5d0f.zip
emacs: added a systemd unit file
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à <msabate@suse.com>
Diffstat (limited to 'emacs')
-rw-r--r--emacs/emacs.service11
-rw-r--r--emacs/init.el10
2 files changed, 20 insertions, 1 deletions
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