Commit | Line | Data |
---|---|---|
a96da3ab | 1 | % Reference Card for GNU Emacs version 23 on Unix systems |
a933dad1 DL |
2 | %**start of header |
3 | \newcount\columnsperpage | |
9ff10fca | 4 | \newcount\letterpaper |
a933dad1 DL |
5 | |
6 | % This file can be printed with 1, 2, or 3 columns per page (see below). | |
9ff10fca | 7 | % Specify how many you want here. |
a933dad1 | 8 | |
9ff10fca | 9 | \columnsperpage=3 |
a933dad1 | 10 | |
19e187a7 | 11 | % Set letterpaper to 0 for A4 paper, 1 for letter (US) paper. Useful |
9ff10fca SE |
12 | % only when columnsperpage is 2 or 3. |
13 | ||
14 | \letterpaper=1 | |
15 | ||
19e187a7 MC |
16 | % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for |
17 | % a landscape layout. | |
18 | ||
19 | \input pdflayout.sty | |
20 | \pdflayout=(1l) | |
21 | ||
9ff10fca | 22 | % Nothing else needs to be changed below this line. |
d4a21b4f | 23 | % Copyright (C) 1987, 1993, 1996, 1997, 2001, 2002, 2003, 2004, |
bb65542c | 24 | % 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
a933dad1 DL |
25 | |
26 | % This file is part of GNU Emacs. | |
27 | ||
b83446dd | 28 | % GNU Emacs is free software: you can redistribute it and/or modify |
a933dad1 | 29 | % it under the terms of the GNU General Public License as published by |
b83446dd GM |
30 | % the Free Software Foundation, either version 3 of the License, or |
31 | % (at your option) any later version. | |
a933dad1 DL |
32 | |
33 | % GNU Emacs is distributed in the hope that it will be useful, | |
34 | % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
35 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
36 | % GNU General Public License for more details. | |
37 | ||
38 | % You should have received a copy of the GNU General Public License | |
b83446dd | 39 | % along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
a933dad1 DL |
40 | |
41 | % This file is intended to be processed by plain TeX (TeX82). | |
42 | % | |
43 | % The final reference card has six columns, three on each side. | |
44 | % This file can be used to produce it in any of three ways: | |
45 | % 1 column per page | |
46 | % produces six separate pages, each of which needs to be reduced to 80%. | |
47 | % This gives the best resolution. | |
48 | % 2 columns per page | |
49 | % produces three already-reduced pages. | |
50 | % You will still need to cut and paste. | |
51 | % 3 columns per page | |
52 | % produces two pages which must be printed sideways to make a | |
53 | % ready-to-use 8.5 x 11 inch reference card. | |
54 | % For this you need a dvi device driver that can print sideways. | |
55 | % Which mode to use is controlled by setting \columnsperpage above. | |
56 | % | |
9ff10fca SE |
57 | % To compile and print this document: |
58 | % tex refcard.tex | |
59 | % dvips -t landscape refcard.dvi | |
60 | % | |
a933dad1 DL |
61 | % Author: |
62 | % Stephen Gildea | |
feeb94f7 | 63 | % Internet: gildea@stop.mail-abuse.org |
a933dad1 DL |
64 | % |
65 | % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik | |
66 | % for their many good ideas. | |
67 | ||
68 | % If there were room, it would be nice to see a section on Dired. | |
69 | ||
d4a21b4f | 70 | \def\versionnumber{2.3} % version of this manual |
a96da3ab CY |
71 | \def\versionyear{2009} % year manual was updated |
72 | \def\versionemacs{23} % version of emacs this manual is for | |
f906fb5d | 73 | \def\year{2009} % copyright year |
a933dad1 DL |
74 | |
75 | \def\shortcopyrightnotice{\vskip 1ex plus 2 fill | |
76 | \centerline{\small \copyright\ \year\ Free Software Foundation, Inc. | |
77 | Permissions on back. v\versionnumber}} | |
78 | ||
79 | \def\copyrightnotice{ | |
80 | \vskip 1ex plus 2 fill\begingroup\small | |
81 | \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.} | |
d4a21b4f | 82 | \centerline{v\versionnumber{} for GNU Emacs version \versionemacs, \versionyear} |
a933dad1 DL |
83 | \centerline{designed by Stephen Gildea} |
84 | ||
ccdcf962 KB |
85 | Permission is granted to make and distribute modified or unmodified |
86 | copies of this card provided the copyright notice and this permission | |
87 | notice are preserved on all copies. | |
a933dad1 DL |
88 | |
89 | For copies of the GNU Emacs manual, write to the Free Software | |
364c38d3 | 90 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
a933dad1 DL |
91 | |
92 | \endgroup} | |
93 | ||
94 | % make \bye not \outer so that the \def\bye in the \else clause below | |
95 | % can be scanned without complaint. | |
96 | \def\bye{\par\vfill\supereject\end} | |
97 | ||
98 | \newdimen\intercolumnskip %horizontal space between columns | |
99 | \newbox\columna %boxes to hold columns already built | |
100 | \newbox\columnb | |
101 | ||
102 | \def\ncolumns{\the\columnsperpage} | |
103 | ||
177c0ea7 | 104 | \message{[\ncolumns\space |
a933dad1 DL |
105 | column\if 1\ncolumns\else s\fi\space per page]} |
106 | ||
107 | \def\scaledmag#1{ scaled \magstep #1} | |
108 | ||
109 | % This multi-way format was designed by Stephen Gildea October 1986. | |
110 | % Note that the 1-column format is fontfamily-independent. | |
111 | \if 1\ncolumns %one-column format uses normal size | |
112 | \hsize 4in | |
113 | \vsize 10in | |
114 | \voffset -.7in | |
115 | \font\titlefont=\fontname\tenbf \scaledmag3 | |
116 | \font\headingfont=\fontname\tenbf \scaledmag2 | |
117 | \font\smallfont=\fontname\sevenrm | |
118 | \font\smallsy=\fontname\sevensy | |
119 | ||
120 | \footline{\hss\folio} | |
121 | \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}} | |
122 | \else %2 or 3 columns uses prereduced size | |
123 | \hsize 3.2in | |
9ff10fca SE |
124 | \if 1\the\letterpaper |
125 | \vsize 7.95in | |
126 | \else | |
127 | \vsize 7.65in | |
128 | \fi | |
a933dad1 DL |
129 | \hoffset -.75in |
130 | \voffset -.745in | |
131 | \font\titlefont=cmbx10 \scaledmag2 | |
132 | \font\headingfont=cmbx10 \scaledmag1 | |
133 | \font\smallfont=cmr6 | |
134 | \font\smallsy=cmsy6 | |
135 | \font\eightrm=cmr8 | |
136 | \font\eightbf=cmbx8 | |
137 | \font\eightit=cmti8 | |
138 | \font\eighttt=cmtt8 | |
139 | \font\eightmi=cmmi8 | |
140 | \font\eightsy=cmsy8 | |
141 | \textfont0=\eightrm | |
142 | \textfont1=\eightmi | |
143 | \textfont2=\eightsy | |
144 | \def\rm{\eightrm} | |
145 | \def\bf{\eightbf} | |
146 | \def\it{\eightit} | |
147 | \def\tt{\eighttt} | |
9ff10fca SE |
148 | \if 1\the\letterpaper |
149 | \normalbaselineskip=.8\normalbaselineskip | |
150 | \else | |
151 | \normalbaselineskip=.7\normalbaselineskip | |
152 | \fi | |
a933dad1 DL |
153 | \normallineskip=.8\normallineskip |
154 | \normallineskiplimit=.8\normallineskiplimit | |
155 | \normalbaselines\rm %make definitions take effect | |
156 | ||
157 | \if 2\ncolumns | |
158 | \let\maxcolumn=b | |
159 | \footline{\hss\rm\folio\hss} | |
160 | \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}} | |
161 | \else \if 3\ncolumns | |
162 | \let\maxcolumn=c | |
163 | \nopagenumbers | |
164 | \else | |
165 | \errhelp{You must set \columnsperpage equal to 1, 2, or 3.} | |
166 | \errmessage{Illegal number of columns per page} | |
167 | \fi\fi | |
168 | ||
169 | \intercolumnskip=.46in | |
170 | \def\abc{a} | |
171 | \output={% %see The TeXbook page 257 | |
172 | % This next line is useful when designing the layout. | |
173 | %\immediate\write16{Column \folio\abc\space starts with \firstmark} | |
174 | \if \maxcolumn\abc \multicolumnformat \global\def\abc{a} | |
175 | \else\if a\abc | |
176 | \global\setbox\columna\columnbox \global\def\abc{b} | |
177 | %% in case we never use \columnb (two-column mode) | |
178 | \global\setbox\columnb\hbox to -\intercolumnskip{} | |
179 | \else | |
180 | \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi} | |
181 | \def\multicolumnformat{\shipout\vbox{\makeheadline | |
182 | \hbox{\box\columna\hskip\intercolumnskip | |
183 | \box\columnb\hskip\intercolumnskip\columnbox} | |
184 | \makefootline}\advancepageno} | |
185 | \def\columnbox{\leftline{\pagebody}} | |
186 | ||
187 | \def\bye{\par\vfill\supereject | |
188 | \if a\abc \else\null\vfill\eject\fi | |
189 | \if a\abc \else\null\vfill\eject\fi | |
177c0ea7 | 190 | \end} |
a933dad1 DL |
191 | \fi |
192 | ||
193 | % we won't be using math mode much, so redefine some of the characters | |
194 | % we might want to talk about | |
195 | \catcode`\^=12 | |
196 | \catcode`\_=12 | |
197 | ||
198 | \chardef\\=`\\ | |
199 | \chardef\{=`\{ | |
200 | \chardef\}=`\} | |
201 | ||
202 | \hyphenation{mini-buf-fer} | |
203 | ||
204 | \parindent 0pt | |
205 | \parskip 1ex plus .5ex minus .5ex | |
206 | ||
207 | \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip} | |
208 | ||
209 | % newcolumn - force a new column. Use sparingly, probably only for | |
210 | % the first column of a page, which should have a title anyway. | |
211 | \outer\def\newcolumn{\vfill\eject} | |
212 | ||
213 | % title - page title. Argument is title text. | |
214 | \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex} | |
215 | ||
216 | % section - new major section. Argument is section name. | |
217 | \outer\def\section#1{\par\filbreak | |
218 | \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}% | |
219 | \vskip 2ex plus 1ex minus 1.5ex} | |
220 | ||
221 | \newdimen\keyindent | |
222 | ||
223 | % beginindentedkeys...endindentedkeys - key definitions will be | |
224 | % indented, but running text, typically used as headings to group | |
225 | % definitions, will not. | |
226 | \def\beginindentedkeys{\keyindent=1em} | |
227 | \def\endindentedkeys{\keyindent=0em} | |
228 | \endindentedkeys | |
229 | ||
230 | % paralign - begin paragraph containing an alignment. | |
231 | % If an \halign is entered while in vertical mode, a parskip is never | |
232 | % inserted. Using \paralign instead of \halign solves this problem. | |
233 | \def\paralign{\vskip\parskip\halign} | |
234 | ||
235 | % \<...> - surrounds a variable name in a code example | |
236 | \def\<#1>{{\it #1\/}} | |
237 | ||
238 | % kbd - argument is characters typed literally. Like the Texinfo command. | |
239 | \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows | |
240 | ||
241 | % beginexample...endexample - surrounds literal text, such a code example. | |
242 | % typeset in a typewriter font with line breaks preserved | |
243 | \def\beginexample{\par\leavevmode\begingroup | |
244 | \obeylines\obeyspaces\parskip0pt\tt} | |
245 | {\obeyspaces\global\let =\ } | |
246 | \def\endexample{\endgroup} | |
247 | ||
248 | % key - definition of a key. | |
249 | % \key{description of key}{key-name} | |
250 | % prints the description left-justified, and the key-name in a \kbd | |
251 | % form near the right margin. | |
252 | \def\key#1#2{\leavevmode\hbox to \hsize{\vtop | |
253 | {\hsize=.75\hsize\rightskip=1em | |
254 | \hskip\keyindent\relax#1}\kbd{#2}\hfil}} | |
255 | ||
256 | \newbox\metaxbox | |
257 | \setbox\metaxbox\hbox{\kbd{M-x }} | |
258 | \newdimen\metaxwidth | |
259 | \metaxwidth=\wd\metaxbox | |
260 | ||
261 | % metax - definition of a M-x command. | |
262 | % \metax{description of command}{M-x command-name} | |
263 | % Tries to justify the beginning of the command name at the same place | |
264 | % as \key starts the key name. (The "M-x " sticks out to the left.) | |
265 | \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize | |
266 | {\hskip\keyindent\relax#1\hfil}% | |
267 | \hskip -\metaxwidth minus 1fil | |
268 | \kbd{#2}\hfil}} | |
269 | ||
270 | % threecol - like "key" but with two key names. | |
271 | % for example, one for doing the action backward, and one for forward. | |
272 | \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\hfil\quad | |
273 | &\kbd{#3}\hfil\quad\cr} | |
274 | ||
275 | %**end of header | |
276 | \f | |
277 | ||
278 | \title{GNU Emacs Reference Card} | |
279 | ||
d4a21b4f | 280 | \centerline{(for version \versionemacs)} |
a933dad1 DL |
281 | |
282 | \section{Starting Emacs} | |
283 | ||
d4a21b4f | 284 | To enter GNU Emacs \versionemacs, just type its name: \kbd{emacs} |
a933dad1 DL |
285 | |
286 | \section{Leaving Emacs} | |
287 | ||
288 | \key{suspend Emacs (or iconify it under X)}{C-z} | |
289 | \key{exit Emacs permanently}{C-x C-c} | |
290 | ||
291 | \section{Files} | |
292 | ||
293 | \key{{\bf read} a file into Emacs}{C-x C-f} | |
294 | \key{{\bf save} a file back to disk}{C-x C-s} | |
295 | \key{save {\bf all} files}{C-x s} | |
296 | \key{{\bf insert} contents of another file into this buffer}{C-x i} | |
297 | \key{replace this file with the file you really want}{C-x C-v} | |
298 | \key{write buffer to a specified file}{C-x C-w} | |
9e5f497d | 299 | \key{toggle read-only status of buffer}{C-x C-q} |
a933dad1 DL |
300 | |
301 | \section{Getting Help} | |
302 | ||
303 | The help system is simple. Type \kbd{C-h} (or \kbd{F1}) and follow | |
304 | the directions. If you are a first-time user, type \kbd{C-h t} for a | |
305 | {\bf tutorial}. | |
306 | ||
307 | \key{remove help window}{C-x 1} | |
308 | \key{scroll help window}{C-M-v} | |
309 | ||
310 | \key{apropos: show commands matching a string}{C-h a} | |
9e5f497d | 311 | \key{describe the function a key runs}{C-h k} |
a933dad1 DL |
312 | \key{describe a function}{C-h f} |
313 | \key{get mode-specific information}{C-h m} | |
314 | ||
315 | \section{Error Recovery} | |
316 | ||
317 | \key{{\bf abort} partially typed or executing command}{C-g} | |
9e5f497d | 318 | \metax{{\bf recover} files lost by a system crash}{M-x recover-session} |
9173d585 | 319 | \metax{{\bf undo} an unwanted change}{C-x u, C-_ {\rm or} C-/} |
a933dad1 DL |
320 | \metax{restore a buffer to its original contents}{M-x revert-buffer} |
321 | \key{redraw garbaged screen}{C-l} | |
322 | ||
323 | \section{Incremental Search} | |
324 | ||
325 | \key{search forward}{C-s} | |
326 | \key{search backward}{C-r} | |
327 | \key{regular expression search}{C-M-s} | |
328 | \key{reverse regular expression search}{C-M-r} | |
329 | ||
330 | \key{select previous search string}{M-p} | |
331 | \key{select next later search string}{M-n} | |
332 | \key{exit incremental search}{RET} | |
333 | \key{undo effect of last character}{DEL} | |
334 | \key{abort current search}{C-g} | |
335 | ||
336 | Use \kbd{C-s} or \kbd{C-r} again to repeat the search in either direction. | |
8eb38b32 | 337 | If Emacs is still searching, \kbd{C-g} cancels only the part not matched. |
a933dad1 DL |
338 | |
339 | \shortcopyrightnotice | |
340 | ||
341 | \section{Motion} | |
342 | ||
343 | \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr | |
344 | \threecol{{\bf entity to move over}}{{\bf backward}}{{\bf forward}} | |
345 | \threecol{character}{C-b}{C-f} | |
346 | \threecol{word}{M-b}{M-f} | |
347 | \threecol{line}{C-p}{C-n} | |
348 | \threecol{go to line beginning (or end)}{C-a}{C-e} | |
349 | \threecol{sentence}{M-a}{M-e} | |
350 | \threecol{paragraph}{M-\{}{M-\}} | |
351 | \threecol{page}{C-x [}{C-x ]} | |
352 | \threecol{sexp}{C-M-b}{C-M-f} | |
353 | \threecol{function}{C-M-a}{C-M-e} | |
354 | \threecol{go to buffer beginning (or end)}{M-<}{M->} | |
355 | } | |
356 | ||
357 | \key{scroll to next screen}{C-v} | |
358 | \key{scroll to previous screen}{M-v} | |
359 | \key{scroll left}{C-x <} | |
360 | \key{scroll right}{C-x >} | |
361 | \key{scroll current line to center of screen}{C-u C-l} | |
362 | ||
363 | \section{Killing and Deleting} | |
364 | ||
365 | \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr | |
366 | \threecol{{\bf entity to kill}}{{\bf backward}}{{\bf forward}} | |
367 | \threecol{character (delete, not kill)}{DEL}{C-d} | |
368 | \threecol{word}{M-DEL}{M-d} | |
369 | \threecol{line (to end of)}{M-0 C-k}{C-k} | |
370 | \threecol{sentence}{C-x DEL}{M-k} | |
371 | \threecol{sexp}{M-- C-M-k}{C-M-k} | |
372 | } | |
373 | ||
374 | \key{kill {\bf region}}{C-w} | |
375 | \key{copy region to kill ring}{M-w} | |
376 | \key{kill through next occurrence of {\it char}}{M-z {\it char}} | |
377 | ||
378 | \key{yank back last thing killed}{C-y} | |
379 | \key{replace last yank with previous kill}{M-y} | |
380 | ||
381 | \section{Marking} | |
382 | ||
383 | \key{set mark here}{C-@ {\rm or} C-SPC} | |
384 | \key{exchange point and mark}{C-x C-x} | |
385 | ||
386 | \key{set mark {\it arg\/} {\bf words} away}{M-@} | |
387 | \key{mark {\bf paragraph}}{M-h} | |
388 | \key{mark {\bf page}}{C-x C-p} | |
389 | \key{mark {\bf sexp}}{C-M-@} | |
390 | \key{mark {\bf function}}{C-M-h} | |
391 | \key{mark entire {\bf buffer}}{C-x h} | |
392 | ||
393 | \section{Query Replace} | |
394 | ||
395 | \key{interactively replace a text string}{M-\%} | |
60b34e06 LK |
396 | % query-replace-regexp is bound to C-M-% but that can't be typed on |
397 | % consoles. | |
a933dad1 DL |
398 | \metax{using regular expressions}{M-x query-replace-regexp} |
399 | ||
400 | Valid responses in query-replace mode are | |
401 | ||
402 | \key{{\bf replace} this one, go on to next}{SPC} | |
403 | \key{replace this one, don't move}{,} | |
404 | \key{{\bf skip} to next without replacing}{DEL} | |
405 | \key{replace all remaining matches}{!} | |
406 | \key{{\bf back up} to the previous match}{^} | |
407 | \key{{\bf exit} query-replace}{RET} | |
408 | \key{enter recursive edit (\kbd{C-M-c} to exit)}{C-r} | |
409 | ||
410 | \section{Multiple Windows} | |
411 | ||
60b34e06 LK |
412 | When two commands are shown, the second is a similar command for a |
413 | frame instead of a window. | |
a933dad1 DL |
414 | |
415 | {\setbox0=\hbox{\kbd{0}}\advance\hsize by 0\wd0 | |
416 | \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr | |
60b34e06 | 417 | \threecol{delete all other windows}{C-x 1\ \ \ \ }{C-x 5 1} |
a933dad1 DL |
418 | \threecol{split window, above and below}{C-x 2\ \ \ \ }{C-x 5 2} |
419 | \threecol{delete this window}{C-x 0\ \ \ \ }{C-x 5 0} | |
420 | }} | |
421 | \key{split window, side by side}{C-x 3} | |
422 | ||
423 | \key{scroll other window}{C-M-v} | |
424 | ||
425 | {\setbox0=\hbox{\kbd{0}}\advance\hsize by 2\wd0 | |
426 | \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr | |
427 | \threecol{switch cursor to another window}{C-x o}{C-x 5 o} | |
428 | ||
429 | \threecol{select buffer in other window}{C-x 4 b}{C-x 5 b} | |
430 | \threecol{display buffer in other window}{C-x 4 C-o}{C-x 5 C-o} | |
431 | \threecol{find file in other window}{C-x 4 f}{C-x 5 f} | |
432 | \threecol{find file read-only in other window}{C-x 4 r}{C-x 5 r} | |
433 | \threecol{run Dired in other window}{C-x 4 d}{C-x 5 d} | |
434 | \threecol{find tag in other window}{C-x 4 .}{C-x 5 .} | |
435 | }} | |
436 | ||
437 | \key{grow window taller}{C-x ^} | |
438 | \key{shrink window narrower}{C-x \{} | |
439 | \key{grow window wider}{C-x \}} | |
440 | ||
441 | \section{Formatting} | |
442 | ||
443 | \key{indent current {\bf line} (mode-dependent)}{TAB} | |
444 | \key{indent {\bf region} (mode-dependent)}{C-M-\\} | |
445 | \key{indent {\bf sexp} (mode-dependent)}{C-M-q} | |
446 | \key{indent region rigidly {\it arg\/} columns}{C-x TAB} | |
447 | ||
448 | \key{insert newline after point}{C-o} | |
449 | \key{move rest of line vertically down}{C-M-o} | |
450 | \key{delete blank lines around point}{C-x C-o} | |
451 | \key{join line with previous (with arg, next)}{M-^} | |
452 | \key{delete all white space around point}{M-\\} | |
453 | \key{put exactly one space at point}{M-SPC} | |
454 | ||
455 | \key{fill paragraph}{M-q} | |
ccdcf962 | 456 | \key{set fill column to {\it arg}}{C-x f} |
a933dad1 DL |
457 | \key{set prefix each line starts with}{C-x .} |
458 | ||
60b34e06 | 459 | \key{set face}{M-o} |
a933dad1 DL |
460 | |
461 | \section{Case Change} | |
462 | ||
463 | \key{uppercase word}{M-u} | |
464 | \key{lowercase word}{M-l} | |
465 | \key{capitalize word}{M-c} | |
466 | ||
467 | \key{uppercase region}{C-x C-u} | |
468 | \key{lowercase region}{C-x C-l} | |
469 | ||
470 | \section{The Minibuffer} | |
471 | ||
472 | The following keys are defined in the minibuffer. | |
473 | ||
474 | \key{complete as much as possible}{TAB} | |
475 | \key{complete up to one word}{SPC} | |
476 | \key{complete and execute}{RET} | |
477 | \key{show possible completions}{?} | |
478 | \key{fetch previous minibuffer input}{M-p} | |
479 | \key{fetch later minibuffer input or default}{M-n} | |
480 | \key{regexp search backward through history}{M-r} | |
481 | \key{regexp search forward through history}{M-s} | |
482 | \key{abort command}{C-g} | |
483 | ||
484 | Type \kbd{C-x ESC ESC} to edit and repeat the last command that used the | |
8eb38b32 | 485 | minibuffer. Type \kbd{F10} to activate menu bar items on text terminals. |
a933dad1 DL |
486 | |
487 | \newcolumn | |
488 | \title{GNU Emacs Reference Card} | |
489 | ||
490 | \section{Buffers} | |
491 | ||
492 | \key{select another buffer}{C-x b} | |
493 | \key{list all buffers}{C-x C-b} | |
494 | \key{kill a buffer}{C-x k} | |
495 | ||
496 | \section{Transposing} | |
497 | ||
498 | \key{transpose {\bf characters}}{C-t} | |
499 | \key{transpose {\bf words}}{M-t} | |
500 | \key{transpose {\bf lines}}{C-x C-t} | |
501 | \key{transpose {\bf sexps}}{C-M-t} | |
502 | ||
503 | \section{Spelling Check} | |
504 | ||
505 | \key{check spelling of current word}{M-\$} | |
506 | \metax{check spelling of all words in region}{M-x ispell-region} | |
507 | \metax{check spelling of entire buffer}{M-x ispell-buffer} | |
508 | ||
509 | \section{Tags} | |
510 | ||
511 | \key{find a tag (a definition)}{M-.} | |
512 | \key{find next occurrence of tag}{C-u M-.} | |
513 | \metax{specify a new tags file}{M-x visit-tags-table} | |
514 | ||
515 | \metax{regexp search on all files in tags table}{M-x tags-search} | |
516 | \metax{run query-replace on all the files}{M-x tags-query-replace} | |
517 | \key{continue last tags search or query-replace}{M-,} | |
518 | ||
519 | \section{Shells} | |
520 | ||
521 | \key{execute a shell command}{M-!} | |
522 | \key{run a shell command on the region}{M-|} | |
523 | \key{filter region through a shell command}{C-u M-|} | |
524 | \key{start a shell in window \kbd{*shell*}}{M-x shell} | |
525 | ||
526 | \section{Rectangles} | |
527 | ||
528 | \key{copy rectangle to register}{C-x r r} | |
529 | \key{kill rectangle}{C-x r k} | |
530 | \key{yank rectangle}{C-x r y} | |
531 | \key{open rectangle, shifting text right}{C-x r o} | |
532 | \key{blank out rectangle}{C-x r c} | |
533 | \key{prefix each line with a string}{C-x r t} | |
534 | ||
535 | \section{Abbrevs} | |
536 | ||
537 | \key{add global abbrev}{C-x a g} | |
538 | \key{add mode-local abbrev}{C-x a l} | |
539 | \key{add global expansion for this abbrev}{C-x a i g} | |
540 | \key{add mode-local expansion for this abbrev}{C-x a i l} | |
541 | \key{explicitly expand abbrev}{C-x a e} | |
542 | ||
543 | \key{expand previous word dynamically}{M-/} | |
544 | ||
545 | \section{Regular Expressions} | |
546 | ||
547 | \key{any single character except a newline}{. {\rm(dot)}} | |
548 | \key{zero or more repeats}{*} | |
549 | \key{one or more repeats}{+} | |
550 | \key{zero or one repeat}{?} | |
551 | \key{quote regular expression special character {\it c\/}}{\\{\it c}} | |
552 | \key{alternative (``or'')}{\\|} | |
553 | \key{grouping}{\\( {\rm$\ldots$} \\)} | |
554 | \key{same text as {\it n\/}th group}{\\{\it n}} | |
555 | \key{at word break}{\\b} | |
556 | \key{not at word break}{\\B} | |
557 | ||
558 | \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr | |
559 | \threecol{{\bf entity}}{{\bf match start}}{{\bf match end}} | |
560 | \threecol{line}{^}{\$} | |
561 | \threecol{word}{\\<}{\\>} | |
562 | \threecol{buffer}{\\`}{\\'} | |
563 | ||
564 | \threecol{{\bf class of characters}}{{\bf match these}}{{\bf match others}} | |
565 | \threecol{explicit set}{[ {\rm$\ldots$} ]}{[^ {\rm$\ldots$} ]} | |
566 | \threecol{word-syntax character}{\\w}{\\W} | |
567 | \threecol{character with syntax {\it c}}{\\s{\it c}}{\\S{\it c}} | |
568 | } | |
569 | ||
570 | \section{International Character Sets} | |
571 | ||
60b34e06 | 572 | \key{specify principal language}{C-x RET l} |
a933dad1 DL |
573 | \metax{show all input methods}{M-x list-input-methods} |
574 | \key{enable or disable input method}{C-\\} | |
575 | \key{set coding system for next command}{C-x RET c} | |
576 | \metax{show all coding systems}{M-x list-coding-systems} | |
577 | \metax{choose preferred coding system}{M-x prefer-coding-system} | |
578 | ||
579 | \section{Info} | |
580 | ||
581 | \key{enter the Info documentation reader}{C-h i} | |
9e5f497d | 582 | \key{find specified function or variable in Info}{C-h S} |
a933dad1 DL |
583 | \beginindentedkeys |
584 | ||
585 | Moving within a node: | |
586 | ||
587 | \key{scroll forward}{SPC} | |
588 | \key{scroll reverse}{DEL} | |
589 | \key{beginning of node}{. {\rm (dot)}} | |
590 | ||
591 | Moving between nodes: | |
592 | ||
593 | \key{{\bf next} node}{n} | |
594 | \key{{\bf previous} node}{p} | |
595 | \key{move {\bf up}}{u} | |
596 | \key{select menu item by name}{m} | |
597 | \key{select {\it n\/}th menu item by number (1--9)}{{\it n}} | |
598 | \key{follow cross reference (return with \kbd{l})}{f} | |
599 | \key{return to last node you saw}{l} | |
600 | \key{return to directory node}{d} | |
9e5f497d | 601 | \key{go to top node of Info file}{t} |
a933dad1 DL |
602 | \key{go to any node by name}{g} |
603 | ||
604 | Other: | |
605 | ||
606 | \key{run Info {\bf tutorial}}{h} | |
0804c86c RS |
607 | \key{look up a subject in the indices}{i} |
608 | \key{search nodes for regexp}{s} | |
a933dad1 | 609 | \key{{\bf quit} Info}{q} |
a933dad1 DL |
610 | |
611 | \endindentedkeys | |
612 | ||
613 | \section{Registers} | |
614 | ||
615 | \key{save region in register}{C-x r s} | |
616 | \key{insert register contents into buffer}{C-x r i} | |
617 | ||
618 | \key{save value of point in register}{C-x r SPC} | |
619 | \key{jump to point saved in register}{C-x r j} | |
620 | ||
621 | \section{Keyboard Macros} | |
622 | ||
623 | \key{{\bf start} defining a keyboard macro}{C-x (} | |
624 | \key{{\bf end} keyboard macro definition}{C-x )} | |
625 | \key{{\bf execute} last-defined keyboard macro}{C-x e} | |
626 | \key{append to last keyboard macro}{C-u C-x (} | |
627 | \metax{name last keyboard macro}{M-x name-last-kbd-macro} | |
628 | \metax{insert Lisp definition in buffer}{M-x insert-kbd-macro} | |
629 | ||
630 | \section{Commands Dealing with Emacs Lisp} | |
631 | ||
632 | \key{eval {\bf sexp} before point}{C-x C-e} | |
633 | \key{eval current {\bf defun}}{C-M-x} | |
634 | \metax{eval {\bf region}}{M-x eval-region} | |
635 | \key{read and eval minibuffer}{M-:} | |
636 | \metax{load from standard system directory}{M-x load-library} | |
637 | ||
638 | \section{Simple Customization} | |
639 | ||
640 | \metax{customize variables and faces}{M-x customize} | |
641 | ||
642 | % The intended audience here is the person who wants to make simple | |
643 | % customizations and knows Lisp syntax. | |
644 | ||
ccdcf962 | 645 | Making global key bindings in Emacs Lisp (example): |
a933dad1 DL |
646 | |
647 | \beginexample% | |
ccdcf962 KB |
648 | (global-set-key (kbd "C-c g") 'search-forward) |
649 | (global-set-key (kbd "M-\#") 'query-replace-regexp) | |
a933dad1 DL |
650 | \endexample |
651 | ||
652 | \section{Writing Commands} | |
653 | ||
654 | \beginexample% | |
655 | (defun \<command-name> (\<args>) | |
656 | "\<documentation>" (interactive "\<template>") | |
657 | \<body>) | |
658 | \endexample | |
659 | ||
660 | An example: | |
661 | ||
662 | \beginexample% | |
663 | (defun this-line-to-top-of-window (line) | |
8eb38b32 | 664 | "Reposition current line to top of window. |
a933dad1 DL |
665 | With ARG, put point on line ARG." |
666 | (interactive "P") | |
667 | (recenter (if (null line) | |
668 | 0 | |
669 | (prefix-numeric-value line)))) | |
670 | \endexample | |
671 | ||
672 | The \kbd{interactive} spec says how to read arguments interactively. | |
673 | Type \kbd{C-h f interactive} for more details. | |
674 | ||
675 | \copyrightnotice | |
676 | ||
677 | \bye | |
678 | \f | |
679 | % Local variables: | |
19e187a7 | 680 | % compile-command: "pdftex refcard" |
a933dad1 | 681 | % End: |
ab5796a9 MB |
682 | |
683 | % arch-tag: d67bdf5d-b77c-44eb-a22e-f4f7d25174d2 |