Adam's Digital Garden


Using Emacs Quickstart and Guide on Mac OS

Install Emacs by downloading it and placing in the Application folder. You will need to give Emacs disk access in Security settings and run

$ cd /Applications/
$ mv Emacs Emacs.old
$ ln -s Emacs-x86_64-10_14 Emacs

per comment on github.

This guide is meant as a quick-start to skim from start to finish. Using Emacs requires an intent. There is no desktop prompting me to open a browser or organize files. Before doing an action I need to decide what that action is. Maybe once I develop a muscle memory in Emacs I will end up wasting just as much time as I do in a desktop environment. If that happens I will update this text.

Emacs uses the CTRL, written as C, and ALT, written as M, keys to perform keyboard commands. On macOS you can use the mouse to access the menu, scrolling and selecting text.

Emacs screen has 3 areas in a frame, think a frame to a painting. In the frame is your work area (the buffer in a window, the painting), the mode line (title of painting), and the minibuffer at the bottom (helpful text description). The minbuffer shows you the commands you are typing when you are slow. The mode line has the file name, your position in the file as a percent and line number, and whether not the file has been saved, indicated with ** . Finally the mode line says which major mode you are in. The mode changes what some commands do. For example in Text mode ’’ are treated as characters not separators.

In the command lists below:

In the command list you will often see C-x and M-x

Good to know from the start

Window splitting

A window shows a buffer, your painting in the frame. You can have the same buffer in two windows or different buffers in two different windows. You can have many buffers open at the same time under each other. Open a buffer in a window to see it.

For example you can open the buffer list C-x C-b in a new window, then use C-x o to move to the other window, and then press return to open that buffer in the new window. Then use C-x 1 to close all other windows.

The buffer with Name are from Emacs. Messages lists all the messages that appear in mini-buffer

Cursor based

Page based

File/Buffer Manipulation

File manipulation needs you to find a file, they call it visiting a file, in order to make changes to it. You can visit non existing files to create them. When you save a file it will be placed in your home directory ~/ allow to input a name or path in the mini-buffer. If you want to go to the file from root use //. You can open files on remote servers with user@host:path-to-file

Text Manipulation

Make line warp on words by enabling (Visual Line Mode)[]

You can make visual-line-mode at startup by changing ~/.emacs with following

(global-visual-line-mode t)


You may end up in Recursive Editing Levels, indicated with [] around the mode name. Press ESC three times to get out of it.

General Patterns

Self Learning

Advanced usage

Once you have the basics it is time to configure Emacs to make it the best place to get work done

Add extras or enable options

Extra features in Emacs are called packages. You can see the list of currently install packages with

M-x list-packages : List the available packages

Some of the packages I use are in the Melpa archive which can be installed with:

(require 'package)
(add-to-list 'package-archives '("melpa" . "") 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 '("melpa-stable" . "") t)

see full melpa install instructions (here)[]

Winner Mode Option

Winner mode can be enabled since Emacs version 20. Winner Mode allows you to undo window configuration changes.

Read more including how to enable by default on the wiki

Enable terminal commands

M-x term : is a full terminal from emacs. M-x shell : enables the shell for basic commands such as ls and cat. For more sophisticated commands use term.

In order for your $PATH to be correct there are several steps. First install the exec-path-from-shell package from melpa.

Then You will need to update the .emacs file with

(when (memq window-system '(mac ns x))

see (github)[] for details

Finally make sure that your PATH variables are set in .zshenv instead of .zshrc.

Useful Tips and Tricks

Buffer mode, major or add a minor.

C-h m : list major mode commands

You can associate a mode to load when opening a specific file type with the auto-mode-alist variable.

Markdown preview mode

Setup Melpa and then install the ‘markdown-preview-mode’ package

C-c C-t 1 : Insert Header 1