[net.emacs] GNU Emacs reference card

nz@wucs.UUCP (Neal Ziring) (08/24/85)

	Below is the troff source for a GNU Emacs quick reference
card.  It prints best on an Imagen laser printer driven by ditroff,
but should work ok on any type-setter-like device (maybe with some
point-size or vertical-spacing changes).

	The source below is for the standard GNU keymap.  Everybody
customizes the keymap, so you may want to changes some of the command
key names.

	To format the document, run this command sequence:

		tbl card.tr | ditroff -Pyour-sites-device

	This should
produce six pages, each containing one narrow column of text.
You can then post it as a wall chart, or paste it together and 
photo-reduce it onto an 8-1/2 by 11 sheet of paper.  We use
5 inches per column, and a reduction of to 72% of original size.

	Gemacs users here at Wash. U. like having a handy reference
card, even bigger than the one Vi fans use.

========
...nz (ECL - we're here to provide superior computing)
	Washington University Engineering Computer Laboratory

    "Now we'll see some proper action..." 

	old style:	... ihnp4!wucs!nz
	new style:	nz@wucs.UUCP

----------------- clip here -------------------
.ds CH
.ds CF
.\" define help character
.ds HC C-h
.nr PS 9
.ps 9
.nr VS 11
.vs 11
.nr HM .50i
.nr FM .25i
.nr PO 0.6i
.po 0.6i
.nr LL 4i
.ll 4i
.de hD 
'sp |0.5i
..
.de fO
'bp
..
.wh 0 hD
.wh -0.2i fO
.de nc
.bp
..
.de LG
.ps +2
..
.de SM
.ps -2
..
.de B
.ft B
..
.de I
.ft I
..
.de R
.ft R
..
.de h
.LG
.B
\\$1
.R
.SM
..
.fi
.\" side 1
.ne 0.2i
.LG
.LG
.B
.ce
GNU Emacs Quick Reference
.sp 0.5
.I
.SM
.ce
(version 16.56)
.sp 1.25
.R
.SM
Emacs (\fBE\fR-maks) \- full-screen real-time text editor
.sp 1.25
.h "Entering and Leaving GNU Emacs"
.sp 0.5
.in +2n
\fRgemacs\fI file ...
.br
\fRgemacs\fI -l Elisp-file file ...
.br
\fRgemacs\fI -batch -l Elisp-file\fR
.sp 0.25
^Z          Stop Emacs for later resumption
.sp 0.25
^X ^C	    Quit Emacs and return to shell
.R
.in -2n
.sp 1
.TS
lp+2fB s
a l.
GNU EMACS CONCEPTS
.sp 0.5
Insertion	T{
.na
.ll 2.8i
You are always in 
insert mode in Emacs.
Ordinary text is inserted
as soon as it is typed.
T}
.sp 0.5
Commands	T{
.na
.ll 2.8i
Emacs commands are invoked by
typing sequences of control 
characters.  Control
chars are written \fIC-x\fP,
escape sequences \fIESC x\fP.
T}
.sp 0.5
Buffer 	T{
.na
.ll 2.8i
A block of 
text that you may 
examine and modify
in the editor.
T}
.sp 0.5
Window	T{
.na
.ll 2.8i
A display area on the screen.
A buffer is displayed for editing
in one or more windows.
T}
.sp 0.5
File	T{
.na
.ll 2.8i
A block of text that can be read into
a buffer or written from a buffer.
T}
.sp 0.5
Kills	T{
.na
.ll 2.8i
Text that is \fIkilled\fP is placed
in a special kill-buffer.  
Killed text can be retrieved with a \fIyank\fP.
The most recent sixteen kills are kept in the \fIkill-ring\fP.
T}
.sp 0.5
Dot	T{
.na
.ll 2.8i
The current cursor location 
in each buffer is called the \fIdot\fP
or the \fIpoint\fP.
T}
.sp 0.5
Mark	T{
.na
.ll 2.8i
The \fImark\fP is an invisible pointer in
each buffer.
It is set by many commands to the
location where they were performed.
T}
.sp 0.5
Region	T{
.na
.ll 2.8i
Text between the \fIdot\fR
and the \fImark\fR is called the
\fIregion\fP.
T}
.sp 0.5
Registers	T{
.na
.ll 2.8i
Emacs supports a set of 26
general registers, named \fIa\fR
through \fIz\fR.  Registers may hold
commands, locations, numbers, or text.
T}
.sp 0.5
Modes	T{
.na
.ll 2.8i
Every buffer has a mode.
\fIMajor\fP modes determine the editor's 
language-sensitive behavior
and define special mode commands.
\fIMinor\fP modes add special features
without adding new commands.
T}
.sp 0.25
.TE
.sp 1
.TS
expand;
lp+2fB s
a  l
l  s
afB l.
GETTING HELP
.sp 0.25
\*(HC 	Invoke the self-documenter
.sp 0.25
T{
.na
.ll 3.9i
.in +1n
The self-documenter function will prompt
for a help command.  Most help commands
ask for a name or character, which they
will then describe for you.  Useful help
commands are listed below.
.in -1n
.ad
T}
.sp 0.25
a	document functions apropos a word
b	list all global key bindings
c	describe a key sequence briefly
f	describe a function
k	describe a key sequence completely	
l	show last 100 characters typed
m	tell what this major mode is
?	show list of help commands
i	invoke Info documentation reader
v	describe a variable
.TE
.bp
.ne 0.3i
.\" side 1 column 2
.TS 
lp+2fB s
a l
a l
l s.
SPECIFYING YOUR TERMINAL TYPE
.sp 0.25
setenv TERM \fItype\fR	  in \fIcsh\fR
TERM=\fItype\fR ; export TERM	  in \fIsh\fR
.sp 0.25
\ see also \fItset(1)\fR and \fIenviron(7)\fR
.TE
.sp 1
.TS
lp+2fB s s s
ae le le le.
SOME TERMINALS GNU EMACS CAN USE
.sp 0.25
4014	concept100	graphon132	vt220
925	ergo201	h1500	vt52
act5	ergo301	hp2626	wumime
adm3a	ergox	mime2a	wy50
adm5	gigi	visual550	xmime
bbnbg	graphon	vt100	
.TE
.sp 1
.TS
lp+2fB s
a l.
VARIABLES AND OPTIONS
.sp 0.25
\*(HC\  v	T{
.na
.ll 2.5i
Describe a variable.
The variable's value 
and description will
be displayed.
.ad
T}
.sp 0.25
ESC x set-var	T{
.na
.ll 2.5i
Set a variable to a value,
you will be prompted for
the variable name and new 
value.
.ad
T}
.sp 0.25
ESC x edit-opt	T{
.na
.ll 2.5i
Open a buffer to view and set
options interactively.
T}
.TE
.sp 0.75
.ti 5n
.fi
GNU Emacs maintains a large number of
variables that define many of its
operating characteristics.  You
can examine and modify these variables
using the commands given above.
.sp 1
.TS
expand;
lp+2fB s s
c c c
c c c
a l l.
USEFUL VARIABLES
.sp 0.25
Variable	Initial	Description
Name	Value
.sp 0.25
auto-save-default	t	auto-save files
auto-save-interval	300	chars between saves
blink-matching-par	t	show paren matches
c-indent-level	2	C statement indent
c-label-offset	-2	relative label indent
case-fold-search	t	searchs ignore case
case-replace	t	replace preserves case
comment-column	32	column to start comments
comment-start	None	string to start comments
fill-column	t	fill text to column
indent-tabs mode	t	indent can use tabs
scroll-step	0	scroll by when moving
tab-width	8	size of tab stop
.TE
.sp 1
.TS
expand;
lp+2fB s
l s
l s
l s
ae le.
REGULAR EXPRESSIONS
.sp 0.25
.in +2n
Some Emacs commands use regular expressions
for string pattern matching.  Common commands
that use this are the following.
.in -2n
.sp 0.5
isearch-backward-regexp	replace-regexp
isearch-forward-regexp	query-replace-regexp
command-apropos
.sp 0.75
.TE
.TS
expand;
l s
l s
ap+2fI l
afI l.
.in +2n
The following primatives are recognized by the Emacs
pattern matcher.
.in -2n
.sp 0.25
\ ^	beginning of line
\ .	any character
\ $	end of line
[str]	any char in \fIstr\fR
[^str]	...not in \fIstr\fR
[X-Y]	...in range \fIX\fR to \fIY\fR
\ *	zero or more of preceding regexp
\ +	one or more of preceding regexp
\e|	alternation of two patterns
\e(\  \e)	parentheses for expression grouping
.TE
.bp
.\" side 1 column 3
\" .ne 0.2i
.TS
expand;
lp+2fB s
a l.
THE DISPLAY
.sp 0.25
Text Area	T{
.na
.ll 2.8i
A view onto a text buffer.
.br
Each window has its own text area.
Your display always has at least
one text area on it.
T}
.sp 0.25
Mode Line	T{
.na
.ll 2.8i
Status line displayed at the bottom of a window.
.br
The mode line
displays the current buffer name, major and minor
editing modes, and current location in the file.
The variable \fImode-line-format\fP defines the contents
and layout of the mode line.
T}
.sp 0.25
Echo Area	T{
.na
.ll 2.8i
A one-line area at the bottom of the screen.
.br
Error messages and progress messages are displayed
in the echo area.
This area is also called the \fImini-buffer\fP,
because Emacs command prompts and your responses are typed there.
.ad
T}
.TE
.sp 1
.TS
expand;
lp+2fB s
a l
l s
a l.
QUERY REPLACE
.sp 0.25
ESC %	Invoke interactive replacement
.sp 0.5
T{
.na
.in +2n
.ll 3.5i
Query-replace will prompt you for a string
and another string with which to replace it.
Replacement proceeds from the current location (dot)
to the end of the buffer.
The following query responses are recognized.
.in -2n
.ad
T}
.sp 0.5
space	replace this match
DEL	skip to next match
ESC	exit query replace
\ .	replace this match and exit
C-R	enter recursive edit
C-W	delete match and recursive edit
\ !	replace all remaining matches
\ ^	move back to previous match
.TE
.sp 1
.TS
expand;
lp+2fB l
l s.
WRITING NEW COMMANDS
.sp 0.25
T{
.na
.in +2n
.ll 3.5i
New commands can be written by performing them
as keyboard macros, then saving the keyboard macros
in a file as Elisp code.  You may also write Elisp
code directly (using \fIemacs-lisp\fR mode).
The functions below are useful for writing and saving your own
new commands.  They are invoked with\ \ ESC x \fIcommand\fP.
.in -2n
.ad
T}
.TE
.sp 0.5
.TS
expand;
a r.
append-kbd-macro	append macro to Elisp file
end-kbd-macro	finish macro definition
kbd-macro-query	wait for user response in a macro
name-last-kbd-macro	give defined macro a name
start-kbd-macro	begin macro definition
write-kbd-macro	write named macro to Elisp file
.TE
.sp 1
.TS
expand;
lp+2fB s
l s
a r.
RE-DEFINING COMMAND KEYS
.sp 0.25
T{
.in +2n
.ll 3.5i
Command keys may be re-defined globally, or
just for the current buffer.  
The following
functions are useful for re-defining command
keys.
These commands may be invoked with ESC x \fIcommand\fP.
T}
.sp 0.5
describe-key	tell what a key does
global-set-key	define \fIkey\fP to execute \fIfunction\fP
global-unset-key	undefine \fIkey\fP in all buffers
local-set-key	define \fIkey\fP as \fIfunction\fP in this buffer
local-unset-key	undefine \fIkey\fP in this buffer
.sp 0.25
define-key	general key definition command
make-sparse-keymap	create a new, empty, key map
use-local-map	use a new local keymap for this buffer
.TE
.bp
.\" side 2 column 1
.ne 0.2i
.LG
.LG
.B
.ce
GNU Emacs Command Reference
.sp 0.5
.I
.SM
.ce
(version 16.56)
.R
.SM
.sp 1.25
.TS
expand;
lp+2fB s
a l.
CONTROL SEQUENCES
.sp 0.25
C-\fIx\fR	control char
 	hold CTRL and type \fIx\fR
.sp 0.25
ESC \fIx\fR	meta char
 	type ESC then type \fIx\fR
.sp 0.25
ESC C-\fIx\fR	control-meta char
 	type ESC, then type C-\fIx\fR
.sp 0.25
C-x \fIx\fR	ctrl-x char
 	type C-x then type \fIx\fR.
.T&
lp+2fB s
a l.
.sp 1
SIMPLE MOTION
.sp 0.25
C-a	beginning-of-line
C-b	backward-char
C-e	end-of-line
C-f	forward-char
Tab	tab-to-tab-stop
C-j	newline-and-indent
Return	newline
C-n	next-line
C-o	open-line
C-p	previous-line
DEL	delete-backward-char
ESC #	goto-line
ESC <	beginning-of-buffer
ESC >	end-of-buffer
.T&
lp+2fB s
a l.
.sp 1
SCROLLING
.sp 0.25
C-v	scroll-up
C-x <	scroll-left
C-x >	scroll-right
ESC C-v	scroll-other-window
ESC v	scroll-down
.T&
lp+2fB s
a l.
.sp 1
TEXT MOTION
.sp 0.25
C-x [	backward-page
C-x ]	forward-page
ESC [	backward-paragraph
ESC ]	forward-paragraph
ESC a	backward-sentence
ESC b	backward-word
ESC e	forward-sentence
ESC f	forward-word
.T&
lp+2fB s
a l.
.sp 1
TRANSPOSITION
.sp 0.25
C-t	transpose-chars
C-x C-t	transpose-lines
ESC C-t	transpose-sexps
ESC t	transpose-words
.T&
lp+2fB s
a l.
.sp 1
QUERIES AND FIXES 
.sp 0.25
C-g	Cancel immediately
C-l	recenter (and fix screen)
\*(HC	help-command
C-q	quoted-insert
C-x =	what-cursor-position
C-x l	count-lines-page
C-x u	advertised-undo
C-]	abort-recursive-edit
ESC =	count-lines-region
.\" side 2 column 2
.TE
.bp
.TS
expand;
lp+2fB s
a l.
.sp 1
DELETES, KILLS, AND YANKS
.sp 0.25
C-d	delete-char
C-k	kill-line
C-w	kill-region
C-y	yank
DEL	delete-backward-char
C-x C-o	delete-blank-lines
C-x DEL	backward-kill-sentence
ESC C-w	append-next-kill
ESC \e	delete-horizontal-space
ESC ^	delete-indentation
ESC d	kill-word
ESC k	kill-sentence
ESC w	copy-region-as-kill
ESC y	yank-pop
ESC z	zap-to-char
ESC DEL	backward-kill-word
.T&
lp+2fB s
a l.
.sp 1
BUFFERS
.sp 0.25
C-x C-b	list-buffers
C-x C-f	find-file
C-x C-s	save-buffer
C-x a	append-to-buffer
C-x b	switch-to-buffer
C-x h	mark-whole-buffer
C-x k	kill-buffer
C-x n	narrow-to-region
C-x s	save-some-buffers
C-x w	widen
C-x 4 b	pop-to-buffer
ESC ~	not-modified
.T&
lp+2fB s
a l.
.sp 1
WINDOWS
.sp 0.25
C-x 0	delete-window
C-x 1	delete-other-windows
C-x 2	split-window-vertically
C-x 5	split-window-horizontally
C-x ^	enlarge-window
C-x o	other-window
ESC C-v	scroll-other-window
C-x 4 C-f	find-file-other-window
.T&
lp+2fB s
a l.
.sp 1e
FILES
.sp 0.25
C-x C-f	find-file
C-x C-r	find-file-read-only
C-x C-v	find-alternate-file
C-x C-w	write-file
C-x i	insert-file
.T&
lp+2fB s
a l.
.sp 1
SEARCHING
.sp 0.25
C-s	isearch-forward
C-r	isearch-backward
ESC %	query-replace
ESC h	isearch-forward-regexp
ESC r	isearch-backward-regexp
.T&
lp+2fB s
a l.
.sp 1
LISP COMMANDS
.sp 0.25
ESC C-a	beginning-of-defun
ESC C-b	backward-sexp
ESC C-e	end-of-defun
ESC C-f	forward-sexp
ESC C-h	mark-defun
ESC C-k	kill-sexp
ESC (	insert-parentheses
ESC )	move-past-close-and-reindent
.TE
.bp
.TS
expand;
lp+2fB s
a l.
.sp 1
CASE CHANGES
.sp 0.25
C-x C-l	downcase-region
C-x C-u	upcase-region
ESC c	capitalize-word
ESC l	downcase-word
ESC u	upcase-word
.T&
lp+2fB s
a l.
.sp 0.5
FILLING AND CENTERING
.sp 0.25
C-x f	set-fill-column
C-x .	set-fill-prefix
ESC q	fill-paragraph
ESC s	center-line
.T&
lp+2fB s
a l.
.sp 1
MARKS AND REGISTERS
.sp 0.25
C-@	set-mark-command
C-x C-p	mark-page
C-x C-x	exchange-dot-and-mark
C-x /	dot-to-register
C-x g	insert-register
C-x h	mark-whole-buffer
C-x j	register-to-dot
C-x r	copy-rectangle-to-register
C-x x	copy-to-register
ESC C-@	mark-sexp
ESC C-h	mark-defun
ESC @	mark-word
.T&
lp+2fB s
a l.
.sp 1
MACROS AND REPETITION
.sp 0.25
C-u	Universal-argument
C-x (	start-kbd-macro
C-x )	end-kbd-macro
C-x e	execute-kbd-macro
C-x q	query-kbd-macro
ESC -	negative-argument
ESC 0 .. ESC 9	digit-argument
.T&
lp+2fB s
a l.
.sp 1
FUNCTION INVOKATION
.sp 0.25
C-x C-e	eval-last-sexp
C-x ESC	repeat-complex-command
ESC ESC	eval-expression
ESC x	execute-extended-command
.T&
lp+2fB s
a l.
.sp 1
SHELLS AND SUBSYSTEMS
.sp 0.25
C-x d	dired (edit directory)
C-x m	mail
ESC !	shell-command
ESC |	shell-command-on-region
ESC $	spell-word
.T&
lp+2fB s
a l.
.sp 1
EXIT
.sp 0.25
C-c	exit-recursive-edit
C-x C-c	save-buffers-kill-emacs
C-x C-z	suspend-emacs
ESC C-c	exit-recursive-edit
.TE
.sp 1
.TS
expand;
lp+2fB s
l s
a l.
Some Editing Modes
.sp 0.25
\ (invoke with  ESC x \fImode-name\fR)
.sp 0.25
abbrev-mode	auto-fill-mode
c-mode	text-mode
fundamental-mode	lisp-interaction-mode	      
lisp-mode	nroff-mode		      
outline-mode	overwrite-mode		      
picture-mode	scheme-mode
.TE