Skip to main content
GNU Emacs

GNU Emacs #

Basic stuff #

Config #

On macOS 14, this is where you put the config files:

~/.emacs.d/
├── theme.el
├── custom.el
└── init.el

Putting them under ~/.config/emacs/, contrary to popular belief, is not detected by GNU Emacs automatically on relaunch.

Terminology #

M
option
C
control
SPC
space
Window
Panel within a normal OS “window”
Frame
A normal OS “window”
Quit
Abort current command
Kill
Cut text
Yank
Paste killed text
Buffer
Edits, recent files
mouse-1
Left (primary) click
mouse-2
Scroll wheel click
mouse-3
Right click

Help #

Get help for types of help
C-h+?, which is C-shift-/ for ANSI keyboards
Get help for key combination
C-h+c for compact help
C-h+k for detailed help
Get help for command
C-h+x + name-of-command
Type esc+esc+esc to exit

Mode line (status bar) #

U: **-      TUTORIAL      43% (530,0)      (Fundamental)
            ^ buffer name, right click goes backward, left click goes forward
   ^ star means unsaved changes

Common commands #

Undo text editing
C-/
Comment
C-x+C-;
Doc: 28.5.1 Comment Commands
Save
C-x+C-s
Close current file (window)
C-x+0
Quit current command
C-g
Like control+C for shell (abort)
Quit recursive editing
esc+esc+esc
Quit Emacs
C-x+C-c
Help
C-h+k then enter key sequence for help
Enter command
M-x
Run code
Whole file: M-x eval-buffer return
Current block: C-x+C-e
Repeat command
C-u
e.g. C-u+8+M-f moves forward for 8 words
e.g. C-u+8+m enters mmmmmmmm

File system #

Find file
C-x+C-f
List buffer (recently edited files)
C-x+C-b
Quick switch between buffers
C-x+b
Choose a buffer to save
C-x+s, then y to confirm

Layout #

Horizontal split window
C-x+2
Move cursor to (activate) the other window
C-x+o
Scroll down (inactivated) other window
C-M-v
Close all other windows
C-x+1
Search & open new file in new window
C-x+4+C-f
Open new frame
C-x+5+2
Close current frame
C-x+5+0

Editing #

Search
Start search from current cursor position: C-s
Find next: C-s
Find previous: delete
End search: return
Move cursor around
Next screen (page): C-v
Previous screen: M-v
Move current line: C-l (rotates between centre → top → bottom)
Previous line: C-p
Next line: C-n
Backward (letter): C-b
Forward (letter): C-f
Backward (word): M-b
Forward (word): M-f
Head (line): C-a
End (line): C-e
Head (sentence): M-a
End (sentence): M-e
Head (file): M-<, which is M-shift-, for ANSI keyboards
End (sentence): M->, which is M-shift-. for ANSI keyboards
Delete
Backward letter: delete
Forward letter: C-d
Backward word: M-delete
Forward word: M-d
Kill (delete but with cut)
Forward line: C-k for content, C-k again for the line
Forward sentence: M-k
Yank (paste) killed text: C-y
Yank from previous kills: M-y

Org-mode #

Mobile #

Others #