Jim Cheung

Learning GNU Emacs, Third Edition

Chapter 1 Emacs Basics

Chapter 2 Editing

Editing Tricks and Shortcuts

Canceling Commands and Undoing Changes

Making Emacs Work the Way You Want

Chapter 3 Search and Replace

Different Kinds of Searches

Search and Replace

during query-replace

Chapter 4 Using Buffers, Windows, and Frames

More About Windows

Holding Your Place with Bookmarks

Chapter 5 Emacs as a Work Environment

Executing Commands in Shell Buffers

Using Dired, the Directory Editor

(too many, check online)

Chapter 6 Writing Macros

Chapter 7 Simple Text Formatting and Specialized Editing

Rectangle Editing

Making Simple Drawings


Chapter 8 Markup Language Support


(html-mode is not useful anymore, use emmet-mode instead)

Chapter 9 Computer Language Support


motion commands

Chapter 10 Customizing Emacs

Customizing Your Key Bindings

c-x, esc and c-c are bound to special internal functions that cause emacs to wait for another key to be pressed.

three functions are available for creating key bindings:

where keymap can be global-map, 'ctl-x-map, esc-map` etc...

; these 3 are same
(global-set-key "\C-xl" 'goto-line)
(define-key global-map "\C-xl" 'goto-line)
(define-key ctl-x-map "l" 'goto-line)

unset key bindings:

(global-unset-key [f5])
(define-key ctl-x-map "l" nil)

Chapter 11 Emacs Lisp Programming

Introduction to Lisp

syntax of function: (function-name argument1 argument2 ...)


assign values to variable, use setq:

(setq auto-save-interval 800)

let construct:

(let ((var1 value1) (var2 value2) ... )

while loop

(while condition statement-block)


(defun count-words-buffer ()
"Count the number of words in the current buffer;
print a message in the minibuffer with the result."
        (let ((count 0))
        (goto-char (point-min))
        (while (< (point) (point-max))
            (forward-word 1)
            (setq count (1+ count)))
        (message "buffer contains %d words." count))))

Lisp Primitive Functions

statement block

(let (var1 var2 ...)
(let (var1 (var2 value2) var3 ...)

control structures

(if condition 
    (condition1 statement-block1)
    (condition2 statement-block2)


(list 2 3 4 5)
(cons 1 (list 2 3 4 5))
(car (list 1 2 3 4 5)) ; 1
(cdr (list 1 2 3 4 5)) ; (2 3 4 5)


(lambda (args)
(setq var-name
    '(lambda ()

mode hook

(setq mode-name-hook
    '(lambda ()
        code for mode hook))

set load-path

(setq load-path (append load-path (list "some directory"))) ; all arguments to append must be lists

if you want your code to be searched first, use cons

(setq load-path (cons "some directory" load-path))

to load file, m-x load-library or:

(load "package-name")


(autoload 'function "filename")

Chapter 12 Version Control

(use magit instead, much better)

Chapter 13 Platform-Specific Considerations

(no notes)

Chapter 14 The Help System

(no notes)