Emacs

From wikinotes

Emacs is a text-editor that can be used in a GUI or a console.

TODO:

learn how to use emacs, then clean this up

Documentation

official docs https://www.gnu.org/software/emacs/documentation.html

Locations

~/.emacs main emacs config
~/.emacs.d/ emacs packages installed here

Tutorials

vim to emacs https://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-fourteen-days.html

Install

sudo pacman -S emacs

Terminology

Terminology
emacs vim description
frame window A window to the WM. Contains splits.
window A clone of the current buffer. All properties are identical between all views of buffer EXCEPT for the cursor-point.
indirect-buffer split A totally independent copy of the current buffer. Text is shared/updated, but everything else is independent.

Basics

emacs basic usage
emacs plugins
elisp

Minor Modes

emacs x-symbol alter display of characters by revel (like vim conceal)

Base Config

TODO:

get rid of this whole section once I have a real config

Package Manager

Manual Package Download
Provided that you have the package-archives variable (defined below) set up, you can search/download from the package-archives using:

<M-x>   package-list                  ;; show all packages
<M-x>   package-refresh-contents      ;; refresh package index
<C-s>  <package-you-are-looking-for>  ;; install package


Automated Package Download
Automating package downloading from .emacs can be done with the following setup:

	;; Define Package Sources, Initialize Package Manager
	(setq package-archives '(("gnu"       .  "http://elpa.gnu.org/packages/")
	                         ("org"       .  "http://orgmode.org/elpa/")
	                         ("marmalade" .  "http://marmalade-repo.org/packages/")
	                         ("melpa"     .  "http://melpa.milkbox.net/packages/")
                           ;("melpa-stable" . "http://melpa-stable.milkbox.net/packages/")
									))
	(require 'package)
	(package-initialize)


	;; Define Packages to install
	(setq required-pkgs '(
								 evil
								 evil-tabs
								 evil-leader
								 evil-search-highlight-persist

								 airline-themes

								 neotree
								 projectile
								 grizzl

								 darktooth-theme
								 gruvbox-theme
							 ))


	;; Auto-Install Packages
	(require 'cl)

	(setq pkgs-to-install
	      (let ((uninstalled-pkgs (remove-if 'package-installed-p required-pkgs)))
	        (remove-if-not '(lambda (pkg) (y-or-n-p (format "Package %s is missing. Install it? " pkg))) uninstalled-pkgs)))

	(when (> (length pkgs-to-install) 0)
	  (package-refresh-contents)
	  (dolist (pkg pkgs-to-install)
	    (package-install pkg)))

Keybinding

	;; Evil-Mode Keybinding
	(define-key evil-normal-state-map (kbd "C-h") 'evil-window-left)


	;; Binding Multiple commands to a single Key-Sequence
	(define-key evil-insert-state-map (kbd "M-h") (lambda () (interactive)  (backward-char) (evil-normal-state)  ))

	;; Binding Key-Sequence to another Key-Sequence