* lisp/comint.el (comint-mode): Doc fix. (Bug#7897)
[emacs.git] / etc / refcards / survival.tex
blob2d2bff576f2a588b14babc1e743778bb3c5a93a9
1 %&tex
2 % Title: GNU Emacs Survival Card
4 % Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
5 % 2009, 2010, 2011 Free Software Foundation, Inc.
7 % Author: Wlodek Bzyl <matwb@univ.gda.pl>
9 % This file is part of GNU Emacs.
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.
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.
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/>.
24 %**start of header
26 % User interface is `plain.tex' and macros described below
28 % \title{CARD TITLE}{for version 23}
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
34 % \kbd{ARG} -- argument is typed literally
36 \def\plainfmtname{plain}
37 \ifx\fmtname\plainfmtname
38 \else
39 \errmessage{This file requires `plain' format to be typeset correctly}
40 \endinput
41 \fi
43 % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
44 % a landscape layout.
45 \input pdflayout.sty
46 \pdflayout=(1)
48 \def\versionemacs{23} % version of Emacs this is for
49 \def\year{2011} % latest copyright year
51 \def\copyrightnotice{\penalty-1\vfill
52 \vbox{\smallfont\baselineskip=0.8\baselineskip\raggedcenter
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)
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}}
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
84 \newdimen\intercolumnskip % horizontal space between columns
85 \intercolumnskip=0.5in
87 % The TeXbook, p. 257
88 \let\lr=L \newbox\leftcolumn
89 \output={\if L\lr
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}}
99 \def\newcolumn{\vfil\eject}
101 \def\bye{\par\vfil\supereject
102 \if R\lr \null\vfil\eject\fi
103 \end}
105 \outer\def\title#1#2{{\titlefont\centerline{#1}}\vskip 1ex plus 0.5ex
106 \centerline{\ss#2}
107 \vskip2\baselineskip}
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}
116 \newdimen\defwidth \defwidth=0.25\hsize
117 \def\hang{\hangindent\defwidth}
119 \def\textindent#1{\noindent\llap{\hbox to \defwidth{\tt#1\hfil}}\ignorespaces}
120 \def\key{\par\hangafter=0\hang\textindent}
122 \def\mtextindent#1{\noindent\hbox{\tt#1\quad}\ignorespaces}
123 \def\mkey{\par\hangafter=1\hang\mtextindent}
125 \def\kbd#{\bgroup\tt \let\next= }
127 \newdimen\raggedstretch
128 \newskip\raggedparfill \raggedparfill=0pt plus 1fil
129 \def\nohyphens
130 {\hyphenpenalty10000\exhyphenpenalty10000\pretolerance10000}
131 \def\raggedspaces
132 {\spaceskip=0.3333em\relax
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}
150 \chardef\\=`\\
152 \raggedright
153 \nopagenumbers
154 \parindent 0pt
155 \interlinepenalty=10000
156 \hoffset -0.2in
157 %\voffset 0.2in
159 %**end of header
162 \title{GNU\ \ Emacs\ \ Survival\ \ Card}{for version \versionemacs}
164 In the following, \kbd{C-z} means hit the `\kbd{z}' key while
165 holding down the {\it Ctrl}\ \ key. \kbd{M-z} means hit the
166 `\kbd{z}' key while hitting the {\it Meta\/} (labeled {\it Alt\/}
167 on some keyboards) or after hitting {\it Esc\/} key.
169 \section{Running Emacs}
171 To enter GNU Emacs, just type its name: \kbd{emacs}.
172 Emacs divides the frame into several areas:
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
185 executing command
186 \key{C-x u} undo
188 \section{Moving About}
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
194 \key{M-g M-g} go to a given line number
196 \section{Multiple Windows}
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
204 \section{Regions}
206 Emacs defines a `region' as the space between the {\it mark\/} and
207 the {\it point}. A mark is set with \kbd{C-{\it space}}.
208 The point is at the cursor position.
209 \askip
210 \key{M-h} mark entire paragraph
211 \key{C-x h} mark entire buffer
213 \section{Killing and Copying}
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
223 \section{Searching}
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
231 Use \kbd{C-s} or \kbd{C-r} again to repeat the search in either direction.
233 \section{Tags}
235 Tags tables files record locations of function and
236 procedure definitions, global variables, data types and anything
237 else convenient. To create a tags table file, type
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
247 \section{Compiling}
249 \key{M-x compile} compile code in active window
250 \key{C-c C-c} go to the next compiler error, when in
251 the compile window or
252 \key{C-x `} when in the window with source code
254 \section{Dired, the Directory Editor}
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
266 \section{Reading and Sending Mail}
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
274 \key{C-x m} begin composing a message
275 \key{C-c C-c} send the message and switch to another buffer
276 \key{C-c C-f C-c} move to the `CC' header field, creating one
277 if there is none
279 \section{Miscellaneous}
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
288 \section{Query Replace}
290 \key{M-\%} interactively search and replace
291 \key{M-C-\%} using regular expressions
292 \askip
293 Valid 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)
303 \section{Regular Expressions}
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
312 \key{\\{\it c}} quote characters otherwise having a special
313 meaning in regular expressions
315 \key{$\ldots$\\|$\ldots$\\|$\ldots$} matches one of
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
321 \key{\^{}} matches at line beginning
322 \key{\$} matches at line end
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
331 \section{Registers}
333 \key{C-x r s} save region in register
334 \key{C-x r i} insert register contents into buffer
336 \key{C-x r SPC} save value of point in register
337 \key{C-x r j} jump to point saved in register
339 \section{Rectangles}
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
346 \key{C-x r o} open rectangle, shifting text right
347 \key{C-x r c} blank out rectangle
349 \section{Shells}
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
356 \section{Spelling Check}
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
362 \section{International Character Sets}
364 \key{C-x RET C-\\} select and activate input method for
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
370 \key{C-x RET c} set coding system for next command
371 \mkey{M-x find-file-literally} visit file with no conversion
372 of any kind
374 \mkey{M-x list-coding-systems} show all coding systems
375 \mkey{M-x prefer-coding-system} choose preferred coding system
377 \section{Keyboard Macros}
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
385 \section{Simple Customization}
387 \key{M-x customize} customize variables and faces
389 \section{Getting Help}
391 Emacs does command completion for you. Typing \kbd{M-x}
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
401 Emacs gets into different {\it modes}, each of which customizes
402 Emacs for editing text of a particular sort. The mode line
403 contains names of the current modes, in parentheses.
404 \askip
405 \key{C-h m} get mode-specific information
407 \copyrightnotice
409 \bye
411 % Local variables:
412 % compile-command: "pdftex survival"
413 % End: