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