From 5e5ea3bcd5c7338f99307442bd158432a540079b Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Sun, 14 Jun 2020 23:03:16 +0000 Subject: [PATCH] chore(config-shared): Remove emacs config files Remove `emacs` config files and instructions now that data transferred to `yadm` repo. --- config-shared/emacs/INSTRUCTIONS.md | 141 ------------------ .../emacs/home/.bash_aliases.appendme | 1 - .../home/.config/systemd/user/emacs.service | 13 -- 3 files changed, 155 deletions(-) delete mode 100644 config-shared/emacs/INSTRUCTIONS.md delete mode 100644 config-shared/emacs/home/.bash_aliases.appendme delete mode 100644 config-shared/emacs/home/.config/systemd/user/emacs.service diff --git a/config-shared/emacs/INSTRUCTIONS.md b/config-shared/emacs/INSTRUCTIONS.md deleted file mode 100644 index 134dd31..0000000 --- a/config-shared/emacs/INSTRUCTIONS.md +++ /dev/null @@ -1,141 +0,0 @@ - - - -# 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.[[1]](#melpa_2019_setupinst) - -#### 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.[[2]](#se_20161221_emacsclimultieval) - -### 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`[[4]](#emacswiki_20200325_emacsclient) which each communicate with a single instance of `emacs --daemon`[[3]](#emacswiki_20200408_emacsdaemon). 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 - -- 1. ["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. -- 2. ["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) -- 3. ["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. -- 4. ["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/ - - -
-

This work by Steven Baltakatei Sandoval is licensed under CC BY-SA 4.0

diff --git a/config-shared/emacs/home/.bash_aliases.appendme b/config-shared/emacs/home/.bash_aliases.appendme deleted file mode 100644 index d8e12b0..0000000 --- a/config-shared/emacs/home/.bash_aliases.appendme +++ /dev/null @@ -1 +0,0 @@ -alias emacs='emacsclient -create-frame --alternate-editor=""' # Note: This alias requires `emacs --daemon` to work properly. See https://www.emacswiki.org/emacs/EmacsAsDaemon . diff --git a/config-shared/emacs/home/.config/systemd/user/emacs.service b/config-shared/emacs/home/.config/systemd/user/emacs.service deleted file mode 100644 index f3d7df9..0000000 --- a/config-shared/emacs/home/.config/systemd/user/emacs.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Emacs text editor -Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ - -[Service] -Type=simple -ExecStart=/usr/bin/emacs --fg-daemon -ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" -Environment=SSH_AUTH_SOCK=%t/keyring/ssh -Restart=on-failure - -[Install] -WantedBy=default.target -- 2.30.2