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+k】Delete from point to beginning of line
【Shift+Ctrl+Backspace】Delete entire line the point is on

Miscellaneous Text Commands

KEY SEQUENCECOMMANDACTION
【Meta+o Meta+s】center-lineCenter line (n lines with prefix n)
【Ctrl+Meta+w】append-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+Space】Push current position onto mark ring
【Ctrl+u Ctrl+Space】Return to previous position in the same buffer
【Ctrl+x Ctrl+Space】Return to previous position, which may or may not be in the same buffer

Useful Help Commands

CommandAction
【e】View *Messages* buffer
【F】 CMDView Info node documenting CMD
【r】View 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