1 of 13

Emacs

Part 1

24 January 2025

2 of 13

Outline

What is Emacs?

Pros/Cons

Install

Getting Started

.emacs

Miscellaneous Items

01

02

03

04

05

06

2

3 of 13

What is Emacs

Joke:

Emacs is a great operating system, lacking only a decent text editor.

What emacs REALLY is:

Emacs is an interactive environment for developing text editing programs.

4 of 13

Pros/Cons

Pros:

  • Completely customizable
  • Built on top of Lisp (programming language)
  • Not configuration files, code files
  • Emacs is available everywhere

Cons:

  • Muscle memory has to be retrained
  • Too customizable? Can be a distraction from doing real work.
  • Built on Lisp …. Not the most common language

5 of 13

Install

Windows:

Mac:

  • https://emacsformacosx.com/

Linux:

  • Just use your favorite package manager

6 of 13

Getting Started

Pick a few keyboard commands per week and practice using them. It takes time for the muscle memory to train:

7 of 13

Getting Started

  • Emacs uses key chords (one or more key-strokes)
  • “C-” means “Ctrl and a key”
    • Example: “C-x C-c” means “Ctrl+x followed by Ctrl+c”
  • “M-” means “Meta and a key”
    • Meta is usually the Alt key
    • On Mac I map Command key as my Meta key
    • Example: “M-f” means “Meta+f”
  • “S-” means “Shift and a key”
  • Where your cursor currently is is called the “point”
  • A “mark” is a remembered old “point” location
  • A “region” is the text between “point” and “mark”.
  • The “kill-ring” is a list of text that has been “killed”.
    • Translation: it is a “list of clipboard entries” of text that has been “cut”.

8 of 13

Getting Started

Command

Description

C-z

GUI: Minimize window

Console: Put emacs in background

C-x C-c

Quit emacs

C-x C-f

Open file

C-x C-s

Save file

C-x C-w

Save file as

C-g

Cancel current thing

C-x u

C-/

Undo last action (can undo multiple times)

9 of 13

Getting Started: Movement

Command

Description

C-f, C-b

Move forward or backward one letter

M-f, M-b

Move forward or backward one word

C-n, C-p

Move to next or previous line

C-a, C-e

Move to start or end of line

C-v, M-v

Move down or up one screenful

C-s, C-r

Search forward or backward

C-l

Center the text vertically on “point”

10 of 13

Getting Started: Copy/Paste

Command

Description

Backspace, C-d

Delete previous or next char

M-Backspace, M-d

Kill previous or next word

C-k

Kill line from cursor to end-of-lline

C-w, M-w

Delete or kill “region” (text between mark/point)

C-y

Yank (paste last thing in the kill ring)

M-y

Replace last yank with preceding item in kill ring

C-Space

Set “mark” at “point”

C-x C-x

Swap “mark” and “point”

11 of 13

.emacs

Your dot emacs file (.emacs) is found in your home directory (~).

It is an elisp code file that is executed when emacs starts up.

Set variables, write code, load other code files here to configure your emacs.

12 of 13

Miscellaneous Items

Font:

Color Scheme:

Utilities

13 of 13

Q&A

13