Useful Emacs Commands

This page serves as on-line documentation for some Emacs commands that I always have a hard time remembering. It evolved from “notes to myself” posts on my blog Irreal.

Commands for Matching Lines

COMMANDALIASACTION
keep-linesdelete-non-matching-linesDelete lines not matching regexp
flush-linesdelete-matching-linesDelete lines matching regexp
how-manycount-matchesCount lines matching regexp
occurlist-matching-linesShow lines matching regexp in another buffer
highlight-lines-matching-regexphi-lock-line-face-bufferHighlight lines matching regexp
multi-occurOccur on multiple buffers
multi-occur-in-matching-buffersOccur on buffers chosen by regexp

Deleting Lines and Parts of Lines

KEY SEQUENCEACTION
Ctrl+0 Ctrl+kDelete from point to beginning of line
Shift+Ctrl+BackspaceDelete entire line the point is on

Miscellaneous Text Commands

KEY SEQUENCECOMMANDACTION
Meta+o Meta+scenter-lineCenter line (n lines with prefix n)
Ctrl+Meta+wappend-next-killAppend next kill
nonelinum-modeTurn on line numbers in left fringe

Register Commands

Specify a prefix on copy/move commands to delete the original.

KEY SEQUENCEFUNCTION
Ctrl+x r Space ρCopy position to register ρ
Ctrl+x r j ρJump to the position in register ρ
Ctrl+x r s ρCopy/Move region to register ρ
Ctrl+x r i ρInsert object in register ρ at point
Ctrl+x r r ρCopy/Move rectangle to register ρ
Ctrl+x r w ρCopy current frame configuration to register ρ
Ctrl+x r f ρCopy all frame configurations to register ρ
Ctrl+u N Ctrl+x r n ρInsert N into register ρ
Ctrl+u I Ctrl+x r + ρIncrement register ρ by I

Using set-mark-command to Remember Locations

KEY SEQUENCEACTION
Ctrl+Space Ctrl+SpacePush current position onto mark ring
Ctrl+u Ctrl+SpaceReturn to previous position in the same buffer
Ctrl+x Ctrl+SpaceReturn to previous position, which may or may not be in the same buffer

Useful Help Commands

CommandAction
eView *Messages* buffer
F】 CMDView Info node documenting CMD
rView Emacs Manual

Also: elisp-index-search and emacs-index-search

Emacs Syntax Table

These aren't really commands but I always have a hard time finding this table in the built-in documentation so I'm listing it here.

SYNTAX CLASSCHARACTER DESIGNATION
Whitespace Character- (hyphen) or ␠
Word Constituentw
Symbol Constituent_ (underscore)
Punctuation Character.
Open Parenthesis(
Close Parenthesis)
String Quote"
Escape-Syntax Character\
Character Quote/
Paired Delimeter (TeX $)$
Expression Prefix'
Comment Starter<
Comment Ender>
Inherit Standard Syntax@
Generic Comment Delimiter!
Generic String Delimiter|


Date: 2012-07-15 10:22:34 EDT