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