2 % Title: GNU Emacs Survival Card
4 % Copyright (C) 2000-2018 Free Software Foundation, Inc.
6 % Author: Wlodek Bzyl <matwb@univ.gda.pl>
8 % This document is free software: you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation, either version 3 of the License, or
11 % (at your option) any later version.
13 % As a special additional permission, you may distribute reference cards
14 % printed, or formatted for printing, with the notice "Released under
15 % the terms of the GNU General Public License version 3 or later"
16 % instead of the usual distributed-under-the-GNU-GPL notice, and without
17 % a copy of the GPL itself.
19 % This document is distributed in the hope that it will be useful,
20 % but WITHOUT ANY WARRANTY; without even the implied warranty of
21 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 % GNU General Public License for more details.
24 % You should have received a copy of the GNU General Public License
25 % along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
29 % User interface is `plain.tex' and macros described below
31 % \title{CARD TITLE}{for version 23}
33 % optional paragraphs separated with \askip amount of vertical space
34 % \key{KEY-NAME} description of key or
35 % \mkey{M-x LONG-LISP-NAME} description of Elisp function
37 % \kbd{ARG} -- argument is typed literally
39 \def\plainfmtname{plain
}
40 \ifx\fmtname\plainfmtname
42 \errmessage{This file requires `plain' format to be typeset correctly
}
46 % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
53 \def\copyrightnotice{\penalty-
1\vfill
54 \vbox{\smallfont\baselineskip=
0.8\baselineskip\raggedcenter
55 Copyright
\copyright\
\year\ Free Software Foundation, Inc.
\break
56 For GNU Emacs version
\versionemacs\break
57 Author W
{\l}odek Bzyl (matwb@univ.gda.pl)
59 Released under the terms of the GNU General Public License
62 For more Emacs documentation, and the
\TeX{} source for this card,
63 see the Emacs distribution,
64 or
{\tt https://www.gnu.org/software/emacs
}\par}}
68 \font\titlefont=cmss10 scaled
1200
69 \font\headingfont=cmss10
87 \baselineskip=
0.8\baselineskip
89 \newdimen\intercolumnskip % horizontal space between columns
90 \intercolumnskip=
0.5in
93 \let\lr=L
\newbox\leftcolumn
95 \global\setbox\leftcolumn\columnbox \global\let\lr=R
97 \doubleformat \global\let\lr=L
\fi}
98 \def\doubleformat{\shipout\vbox{\makeheadline
99 \leftline{\box\leftcolumn\hskip\intercolumnskip\columnbox}
102 \def\columnbox{\leftline{\pagebody}}
104 \def\newcolumn{\vfil\eject}
106 \def\bye{\par\vfil\supereject
107 \if R
\lr \null\vfil\eject\fi
110 \outer\def\title#1#2{{\titlefont\centerline{#1}}\vskip 1ex plus
0.5ex
112 \vskip2\baselineskip}
114 \outer\def\section#1{\filbreak
116 \leftline{\headingfont #1}
118 \def\bskip{\vskip 2.5ex plus
0.25ex
}
119 \def\askip{\vskip 0.75ex plus
0.25ex
}
121 \newdimen\defwidth \defwidth=
0.25\hsize
122 \def\hang{\hangindent\defwidth}
124 \def\textindent#1{\noindent\llap{\hbox to
\defwidth{\tt#1\hfil}}\ignorespaces}
125 \def\key{\par\hangafter=
0\hang\textindent}
127 \def\mtextindent#1{\noindent\hbox{\tt#1\quad}\ignorespaces}
128 \def\mkey{\par\hangafter=
1\hang\mtextindent}
130 \def\kbd#
{\bgroup\tt \let\next=
}
132 \newdimen\raggedstretch
133 \newskip\raggedparfill \raggedparfill=
0pt plus
1fil
135 {\hyphenpenalty10000\exhyphenpenalty10000\pretolerance10000}
137 {\spaceskip=
0.3333em
\relax
138 \xspaceskip=
0.5em
\relax}
142 \rightskip=
0pt plus
\raggedstretch
144 \parfillskip=
\raggedparfill
149 \rightskip=
0pt plus
\raggedstretch
160 \interlinepenalty=
10000
167 \title{GNU\ \ Emacs\ \ Survival\ \ Card
}{for version
\versionemacs}
169 In the following,
\kbd{C-z
} means hit the `
\kbd{z
}' key while
170 holding down the
{\it Ctrl
}\ \ key.
\kbd{M-z
} means hit the
171 `
\kbd{z
}' key while hitting the
{\it Meta\/
} (labeled
{\it Alt\/
}
172 on some keyboards) or after hitting
{\it Esc\/
} key.
174 \section{Running Emacs
}
176 To enter GNU Emacs, just type its name:
\kbd{emacs
}.
177 Emacs divides the frame into several areas:
179 buffer area with the edited text,
180 mode line describing the buffer in the window above it,
181 and a minibuffer/echo area in the last line.
183 \key{C-x C-c
} quit Emacs
184 \key{C-x C-f
} edit file; this command uses the minibuffer to read
185 the file name; use this to create new files by entering the name
187 \key{C-x C-s
} save the file
188 \key{C-x k
} kill a buffer
189 \key{C-g
} in most context: cancel, stop, abort partially typed or
193 \section{Moving About
}
195 \key{C-l
} scroll current line to center of window
196 \key{C-x b
} switch to another buffer
197 \key{M-<
} move to beginning of buffer
198 \key{M->
} move to end of buffer
199 \key{M-g M-g
} go to a given line number
201 \section{Multiple Windows
}
203 \key{C-x
0} remove the current window from the display
204 \key{C-x
1} make active window the only window
205 \key{C-x
2} split window horizontally
206 \key{C-x
3} split window vertically
207 \key{C-x o
} move to other window
211 Emacs defines a `region' as the space between the
{\it mark\/
} and
212 the
{\it point
}. A mark is set with
\kbd{C-
{\it space
}}.
213 The point is at the cursor position.
215 \key{M-h
} mark entire paragraph
216 \key{C-x h
} mark entire buffer
218 \section{Killing and Copying
}
220 \key{C-w
} kill region
221 \key{M-w
} copy region to kill-ring
222 \key{C-k
} kill from the cursor all the way to the end of the line
223 \key{M-DEL
} kill word
224 \key{C-y
} yank back the last kill (
\kbd{C-w C-y
} combination could be
225 used to move text around)
226 \key{M-y
} replace last yank with previous kill
230 \key{C-s
} search for a string
231 \key{C-r
} search for a string backwards
232 \key{RET
} quit searching
233 \key{M-C-s
} regular expression search
234 \key{M-C-r
} reverse regular expression search
236 Use
\kbd{C-s
} or
\kbd{C-r
} again to repeat the search in either direction.
240 Tags tables files record locations of function and
241 procedure definitions, global variables, data types and anything
242 else convenient. To create a tags table file, type
243 `
{\tt etags
} {\it input
\_files}' as a shell command.
245 \key{M-.
} find a definition
246 \key{C-u M-.
} find next occurrence of definition
247 \key{M-*
} pop back to where
\kbd{M-.
} was last invoked
248 \mkey{M-x tags-query-replace
} run query-replace on all files
249 recorded in tags table
250 \key{M-,
} continue last tags search or query-replace
254 \key{M-x compile
} compile code in active window
255 \key{C-c C-c
} go to the next compiler error, when in
256 the compile window or
257 \key{C-x `
} when in the window with source code
259 \section{Dired, the Directory Editor
}
261 \key{C-x d
} invoke Dired
262 \key{d
} flag this file for deletion
263 \key{\~
{}} flag all backup files for deletion
264 \key{u
} remove deletion flag
265 \key{x
} delete the files flagged for deletion
267 \key{g
} update the Dired buffer
268 \key{f
} visit the file described on the current line
269 \key{s
} switch between alphabetical date/time order
271 \section{Reading and Sending Mail
}
273 \key{M-x rmail
} start reading mail
274 \key{q
} quit reading mail
276 \key{d
} mark the current message for deletion
277 \key{x
} remove all messages marked for deletion
279 \key{C-x m
} begin composing a message
280 \key{C-c C-c
} send the message and switch to another buffer
281 \key{C-c C-f C-c
} move to the `CC' header field, creating one
284 \section{Miscellaneous
}
286 \key{M-q
} fill paragraph
287 \key{M-/
} expand previous word dynamically
288 \key{C-z
} iconify (suspend) Emacs when running it under X or
290 \mkey{M-x revert-buffer
} replace the text being edited with the
291 text of the file on disk
293 \section{Query Replace
}
295 \key{M-\%
} interactively search and replace
296 \key{M-C-\%
} using regular expressions
298 Valid responses in query-replace mode are
300 \key{SPC
} replace this one, go on to next
301 \key{,
} replace this one, don't move
302 \key{DEL
} skip to next without replacing
303 \key{!
} replace all remaining matches
304 \key{\^
{}} back up to the previous match
305 \key{RET
} exit query-replace
306 \key{C-r
} enter recursive edit (
\kbd{M-C-c
} to exit)
308 \section{Regular Expressions
}
310 \key{.
{\rm(dot)
}} any single character except a newline
311 \key{*
} zero or more repeats
312 \key{+
} one or more repeats
313 \key{?
} zero or one repeat
314 \key{[$
\ldots$
]} denotes a class of character to match
315 \key{[\^
{}$
\ldots$
]} negates the class
317 \key{\\
{\it c
}} quote characters otherwise having a special
318 meaning in regular expressions
320 \key{$
\ldots$\\|$
\ldots$\\|$
\ldots$
} matches one of
321 the alternatives (``or'')
322 \key{\\( $
\ldots$ \\)
} groups a series of pattern elements to
324 \key{\\
{\it n
}} same text as
{\it n\/
}th group
326 \key{\^
{}} matches at line beginning
327 \key{\$
} matches at line end
329 \key{\
\w} matches word-syntax character
330 \key{\
\W} matches non-word-syntax character
331 \key{\\<
} matches at word beginning
332 \key{\\>
} matches at word end
333 \key{\
\b} matches at word break
334 \key{\
\B} matches at non-word break
338 \key{C-x r s
} save region in register
339 \key{C-x r i
} insert register contents into buffer
341 \key{C-x r SPC
} save value of point in register
342 \key{C-x r j
} jump to point saved in register
346 \key{C-x r r
} copy rectangle to register
347 \key{C-x r k
} kill rectangle
348 \key{C-x r y
} yank rectangle
349 \key{C-x r t
} prefix each line with a string
351 \key{C-x r o
} open rectangle, shifting text right
352 \key{C-x r c
} blank out rectangle
356 \key{M-x shell
} start a shell within Emacs
357 \key{M-!
} execute a shell command
358 \key{M-|
} run a shell command on the region
359 \key{C-u M-|
} filter region through a shell command
361 \section{Spelling Check
}
363 \key{M-\$
} check spelling of word at the cursor
364 \mkey{M-x ispell-region
} check spelling of all words in region
365 \mkey{M-x ispell-buffer
} check spelling of entire buffer
367 \section{International Character Sets
}
369 \key{C-x RET C-\\
} select and activate input method for
371 \key{C-\\
} enable or disable input method
372 \mkey{M-x list-input-methods
} show all input methods
373 \mkey{M-x set-language-environment
} specify principal language
375 \key{C-x RET c
} set coding system for next command
376 \mkey{M-x find-file-literally
} visit file with no conversion
379 \mkey{M-x list-coding-systems
} show all coding systems
380 \mkey{M-x prefer-coding-system
} choose preferred coding system
382 \section{Keyboard Macros
}
384 \key{C-x (
} start defining a keyboard macro
385 \key{C-x )
} end keyboard macro definition
386 \key{C-x e
} execute last-defined keyboard macro
387 \key{C-u C-x (
} append to last keyboard macro
388 \mkey{M-x name-last-kbd-macro
} name last keyboard macro
390 \section{Simple Customization
}
392 \key{M-x customize
} customize variables and faces
394 \section{Getting Help
}
396 Emacs does command completion for you. Typing
\kbd{M-x
}
397 {\it tab\/
} or
{\it space\/
} gives a list of Emacs commands.
400 \key{C-h t
} run the Emacs tutorial
401 \key{C-h i
} enter Info, the documentation browser
402 \key{C-h a
} show commands matching a string (apropos)
403 \key{C-h k
} display documentation of the function invoked by
406 Emacs gets into different
{\it modes
}, each of which customizes
407 Emacs for editing text of a particular sort. The mode line
408 contains names of the current modes, in parentheses.
410 \key{C-h m
} get mode-specific information
417 % compile-command: "pdftex survival"