Merge from emacs--rel--22
[bpt/emacs.git] / etc / refcards / survival.tex
1 %&tex
2 %
3 % Title: GNU Emacs Survival Card
4 % Author: Wlodek Bzyl <matwb@univ.gda.pl>
5 %
6 %**start of header
7
8 % User interface is `plain.tex' and macros described below
9 %
10 % \title{CARD TITLE}{for version 21}
11 % \section{NAME}
12 % optional paragraphs separated with \askip amount of vertical space
13 % \key{KEY-NAME} description of key or
14 % \mkey{M-x LONG-LISP-NAME} description of Elisp function
15 %
16 % \kbd{ARG} -- argument is typed literally
17
18 \def\plainfmtname{plain}
19 \ifx\fmtname\plainfmtname
20 \else
21 \errmessage{This file requires `plain' format to be typeset correctly}
22 \endinput
23 \fi
24
25 % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
26 % a landscape layout.
27
28 \input pdflayout.sty
29 \pdflayout=(1)
30
31 % Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005,
32 % 2006, 2007 Free Software Foundation, Inc.
33
34 % This file is part of GNU Emacs.
35
36 % GNU Emacs is free software; you can redistribute it and/or modify
37 % it under the terms of the GNU General Public License as published by
38 % the Free Software Foundation; either version 3, or (at your option)
39 % any later version.
40
41 % GNU Emacs is distributed in the hope that it will be useful,
42 % but WITHOUT ANY WARRANTY; without even the implied warranty of
43 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 % GNU General Public License for more details.
45
46 % You should have received a copy of the GNU General Public License
47 % along with GNU Emacs; see the file COPYING. If not, write to
48 % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
49 % Boston, MA 02110-1301, USA.
50
51 \def\versionnumber{1.0}
52 \def\versionemacs{21}
53 \def\year{2007} % latest copyright year
54
55 \def\copyrightnotice{\penalty-1\vfill
56 \vbox{\smallfont\baselineskip=0.8\baselineskip\raggedcenter
57 Copyright \year\ Free Software Foundation, Inc.\break
58 Version \versionnumber{} for GNU Emacs \versionemacs, April 2000\break
59 Project W{\l}odek Bzyl (matwb@univ.gda.pl)
60
61 Permission is granted to make and distribute copies of
62 this card provided the copyright notice and this permission notice
63 are preserved on all copies.\par}}
64
65 \hsize 3.2in
66 \vsize 7.95in
67 \font\titlefont=cmss10 scaled 1200
68 \font\headingfont=cmss10
69 \font\smallfont=cmr6
70 \font\smallsy=cmsy6
71 \font\eightrm=cmr8
72 \font\eightbf=cmbx8
73 \font\eightit=cmti8
74 \font\eighttt=cmtt8
75 \font\eightmi=cmmi8
76 \font\eightsy=cmsy8
77 \font\eightss=cmss8
78 \textfont0=\eightrm
79 \textfont1=\eightmi
80 \textfont2=\eightsy
81 \def\rm{\eightrm} \rm
82 \def\bf{\eightbf}
83 \def\it{\eightit}
84 \def\tt{\eighttt}
85 \def\ss{\eightss}
86 \baselineskip=0.8\baselineskip
87
88 \newdimen\intercolumnskip % horizontal space between columns
89 \intercolumnskip=0.5in
90
91 % The TeXbook, p. 257
92 \let\lr=L \newbox\leftcolumn
93 \output={\if L\lr
94 \global\setbox\leftcolumn\columnbox \global\let\lr=R
95 \else
96 \doubleformat \global\let\lr=L\fi}
97 \def\doubleformat{\shipout\vbox{\makeheadline
98 \leftline{\box\leftcolumn\hskip\intercolumnskip\columnbox}
99 \makefootline}
100 \advancepageno}
101 \def\columnbox{\leftline{\pagebody}}
102
103 \def\newcolumn{\vfil\eject}
104
105 \def\bye{\par\vfil\supereject
106 \if R\lr \null\vfil\eject\fi
107 \end}
108
109 \outer\def\title#1#2{{\titlefont\centerline{#1}}\vskip 1ex plus 0.5ex
110 \centerline{\ss#2}
111 \vskip2\baselineskip}
112
113 \outer\def\section#1{\filbreak
114 \bskip
115 \leftline{\headingfont #1}
116 \askip}
117 \def\bskip{\vskip 2.5ex plus 0.25ex }
118 \def\askip{\vskip 0.75ex plus 0.25ex}
119
120 \newdimen\defwidth \defwidth=0.25\hsize
121 \def\hang{\hangindent\defwidth}
122
123 \def\textindent#1{\noindent\llap{\hbox to \defwidth{\tt#1\hfil}}\ignorespaces}
124 \def\key{\par\hangafter=0\hang\textindent}
125
126 \def\mtextindent#1{\noindent\hbox{\tt#1\quad}\ignorespaces}
127 \def\mkey{\par\hangafter=1\hang\mtextindent}
128
129 \def\kbd#{\bgroup\tt \let\next= }
130
131 \newdimen\raggedstretch
132 \newskip\raggedparfill \raggedparfill=0pt plus 1fil
133 \def\nohyphens
134 {\hyphenpenalty10000\exhyphenpenalty10000\pretolerance10000}
135 \def\raggedspaces
136 {\spaceskip=0.3333em\relax
137 \xspaceskip=0.5em\relax}
138 \def\raggedright
139 {\raggedstretch=6em
140 \nohyphens
141 \rightskip=0pt plus \raggedstretch
142 \raggedspaces
143 \parfillskip=\raggedparfill
144 \relax}
145 \def\raggedcenter
146 {\raggedstretch=6em
147 \nohyphens
148 \rightskip=0pt plus \raggedstretch
149 \leftskip=\rightskip
150 \raggedspaces
151 \parfillskip=0pt
152 \relax}
153
154 \chardef\\=`\\
155
156 \raggedright
157 \nopagenumbers
158 \parindent 0pt
159 \interlinepenalty=10000
160 \hoffset -0.2in
161 %\voffset 0.2in
162
163 %**end of header
164 \f
165
166 \title{GNU\ \ Emacs\ \ Survival\ \ Card}{for version \versionemacs}
167
168 In the following, \kbd{C-z} means hit the `\kbd{z}' key while
169 holding down the {\it Ctrl}\ \ key. \kbd{M-z} means hit the
170 `\kbd{z}' key while hitting the {\it Meta\/} (labeled {\it Alt\/}
171 on some keyboards) or after hitting {\it Esc\/} key.
172
173 \section{Running Emacs}
174
175 To enter GNU Emacs, just type its name: \kbd{emacs}.
176 Emacs divides the frame into several areas:
177 menu line,
178 buffer area with the edited text,
179 mode line describing the buffer in the window above it,
180 and a minibuffer/echo area in the last line.
181 \askip
182 \key{C-x C-c} quit Emacs
183 \key{C-x C-f} edit file; this command uses the minibuffer to read
184 the file name; use this to create new files by entering the name
185 of the new file
186 \key{C-x C-s} save the file
187 \key{C-x k} kill a buffer
188 \key{C-g} in most context: cancel, stop, abort partially typed or
189 executing command
190 \key{C-x u} undo
191
192 \section{Moving About}
193
194 \key{C-l} scroll current line to center of window
195 \key{C-x b} switch to another buffer
196 \key{M-<} move to beginning of buffer
197 \key{M->} move to end of buffer
198 \key{M-x goto-line} go to a given line number
199
200 \section{Multiple Windows}
201
202 \key{C-x 0} remove the current window from the display
203 \key{C-x 1} make active window the only window
204 \key{C-x 2} split window horizontally
205 \key{C-x 3} split window vertically
206 \key{C-x o} move to other window
207
208 \section{Regions}
209
210 Emacs defines a `region' as the space between the {\it mark\/} and
211 the {\it point}. A mark is set with \kbd{C-{\it space}}.
212 The point is at the cursor position.
213 \askip
214 \key{M-h} mark entire paragraph
215 \key{C-x h} mark entire buffer
216
217 \section{Killing and Copying}
218
219 \key{C-w} kill region
220 \key{M-w} copy region to kill-ring
221 \key{C-k} kill from the cursor all the way to the end of the line
222 \key{M-DEL} kill word
223 \key{C-y} yank back the last kill (\kbd{C-w C-y} combination could be
224 used to move text around)
225 \key{M-y} replace last yank with previous kill
226
227 \section{Searching}
228
229 \key{C-s} search for a string
230 \key{C-r} search for a string backwards
231 \key{RET} quit searching
232 \key{M-C-s} regular expression search
233 \key{M-C-r} reverse regular expression search
234 \askip
235 Use \kbd{C-s} or \kbd{C-r} again to repeat the search in either direction.
236
237 \section{Tags}
238
239 Tags tables files record locations of function and
240 procedure definitions, global variables, data types and anything
241 else convenient. To create a tags table file, type
242 `{\tt etags} {\it input\_files}' as a shell command.
243 \askip
244 \key{M-.} find a definition
245 \key{C-u M-.} find next occurrence of definition
246 \key{M-*} pop back to where \kbd{M-.} was last invoked
247 \mkey{M-x tags-query-replace} run query-replace on all files
248 recorded in tags table
249 \key{M-,} continue last tags search or query-replace
250
251 \section{Compiling}
252
253 \key{M-x compile} compile code in active window
254 \key{C-c C-c} go to the next compiler error, when in
255 the compile window or
256 \key{C-x `} when in the window with source code
257
258 \section{Dired, the Directory Editor}
259
260 \key{C-x d} invoke Dired
261 \key{d} flag this file for deletion
262 \key{\~{}} flag all backup files for deletion
263 \key{u} remove deletion flag
264 \key{x} delete the files flagged for deletion
265 \key{C} copy file
266 \key{g} update the Dired buffer
267 \key{f} visit the file described on the current line
268 \key{s} switch between alphabetical date/time order
269
270 \section{Reading and Sending Mail}
271
272 \key{M-x rmail} start reading mail
273 \key{q} quit reading mail
274 \key{h} show headers
275 \key{d} mark the current message for deletion
276 \key{x} remove all messages marked for deletion
277
278 \key{C-x m} begin composing a message
279 \key{C-c C-c} send the message and switch to another buffer
280 \key{C-c C-f C-c} move to the `CC' header field, creating one
281 if there is none
282
283 \section{Miscellaneous}
284
285 \key{M-q} fill paragraph
286 \key{M-/} expand previous word dynamically
287 \key{C-z} iconify (suspend) Emacs when running it under X or
288 shell, respectively
289 \mkey{M-x revert-buffer} replace the text being edited with the
290 text of the file on disk
291
292 \section{Query Replace}
293
294 \key{M-\%} interactively search and replace
295 \key{M-C-\%} using regular expressions
296 \askip
297 Valid responses in query-replace mode are
298 \askip
299 \key{SPC} replace this one, go on to next
300 \key{,} replace this one, don't move
301 \key{DEL} skip to next without replacing
302 \key{!} replace all remaining matches
303 \key{\^{}} back up to the previous match
304 \key{RET} exit query-replace
305 \key{C-r} enter recursive edit (\kbd{M-C-c} to exit)
306
307 \section{Regular Expressions}
308
309 \key{. {\rm(dot)}} any single character except a newline
310 \key{*} zero or more repeats
311 \key{+} one or more repeats
312 \key{?} zero or one repeat
313 \key{[$\ldots$]} denotes a class of character to match
314 \key{[\^{}$\ldots$]} negates the class
315
316 \key{\\{\it c}} quote characters otherwise having a special
317 meaning in regular expressions
318
319 \key{$\ldots$\\|$\ldots$\\|$\ldots$} matches one of
320 the alternatives (``or'')
321 \key{\\( $\ldots$ \\)} groups a series of pattern elements to
322 a single element
323 \key{\\{\it n}} same text as {\it n\/}th group
324
325 \key{\^{}} matches at line beginning
326 \key{\$} matches at line end
327
328 \key{\\w} matches word-syntax character
329 \key{\\W} matches non-word-syntax character
330 \key{\\<} matches at word beginning
331 \key{\\>} matches at word end
332 \key{\\b} matches at word break
333 \key{\\B} matches at non-word break
334
335 \section{Registers}
336
337 \key{C-x r s} save region in register
338 \key{C-x r i} insert register contents into buffer
339
340 \key{C-x r SPC} save value of point in register
341 \key{C-x r j} jump to point saved in register
342
343 \section{Rectangles}
344
345 \key{C-x r r} copy rectangle to register
346 \key{C-x r k} kill rectangle
347 \key{C-x r y} yank rectangle
348 \key{C-x r t} prefix each line with a string
349
350 \key{C-x r o} open rectangle, shifting text right
351 \key{C-x r c} blank out rectangle
352
353 \section{Shells}
354
355 \key{M-x shell} start a shell within Emacs
356 \key{M-!} execute a shell command
357 \key{M-|} run a shell command on the region
358 \key{C-u M-|} filter region through a shell command
359
360 \section{Spelling Check}
361
362 \key{M-\$} check spelling of word at the cursor
363 \mkey{M-x ispell-region} check spelling of all words in region
364 \mkey{M-x ispell-buffer} check spelling of entire buffer
365
366 \section{International Character Sets}
367
368 \key{C-x RET C-\\} select and activate input method for
369 the current buffer
370 \key{C-\\} enable or disable input method
371 \mkey{M-x list-input-methods} show all input methods
372 \mkey{M-x set-language-environment} specify principal language
373
374 \key{C-x RET c} set coding system for next command
375 \mkey{M-x find-file-literally} visit file with no conversion
376 of any kind
377
378 \mkey{M-x list-coding-systems} show all coding systems
379 \mkey{M-x prefer-coding-system} choose preferred coding system
380
381 \section{Keyboard Macros}
382
383 \key{C-x (} start defining a keyboard macro
384 \key{C-x )} end keyboard macro definition
385 \key{C-x e} execute last-defined keyboard macro
386 \key{C-u C-x (} append to last keyboard macro
387 \mkey{M-x name-last-kbd-macro} name last keyboard macro
388
389 \section{Simple Customization}
390
391 \key{M-x customize} customize variables and faces
392
393 \section{Getting Help}
394
395 Emacs does command completion for you. Typing \kbd{M-x}
396 {\it tab\/} or {\it space\/} gives a list of Emacs commands.
397 \askip
398 \key{C-h} Emacs help
399 \key{C-h t} run the Emacs tutorial
400 \key{C-h i} enter Info, the documentation browser
401 \key{C-h a} show commands matching a string (apropos)
402 \key{C-h k} display documentation of the function invoked by
403 keystroke
404 \askip
405 Emacs gets into different {\it modes}, each of which customizes
406 Emacs for editing text of a particular sort. The mode line
407 contains names of the current modes, in parentheses.
408 \askip
409 \key{C-h m} get mode-specific information
410
411 \copyrightnotice
412
413 \bye
414 \f
415 % Local variables:
416 % compile-command: "pdftex survival"
417 % End:
418
419 % arch-tag: 4f9a0562-617b-4843-aee1-450c41d6b22c