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

(funny)

Chapter 8 Markup Language Support

Comments

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

Chapter 9 Computer Language Support

etags

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 ...)

Atoms:

assign values to variable, use setq:

(setq auto-save-interval 800)

let construct:

(let ((var1 value1) (var2 value2) ... )
    statement-block)

while loop

(while condition statement-block)

sample

(defun count-words-buffer ()
"Count the number of words in the current buffer;
print a message in the minibuffer with the result."
    (interactive)
    (save-excursion
        (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

(progn
    statement-block)
(let (var1 var2 ...)
    statement-block)
(let (var1 (var2 value2) var3 ...)
    statement-block)

control structures

(if condition 
    true-case
    false-block)
(cond
    (condition1 statement-block1)
    (condition2 statement-block2)
    ...)

Lists

(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

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

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

(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)

[END]