Skip to content

Instantly share code, notes, and snippets.

@BonfaceKilz
Created March 29, 2017 21:46
Show Gist options
  • Save BonfaceKilz/8c5daa7286aba583d92d1f08b36e3334 to your computer and use it in GitHub Desktop.
Save BonfaceKilz/8c5daa7286aba583d92d1f08b36e3334 to your computer and use it in GitHub Desktop.
Setting up emacsclient

Add the following to your .bashrc file:

# Emacs config
export ALTERNATE_EDITOR=emacs EDITOR=emacsclient VISUAL=emacsclient
# Set an alias
alias ec="emacsclient"

Add the following to your ~/.config/systemd/user/emacs.service file:

[Unit]
Description=Emacs: the extensible, self-documenting text editor

[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
Restart=always

# Remove the limit in startup timeout, since emacs
# cloning and building all packages can take time
TimeoutStartSec=0

[Install]
WantedBy=default.target

Run the following as a systemd service:

systemctl --user enable emacs
systemctl --user start emacs
systemctl --user stop emacs
systemctl --user disable emacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment