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