|
|
1.1 root 1: % Reference Card for GNU Emacs version 18 on Unix systems
2: %**start of header
3: \newcount\columnsperpage
4:
5: % This file can be printed with 1, 2, or 3 columns per page (see below).
6: % Specify how many you want here. Nothing else needs to be changed.
7:
8: \columnsperpage=1
9:
10: % Copyright (c) 1987 Free Software Foundation, Inc.
11:
12: % This file is part of GNU Emacs.
13:
14: % This file is distributed in the hope that it will be useful,
15: % but WITHOUT ANY WARRANTY. No author or distributor
16: % accepts responsibility to anyone for the consequences of using it
17: % or for whether it serves any particular purpose or describes
18: % any piece of software unless they say so in writing. Refer to the
19: % GNU Emacs General Public License for full details.
20: %
21: % Permission is granted to copy, modify and redistribute this source
22: % file provided the copyright notice and permission notices are
23: % preserved on all copies.
24: %
25: % Permission is granted to process this file through TeX and print the
26: % results, provided the printed document carries copyright and
27: % permission notices identical to the ones below.
28:
29: % This file is intended to be processed by plain TeX (TeX82).
30: %
31: % The final reference card has six columns, three on each side.
32: % This file can be used to produce it in any of three ways:
33: % 1 column per page
34: % produces six separate pages, each of which needs to be reduced to 80%.
35: % This gives the best resolution.
36: % 2 columns per page
37: % produces three already-reduced pages.
38: % You will still need to cut and paste.
39: % 3 columns per page
40: % produces two pages which must be printed sideways to make a
41: % ready-to-use 8.5 x 11 inch reference card.
42: % For this you need a dvi device driver that can print sideways.
43: % Which mode to use is controlled by setting \columnsperpage above.
44: %
45: % Author:
46: % Stephen Gildea
47: % UUCP: mit-erl!gildea
48: % Internet: [email protected]
49: %
50: % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
51: % for their many good ideas.
52:
53: % If there were room, it would be nice to see sections on
54: % Abbrevs, Rectangles, and Dired.
55:
56: \def\versionnumber{1.9}
57: \def\year{1987}
58: \def\version{March \year\ v\versionnumber}
59:
60: \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
61: \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
62: Permissions on back. v\versionnumber}}
63:
64: \def\copyrightnotice{
65: \vskip 1ex plus 2 fill\begingroup\small
66: \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
67: \centerline{designed by Stephen Gildea, \version}
68: \centerline{for GNU Emacs version 18 on Unix systems}
69:
70: Permission is granted to make and distribute copies of
71: this card provided the copyright notice and this permission notice
72: are preserved on all copies.
73:
74: For copies of the GNU Emacs manual, write to the Free Software
75: Foundation, Inc., 675 Massachusetts Ave, Cambridge MA 02139.
76:
77: \endgroup}
78:
79: % make \bye not \outer so that the \def\bye in the \else clause below
80: % can be scanned without complaint.
81: \def\bye{\par\vfill\supereject\end}
82:
83: \newdimen\intercolumnskip
84: \newbox\columna
85: \newbox\columnb
86:
87: \def\ncolumns{\the\columnsperpage}
88:
89: \message{[\ncolumns\space
90: column\if 1\ncolumns\else s\fi\space per page]}
91:
92: \def\scaledmag#1{ scaled \magstep #1}
93:
94: % This multi-way format was designed by Stephen Gildea
95: % October 1986.
96: \if 1\ncolumns
97: \hsize 4in
98: \vsize 10in
99: \voffset -.7in
100: \font\titlefont=\fontname\tenbf \scaledmag3
101: \font\headingfont=\fontname\tenbf \scaledmag2
102: \font\smallfont=\fontname\sevenrm
103: \font\smallsy=\fontname\sevensy
104:
105: \footline{\hss\folio}
106: \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
107: \else
108: \hsize 3.2in
109: \vsize 7.95in
110: \hoffset -.75in
111: \voffset -.745in
112: \font\titlefont=ambx10 \scaledmag2
113: \font\headingfont=ambx10 \scaledmag1
114: \font\smallfont=amr6
115: \font\smallsy=amsy6
116: \font\eightrm=amr8
117: \font\eightbf=ambx8
118: \font\eightit=amti8
119: \font\eighttt=amtt8
120: \font\eightsy=amsy8
121: \textfont0=\eightrm
122: \textfont2=\eightsy
123: \def\rm{\eightrm}
124: \def\bf{\eightbf}
125: \def\it{\eightit}
126: \def\tt{\eighttt}
127: \normalbaselineskip=.8\normalbaselineskip
128: \normallineskip=.8\normallineskip
129: \normallineskiplimit=.8\normallineskiplimit
130: \normalbaselines\rm %make definitions take effect
131:
132: \if 2\ncolumns
133: \let\maxcolumn=b
134: \footline{\hss\rm\folio\hss}
135: \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
136: \else \if 3\ncolumns
137: \let\maxcolumn=c
138: \nopagenumbers
139: \else
140: \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
141: \errmessage{Illegal number of columns per page}
142: \fi\fi
143:
144: \intercolumnskip=.46in
145: \def\abc{a}
146: \output={%
147: % This next line is useful when designing the layout.
148: %\immediate\write16{Column \folio\abc\space starts with \firstmark}
149: \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
150: \else\if a\abc
151: \global\setbox\columna\columnbox \global\def\abc{b}
152: %% in case we never use \columnb (two-column mode)
153: \global\setbox\columnb\hbox to -\intercolumnskip{}
154: \else
155: \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
156: \def\multicolumnformat{\shipout\vbox{\makeheadline
157: \hbox{\box\columna\hskip\intercolumnskip
158: \box\columnb\hskip\intercolumnskip\columnbox}
159: \makefootline}\advancepageno}
160: \def\columnbox{\leftline{\pagebody}}
161:
162: \def\bye{\par\vfill\supereject
163: \if a\abc \else\null\vfill\eject\fi
164: \if a\abc \else\null\vfill\eject\fi
165: \end}
166: \fi
167:
168: % we won't be using math mode much, so redefine some of the characters
169: % we might want to talk about
170: \catcode`\^=12
171: \catcode`\_=12
172:
173: \chardef\\=`\\
174: \chardef\{=`\{
175: \chardef\}=`\}
176:
177: \hyphenation{mini-buf-fer}
178:
179: \parindent 0pt
180: \parskip 1ex plus .5ex minus .5ex
181:
182: \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
183:
184: \outer\def\newcolumn{\vfill\eject}
185:
186: \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
187:
188: \outer\def\section#1{\par\filbreak
189: \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
190: \vskip 2ex plus 1ex minus 1.5ex}
191:
192: \newdimen\keyindent
193:
194: \def\beginindentedkeys{\keyindent=1em}
195: \def\endindentedkeys{\keyindent=0em}
196: \endindentedkeys
197:
198: \def\paralign{\vskip\parskip\halign}
199:
200: \def\<#1>{$\langle${\rm #1}$\rangle$}
201:
202: \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
203:
204: \def\beginexample{\par\leavevmode\begingroup
205: \obeylines\obeyspaces\parskip0pt\tt}
206: {\obeyspaces\global\let =\ }
207: \def\endexample{\endgroup}
208:
209: \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
210: {\hsize=.75\hsize\rightskip=1em
211: \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
212:
213: \newbox\metaxbox
214: \setbox\metaxbox\hbox{\kbd{M-x }}
215: \newdimen\metaxwidth
216: \metaxwidth=\wd\metaxbox
217:
218: \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
219: {\hskip\keyindent\relax#1\hfil}%
220: \hskip -\metaxwidth minus 1fil
221: \kbd{#2}\hfil}}
222:
223: \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
224: &\kbd{#3}\quad\cr}
225:
226: %**end of header
227:
228:
229: \title{GNU Emacs Reference Card}
230:
231: \centerline{(for version 18)}
232:
233: \section{Starting Emacs}
234:
235: To enter Emacs, just type its name: \kbd{emacs}
236:
237: To read in a file to edit, see Files, below.
238:
239: \section{Leaving Emacs}
240:
241: \key{suspend Emacs (the usual way of leaving it)}{C-z}
242: \key{exit Emacs permanently}{C-x C-c}
243:
244: \section{Files}
245:
246: \key{{\bf read} a file into Emacs}{C-x C-f}
247: \key{{\bf save} a file back to disk}{C-x C-s}
248: \key{{\bf insert} contents of another file into this buffer}{C-x i}
249: \key{replace this file with the file you really want}{C-x C-v}
250: \key{write buffer to a specified file}{C-x C-w}
251: \key{run Dired, the directory editor}{C-x d}
252:
253: \section{Getting Help}
254:
255: The Help system is simple. Type \kbd{C-h} and follow the directions.
256: If you are a first-time user, type \kbd{C-h t} for a {\bf tutorial}.
257: (This card assumes you know the tutorial.)
258:
259: \key{get rid of Help window}{C-x 1}
260: \key{scroll Help window}{ESC C-v}
261:
262: \key{apropos: show commands matching a string}{C-h a}
263: \key{show the function a key runs}{C-h c}
264: \key{describe a function}{C-h f}
265: \key{get mode-specific information}{C-h m}
266:
267: \section{Error Recovery}
268:
269: \key{{\bf abort} partially typed or executing command}{C-g}
270: \metax{{\bf recover} a file lost by a system crash}{M-x recover-file}
271: \key{{\bf undo} an unwanted change}{C-x u {\rm or} C-_}
272: \metax{restore a buffer to its original contents}{M-x revert-buffer}
273: \key{redraw garbaged screen}{C-l}
274:
275: \section{Incremental Search}
276:
277: \key{search forward}{C-s}
278: \key{search backward}{C-r}
279: \key{regular expression search}{C-M-s}
280:
281: Use \kbd{C-s} or \kbd{C-r} again to repeat the search in either direction.
282:
283: \key{exit incremental search}{ESC}
284: \key{undo effect of last character}{DEL}
285: \key{abort current search}{C-g}
286:
287: If Emacs is still searching, \kbd{C-g} will cancel the
288: part of the search not done, otherwise it aborts the entire search.
289:
290: \shortcopyrightnotice
291:
292: \section{Motion}
293:
294: Cursor motion:
295:
296: \beginindentedkeys
297:
298: \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
299: \threecol{{\bf entity to move over}}{{\bf backward}}{{\bf forward}}
300: \threecol{character}{C-b}{C-f}
301: \threecol{word}{M-b}{M-f}
302: \threecol{line}{C-p}{C-n}
303: \threecol{go to line beginning (or end)}{C-a}{C-e}
304: \threecol{sentence}{M-a}{M-e}
305: \threecol{paragraph}{M-[}{M-]}
306: \threecol{page}{C-x [}{C-x ]}
307: \threecol{sexp}{C-M-b}{C-M-f}
308: \threecol{function}{C-M-a}{C-M-e}
309: \threecol{go to buffer beginning (or end)}{M-<}{M->}
310: }
311: Screen motion:
312:
313: \key{scroll to next screen}{C-v}
314: \key{scroll to previous screen}{M-v}
315: \key{scroll left}{C-x <}
316: \key{scroll right}{C-x >}
317:
318: \endindentedkeys
319:
320: \section{Killing and Deleting}
321:
322: \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
323: \threecol{{\bf entity to kill}}{{\bf backward}}{{\bf forward}}
324: \threecol{character (delete, not kill)}{DEL}{C-d}
325: \threecol{word}{M-DEL}{M-d}
326: \threecol{line (to end of)}{M-0 C-k}{C-k}
327: \threecol{sentence}{C-x DEL}{M-k}
328: \threecol{sexp}{M-- C-M-k}{C-M-k}
329: }
330:
331: \key{kill {\bf region}}{C-w}
332: \key{kill to next occurrence of {\it char}}{M-z {\it char}}
333:
334: \key{yank back last thing killed}{C-y}
335: \key{replace last yank with previous kill}{M-y}
336:
337: \section{Marking}
338:
339: \key{set mark here}{C-@ {\rm or} C-SPC}
340: \key{exchange point and mark}{C-x C-x}
341:
342: \key{set mark {\it arg\/} {\bf words} away}{M-@}
343: \key{mark {\bf paragraph}}{M-h}
344: \key{mark {\bf page}}{C-x C-p}
345: \key{mark {\bf sexp}}{C-M-@}
346: \key{mark {\bf function}}{C-M-h}
347: \key{mark entire {\bf buffer}}{C-x h}
348:
349: \section{Query Replace}
350:
351: \key{interactively replace a text string}{M-\%}
352: \metax{using regular expressions}{M-x query-replace-regexp}
353:
354: Valid responses in query-replace mode are
355:
356: \key{{\bf replace} this one, go on to next}{SPC}
357: \key{replace this one, don't move}{,}
358: \key{{\bf skip} to next without replacing}{DEL}
359: \key{replace all remaining matches}{!}
360: \key{{\bf back up} to the previous match}{^}
361: \key{{\bf exit} query-replace}{ESC}
362: \key{enter recursive edit (\kbd{C-M-c} to exit)}{C-r}
363:
364: \section{Multiple Windows}
365:
366: \key{delete all other windows}{C-x 1}
367: \key{delete this window}{C-x 0}
368: \key{split window in 2 vertically}{C-x 2}
369: \key{split window in 2 horizontally}{C-x 5}
370:
371: \key{scroll other window}{C-M-v}
372: \key{switch cursor to another window}{C-x o}
373:
374: \metax{shrink window shorter}{M-x shrink-window}
375: \key{grow window taller}{C-x ^}
376: \key{shrink window narrower}{C-x \{}
377: \key{grow window wider}{C-x \}}
378:
379: \key{select a buffer in other window}{C-x 4 b}
380: \key{find file in other window}{C-x 4 f}
381: \key{compose mail in other window}{C-x 4 m}
382: \key{run Dired in other window}{C-x 4 d}
383: \key{find tag in other window}{C-x 4 .}
384:
385: \section{Formatting}
386:
387: \key{indent current {\bf line} (mode-dependent)}{TAB}
388: \key{indent {\bf region} (mode-dependent)}{C-M-\\}
389: \key{indent {\bf sexp} (mode-dependent)}{C-M-q}
390: \key{indent region rigidly {\it arg\/} columns}{C-x TAB}
391:
392: \key{insert newline after point}{C-o}
393: \key{move rest of line vertically down}{C-M-o}
394: \key{delete blank lines around point}{C-x C-o}
395: \key{delete all whitespace around point}{M-\\}
396: \key{put exactly one space at point}{M-SPC}
397:
398: \key{fill {\bf paragraph}}{M-q}
399: \key{fill {\bf region}}{M-g}
400: \key{set fill column}{C-x f}
401: \key{set prefix each line starts with}{C-x .}
402:
403: \section{Case Change}
404:
405: \key{uppercase word}{M-u}
406: \key{lowercase word}{M-l}
407: \key{capitalize word}{M-c}
408:
409: \key{uppercase region}{C-x C-u}
410: \key{lowercase region}{C-x C-l}
411: \metax{capitalize region}{M-x capitalize-region}
412:
413: \section{The Minibuffer}
414:
415: The following keys are defined in the minibuffer.
416:
417: \key{complete as much as possible}{TAB}
418: \key{complete up to one word}{SPC}
419: \key{complete and execute}{RET}
420: \key{show possible completions}{?}
421: \key{abort command}{C-g}
422:
423: Type \kbd{C-x ESC} to edit and repeat the last command that used the
424: minibuffer. The following keys are then defined.
425:
426: \key{previous minibuffer command}{M-p}
427: \key{next minibuffer command}{M-n}
428:
429: \newcolumn
430: \title{GNU Emacs Reference Card}
431:
432: \section{Buffers}
433:
434: \key{select another buffer}{C-x b}
435: \key{list all buffers}{C-x C-b}
436: \key{kill a buffer}{C-x k}
437:
438: \section{Transposing}
439:
440: \key{transpose {\bf characters}}{C-t}
441: \key{transpose {\bf words}}{M-t}
442: \key{transpose {\bf lines}}{C-x C-t}
443: \key{transpose {\bf sexps}}{C-M-t}
444:
445: \section{Spelling Check}
446:
447: \key{check spelling of current word}{M-\$}
448: \metax{check spelling of all words in region}{M-x spell-region}
449: \metax{check spelling of entire buffer}{M-x spell-buffer}
450:
451: \section{Tags}
452:
453: \key{find tag}{M-.}
454: \key{find next occurrence of tag}{C-u M-.}
455: \metax{specify a new tags file}{M-x visit-tags-table}
456:
457: \metax{regexp search on all files in tags table}{M-x tags-search}
458: \metax{query replace on all the files}{M-x tags-query-replace}
459: \key{continue last tags search or query-replace}{M-,}
460:
461: \section{Shells}
462:
463: \key{execute a shell command}{M-!}
464: \key{run a shell command on the region}{M-|}
465: \key{filter region through a shell command}{C-u M-|}
466: \metax{start a shell in window \kbd{*shell*}}{M-x shell}
467:
468: \section{Rmail}
469:
470: \key{scroll forward}{SPC}
471: \key{scroll reverse}{DEL}
472: \key{beginning of message}{. {\rm (dot)}}
473: \key{{\bf next} non-deleted message}{n}
474: \key{{\bf previous} non-deleted message}{p}
475: \key{next message}{M-n}
476: \key{previous message}{M-p}
477: \key{{\bf delete} message}{d}
478: \key{delete message and back up}{C-d}
479: \key{undelete message}{u}
480: \key{{\bf reply} to message}{r}
481: \key{forward message to someone}{f}
482: \key{send mail}{m}
483: \key{{\bf get} newly arrived mail}{g}
484: \key{{\bf quit} Rmail}{q}
485: \key{output message to another Rmail file}{o}
486: \key{output message in Unix-mail style}{C-o}
487: \key{show summary of headers}{h}
488:
489: \section{Regular Expressions}
490:
491: The following have special meaning inside a regular expression.
492:
493: \key{any single character}{. {\rm(dot)}}
494: \key{zero or more repeats}{*}
495: \key{one or more repeats}{+}
496: \key{zero or one repeat}{?}
497: \key{any character in set}{[ {\rm$\ldots$} ]}
498: \key{any character not in set}{[^ {\rm$\ldots$} ]}
499: \key{beginning of line}{^}
500: \key{end of line}{\$}
501: \key{quote a special character {\it c\/}}{\\{\it c}}
502: \key{alternative (``or'')}{\\|}
503: \key{grouping}{\\( {\rm$\ldots$} \\)}
504: \key{{\it n\/}th group}{\\{\it n}}
505: \key{beginning of buffer}{\\`}
506: \key{end of buffer}{\\'}
507: \key{word break}{\\b}
508: \key{not beginning or end of word}{\\B}
509: \key{beginning of word}{\\<}
510: \key{end of word}{\\>}
511: \key{any word-syntax character}{\\w}
512: \key{any non-word-syntax character}{\\W}
513: \key{character with syntax {\it c}}{\\s{\it c}}
514: \key{character with syntax not {\it c}}{\\S{\it c}}
515:
516: \section{Registers}
517:
518: \key{copy region to register}{C-x x}
519: \key{insert register contents}{C-x g}
520:
521: \key{save point in register}{C-x /}
522: \key{move point to saved location}{C-x j}
523:
524: \section{Info}
525:
526: \key{enter the Info documentation reader}{C-h i}
527: \beginindentedkeys
528:
529: Moving within a node:
530:
531: \key{scroll forward}{SPC}
532: \key{scroll reverse}{DEL}
533: \key{beginning of node}{. {\rm (dot)}}
534:
535: Moving between nodes:
536:
537: \key{{\bf next} node}{n}
538: \key{{\bf previous} node}{p}
539: \key{move {\bf up}}{u}
540: \key{select menu item by name}{m}
541: \key{select {\it n\/}th menu item by number (1--5)}{{\it n}}
542: \key{follow cross reference (return with \kbd{l})}{f}
543: \key{return to last node you saw}{l}
544: \key{return to directory node}{d}
545: \key{go to any node by name}{g}
546:
547: Other:
548:
549: \key{run Info {\bf tutorial}}{h}
550: \key{list Info commands}{?}
551: \key{{\bf quit} Info}{q}
552: \key{search nodes for regexp}{s}
553:
554: \endindentedkeys
555:
556: \section{Keyboard Macros}
557:
558: \key{{\bf start} defining a keyboard macro}{C-x (}
559: \key{{\bf end} keyboard macro definition}{C-x )}
560: \key{{\bf execute} last-defined keyboard macro}{C-x e}
561: \key{append to last keyboard macro}{C-u C-x (}
562: \metax{name last keyboard macro}{M-x name-last-kbd-macro}
563: \metax{insert lisp definition in buffer}{M-x insert-kbd-macro}
564:
565: \section{Commands Dealing with Emacs Lisp}
566:
567: \key{eval {\bf sexp} before point}{C-x C-e}
568: \key{eval current {\bf defun}}{C-M-x}
569: \metax{eval {\bf region}}{M-x eval-region}
570: \metax{eval entire {\bf buffer}}{M-x eval-current-buffer}
571: \key{read and eval minibuffer}{M-ESC}
572: \key{re-execute last minibuffer command}{C-x ESC}
573: \metax{read and eval Emacs Lisp file}{M-x load-file}
574: \metax{load from standard system directory}{M-x load-library}
575:
576: \section{Simple Customization}
577:
578: % The intended audience here is the person who wants to make simple
579: % customizations and knows Lisp syntax.
580:
581: Here are some examples of binding global keys in Emacs Lisp. Note
582: that you cannot say \kbd{"\\M-\#"}; you must say \kbd{"\\e\#"}.
583:
584: \beginexample%
585: (global-set-key "\\C-cg" 'goto-line)
586: (global-set-key "\\e\\C-r" 'isearch-backward-regexp)
587: (global-set-key "\\e\#" 'query-replace-regexp)
588: \endexample
589:
590: An example of setting a variable in Emacs Lisp:
591:
592: \beginexample%
593: (setq backup-by-copying-when-linked t)
594: \endexample
595:
596: \section{Writing Commands}
597:
598: \beginexample%
599: (defun \<command-name> (\<args>)
600: "\<documentation>"
601: (interactive "\<template>")
602: \<body>)
603: \endexample
604:
605: An example:
606:
607: \beginexample%
608: (defun this-line-to-top-of-screen (line)
609: "Reposition line point is on to the top of
610: the screen. With ARG, put point on line ARG.
611: Negative counts from bottom."
612: (interactive "P")
613: (recenter (if (null line)
614: 0
615: (prefix-numeric-value line))))
616: \endexample
617:
618: The argument to \kbd{interactive} is a string specifying how to get
619: the arguments when the function is called interactively.
620: Type \kbd{C-h f interactive} for more information.
621:
622: \copyrightnotice
623:
624: \bye
625:
626: % Local variables:
627: % compile-command: "tex refcard"
628: % End:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.