-<!DOCTYPE html>
-<meta charset="utf-8">
-
-# Setup Instructions for `emacs`
-
-Created by [Steven Baltakatei Sandoval][bktei_2020_homepage] on 2020-04-16T23:13Z under a [CC BY-SA 4.0][cc_20131125_bysa] license and last updated on 2020-04-17T02:58Z.
-
-## 1. Summary
-
-Emacs is a command line editor. This document contains instructions and files required to install and customize Emacs on GNU/Linux Debian 10 machines.
-
-### 1.1. File list
-
- ./config-shared/emacs/INSTRUCTIONS.md # These setup instructions
- ./config-shared/emacs/home/.emacs.d/init.el # enables MELPA repository
- ./config-shared/emacs/home/.config/systemd/user/emacs.service # required for automatic daemon startup
- ./config-shared/emacs/home/.bash_aliases.appendme # contains alias for use with emacs daemon
-
-## 2. Instructions
-
-### 2.1. Install `emacs` package
-
-#### 2.1.a. Typical Debian install
-
-Use `$ sudo apt-get install emacs` to install `emacs`.
-
-#### 2.1.b. Headless Debian install (no GUI)
-
-Use `$ sudo apt-get install emacs-nox` to install `emacs` without an X window manager. This may be useful if emacs is to be used via command-line only such as a machine without a monitor to which a use connects via `ssh`.
-
-### 2.2. Enable MELPA package repository
-
-MELPA is a package repository for packages that add functionality to `emacs`. Detailed instructions for installing it may be found at melpa.org.<sup>[[1]](#melpa_2019_setupinst)</sup>
-
-#### 2.2.a. Typical install
-
-Create and/or edit the `~/.emacs.d/init.el` file to include the following text elisp code:
-
- (require 'package)
- (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
- (not (gnutls-available-p))))
- (proto (if no-ssl "http" "https")))
- (when no-ssl (warn "\
- Your version of Emacs does not support SSL connections,
- which is unsafe because it allows man-in-the-middle attacks.
- There are two things you can do about this warning:
- 1. Install an Emacs version that does support SSL and be safe.
- 2. Remove this warning from your init file so you won't see it again."))
- (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
- ;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
- ;; and `package-pinned-packages`. Most users will not need or want to do this.
- ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
- )
- (package-initialize)
-
-A copy of this text is contained within the `./config-shared/emacs/home/.emacs.d/init.el` file in this repository. A command to copy this code to a completely new system is below.
-
- $ mkdir ~/.emacs.d
- $ cp ./config-shared/emacs/home/.emacs.d/init.el ~/.emacs.d/init.el
-
-Run `M-x package-refresh-contents` (can be run from bash via `$ emacs -nw --eval '(progn (package-refresh-contents) (kill-emacs))'`) to download MELPA package list.<sup>[[2]](#se_20161221_emacsclimultieval)</sup>
-
-### 2.3. Configure `emacs` daemon and `emacsclient`
-
-A convenient way to share buffers between different shells (ex: across guake and Terminal) is to edit files using multiple instances of `emacsclient`<sup>[[4]](#emacswiki_20200325_emacsclient)</sup> which each communicate with a single instance of `emacs --daemon`<sup>[[3]](#emacswiki_20200408_emacsdaemon)</sup>. An instance of `emacsclient` running in `guake` may crash due to a problem with `guake` but the text buffer being edited by the user will not be lost since it is maintained by `emacs --daemon`. To regain access to the buffer, one must only start another instance of `emacsclient` and switch to the buffer (ex: via `C-x b`).
-
-#### 2.3.a. Create `emacs` daemon as a user service.
-
-Create the `~/.config/systemd/user/emacs.service` file to be the following text:
-
- [Unit]
- Description=Emacs text editor
- Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
-
- [Service]
- Type=forking
- ExecStart=/usr/bin/emacs --daemon
- ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
- Encopy itvironment=SSH_AUTH_SOCK=%t/keyring/ssh
- Restart=on-failure
-
- [Install]
- WantedBy=default.target
-
-This text is contained in this repository directory as `./config-shared/emacs/home/.config/systemd/user/emacs.service`. This file may be installed using the following command.
-
- $ cp ./config-shared/emacs/home/.config/systemd/user/emacs.service ~/.config/systemd/user/emacs.service
-
-Enable and start this service by running the following commands.
-
- systemctl enable --user emacs
- systemctl start --user emacs
-
-Successful running of this command should produce something like the following messages:
-
- Created symlink /home/baltakatei/.config/systemd/user/default.target.wants/emacs.service → /home/baltakatei/.config/systemd/user/emacs.service.
-
-A new process named `/usr/bin/emacs --daemon` should appear in `$ ps -aux | grep emacs` output. This process should appear automatically upon login.
-
-In order to use the daemon to edit a text file in the command line, the following command should be used.
-
- $ emacsclient -nw
-
-#### 2.3.b. Create `emacsclient` alias.
-
-Typing `emacsclient` instead of just `emacs` is inconvenient. Therefore, it's recommended to make an alias.
-
-##### 2.3.b.i. `bash` alias
-
-If `bash` is your primary shell, then the alias can be included in the `~/.bash_aliases` file. The alias can be included by appending the `./config-shared/emacs/home/.bash_aliases.appendme` text file in this repository directory to the `~/.bash_aliases` file in the home directory. The following command may be used to to perform this append operation.
-
- $ cat ./config-shared/emacs/home/.bash_aliases.appendme >> ~/.bash_aliases
-
-The relevant portion of the `./config-shared/emacs/home/.bash_aliases.appendme` file is below.
-
- alias emacs='emacsclient -create-frame --alternate-editor=""'
-
-In order to see the alias changes, either logout and restart your shell or run `$ source ~/.bash_aliases`.
-
-## 3. Conclusion.
-
-Emacs should now be configured to run automatically in the background as a daemon upon login.
-
-## 4. References
-
-- <a name="melpa_2019_setupinst">1.</a> ["Getting started"][1]. https://melpa.org . Access date: 2020-04-17. [Archive link](https://web.archive.org/web/20200325114522/https://melpa.org/#/getting-started). Archive date: 2020-03-25.
-- <a name="se_20161221_emacsclimultieval">2.</a> ["emacs --eval of multiple functions on command line"][2]. Stack Exchange. Access date: 2020-04-17. [Archive link](https://web.archive.org/web/20200417002001/https://emacs.stackexchange.com/questions/29465/emacs-eval-of-multiple-functions-on-command-line/29467)
-- <a name="emacswiki_20200408_emacsdaemon">3.</a> ["Emacs As Daemon"][3]. EmacsWiki. Access date: 2020-04-17. License: GPLv2. [Archive link](https://web.archive.org/web/20200303223315/https://www.emacswiki.org/emacs/EmacsAsDaemon). Archive date: 2020-03-03.
-- <a name="emacswiki_20200325_emacsclient">4.</a> ["Emacs Client"][4]. EmacsWiki. Access date: 2020-04-17. License: GPLv2. [Archive link](https://web.archive.org/web/20190804144010/https://www.emacswiki.org/emacs/EmacsClient). Archive date: 2019-08-04.
-
-
-[1]: https://melpa.org/#/getting-started
-[2]: https://emacs.stackexchange.com/a/29467
-[3]: https://www.emacswiki.org/emacs/EmacsAsDaemon
-[4]: https://www.emacswiki.org/emacs/EmacsClient
-[bktei_2020_homepage]: http://baltakatei.com
-[cc_20131125_bysa]: http://creativecommons.org/licenses/by-sa/4.0/
-
-
-<hr>
-<p xmlns:dct="http://purl.org/dc/terms/" xmlns:cc="http://creativecommons.org/ns#">This work by <a rel="cc:attributionURL" href="http://baltakatei.com"><span rel="cc:attributionName">Steven Baltakatei Sandoval</span></a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=ccchooser" target="_blank" rel="license noopener noreferrer" style="display: inline-block;">CC BY-SA 4.0</a><a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=ccchooser"><img style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;opacity:0.7;" src="https://search.creativecommons.org/static/img/cc_icon.svg" /><img style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;opacity:0.7;" src="https://search.creativecommons.org/static/img/cc-by_icon.svg" /><img style="height:22px!important;margin-left: 3px;vertical-align:text-bottom;opacity:0.7;" src="https://search.creativecommons.org/static/img/cc-sa_icon.svg" /></a></p>