1 % Reference Card for XEmacs on Unix systems
2 % Time-stamp: <95/02/18 Ben Wing>
4 \newcount\columnsperpage
6 % This file can be printed with 1, 2, or 3 columns per page (see below).
7 % Specify how many you want here. Nothing else needs to be changed.
11 % Copyright (c) 1987, 1993, 1995 Free Software Foundation, Inc.
13 % This file is part of XEmacs.
15 % XEmacs is free software; you can redistribute it and/or modify
16 % it under the terms of the GNU General Public License as published by
17 % the Free Software Foundation; either version 1, or (at your option)
20 % XEmacs is distributed in the hope that it will be useful,
21 % but WITHOUT ANY WARRANTY; without even the implied warranty of
22 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 % GNU General Public License for more details.
25 % You should have received a copy of the GNU General Public License
26 % along with XEmacs; see the file COPYING. If not, write to
27 % the Free Software Foundation, 675 Mass Ave, Cambridge MA 02139, USA.
29 % This file is intended to be processed by plain TeX (TeX82).
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:
34 % produces six separate pages, each of which needs to be reduced to 80%.
35 % This gives the best resolution.
37 % produces three already-reduced pages.
38 % You will still need to cut and paste.
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.
47 % Internet: gildea@mit.edu
49 % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
50 % for their many good ideas.
52 % If there were room, it would be nice to see a section on Dired.
54 \def\versionnumber{2.0 XEmacs}
56 \def\version{April \year\ v\versionnumber}
58 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
59 \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
60 Permissions on back. v\versionnumber}}
63 \vskip 1ex plus 2 fill\begingroup\small
64 \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
65 \centerline{designed by Stephen Gildea, \version}
66 \centerline{for GNU Emacs version 19 on Unix systems}
67 \centerline{Updated for XEmacs in February 1995 by Ben Wing}
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.
73 For copies of the GNU Emacs manual, write to the Free Software
74 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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}
83 \newdimen\intercolumnskip %horizontal space between columns
84 \newbox\columna %boxes to hold columns already built
87 \def\ncolumns{\the\columnsperpage}
89 \message{[\ncolumns\space
90 column\if 1\ncolumns\else s\fi\space per page]}
92 \def\scaledmag#1{ scaled \magstep #1}
94 % This multi-way format was designed by Stephen Gildea October 1986.
95 % Note that the 1-column format is fontfamily-independent.
96 \if 1\ncolumns %one-column format uses normal size
100 \font\titlefont=\fontname\tenbf \scaledmag3
101 \font\headingfont=\fontname\tenbf \scaledmag2
102 \font\smallfont=\fontname\sevenrm
103 \font\smallsy=\fontname\sevensy
105 \footline{\hss\folio}
106 \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
107 \else %2 or 3 columns uses prereduced size
112 \font\titlefont=cmbx10 \scaledmag2
113 \font\headingfont=cmbx10 \scaledmag1
129 \normalbaselineskip=.8\normalbaselineskip
130 \normallineskip=.8\normallineskip
131 \normallineskiplimit=.8\normallineskiplimit
132 \normalbaselines\rm %make definitions take effect
136 \footline{\hss\rm\folio\hss}
137 \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
142 \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
143 \errmessage{Illegal number of columns per page}
146 \intercolumnskip=.46in
148 \output={% %see The TeXbook page 257
149 % This next line is useful when designing the layout.
150 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
151 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
153 \global\setbox\columna\columnbox \global\def\abc{b}
154 %% in case we never use \columnb (two-column mode)
155 \global\setbox\columnb\hbox to -\intercolumnskip{}
157 \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
158 \def\multicolumnformat{\shipout\vbox{\makeheadline
159 \hbox{\box\columna\hskip\intercolumnskip
160 \box\columnb\hskip\intercolumnskip\columnbox}
161 \makefootline}\advancepageno}
162 \def\columnbox{\leftline{\pagebody}}
164 \def\bye{\par\vfill\supereject
165 \if a\abc \else\null\vfill\eject\fi
166 \if a\abc \else\null\vfill\eject\fi
170 % we won't be using math mode much, so redefine some of the characters
171 % we might want to talk about
179 \hyphenation{mini-buf-fer}
182 \parskip 1ex plus .5ex minus .5ex
184 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
186 % newcolumn - force a new column. Use sparingly, probably only for
187 % the first column of a page, which should have a title anyway.
188 \outer\def\newcolumn{\vfill\eject}
190 % title - page title. Argument is title text.
191 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
193 % section - new major section. Argument is section name.
194 \outer\def\section#1{\par\filbreak
195 \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
196 \vskip 2ex plus 1ex minus 1.5ex}
200 % beginindentedkeys...endindentedkeys - key definitions will be
201 % indented, but running text, typically used as headings to group
202 % definitions, will not.
203 \def\beginindentedkeys{\keyindent=1em}
204 \def\endindentedkeys{\keyindent=0em}
207 % paralign - begin paragraph containing an alignment.
208 % If an \halign is entered while in vertical mode, a parskip is never
209 % inserted. Using \paralign instead of \halign solves this problem.
210 \def\paralign{\vskip\parskip\halign}
212 % \<...> - surrounds a variable name in a code example
213 \def\<#1>{{\it #1\/}}
215 % kbd - argument is characters typed literally. Like the Texinfo command.
216 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
218 % beginexample...endexample - surrounds literal text, such a code example.
219 % typeset in a typewriter font with line breaks preserved
220 \def\beginexample{\par\leavevmode\begingroup
221 \obeylines\obeyspaces\parskip0pt\tt}
222 {\obeyspaces\global\let =\ }
223 \def\endexample{\endgroup}
225 % key - definition of a key.
226 % \key{description of key}{key-name}
227 % prints the description left-justified, and the key-name in a \kbd
228 % form near the right margin.
229 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
230 {\hsize=.75\hsize\rightskip=1em
231 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
234 \setbox\metaxbox\hbox{\kbd{M-x }}
236 \metaxwidth=\wd\metaxbox
238 % metax - definition of a M-x command.
239 % \metax{description of command}{M-x command-name}
240 % Tries to justify the beginning of the command name at the same place
241 % as \key starts the key name. (The "M-x " sticks out to the left.)
242 \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
243 {\hskip\keyindent\relax#1\hfil}%
244 \hskip -\metaxwidth minus 1fil
247 % threecol - like "key" but with two key names.
248 % for example, one for doing the action backward, and one for forward.
249 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\hfil\quad
250 &\kbd{#3}\hfil\quad\cr}
255 \title{XEmacs Reference Card}
257 \centerline{(for version 21.0+)}
259 \section{Starting Emacs}
261 To enter XEmacs, just type its name: \kbd{xemacs}
263 To read in a file to edit, see Files, below.
265 \section{Leaving Emacs}
267 \key{suspend Emacs (or iconify frame under X)}{C-z}
268 \key{exit Emacs permanently}{C-x C-c}
272 \key{{\bf read} a file into Emacs}{C-x C-f}
273 \key{{\bf save} a file back to disk}{C-x C-s}
274 \key{save {\bf all} files}{C-x s}
275 \key{{\bf insert} contents of another file into this buffer}{C-x i}
276 \key{replace this file with the file you really want}{C-x C-v}
277 \key{write buffer to a specified file}{C-x C-w}
279 \section{Getting Help}
281 The Help system is simple. Type \kbd{C-h} and follow the directions.
282 If you are a first-time user, type \kbd{C-h t} for a {\bf tutorial}.
284 \key{quit Help window}{q}
285 \key{scroll Help window}{space}
287 \key{apropos: show commands matching a string}{C-h a}
288 \key{show the function a key runs}{C-h c}
289 \key{describe a function}{C-h f}
290 \key{get mode-specific information}{C-h m}
292 \section{Error Recovery}
294 \key{{\bf abort} partially typed or executing command}{C-g}
295 \metax{{\bf recover} a file lost by a system crash}{M-x recover-file}
296 \metax{{\bf recover} files from a previous Emacs session}{M-x recover-session}
297 \key{{\bf undo} an unwanted change}{C-x u {\rm or} C-_}
298 \metax{restore a buffer to its original contents}{M-x revert-buffer}
299 \key{redraw garbaged screen}{C-l}
301 \section{Incremental Search}
303 \key{search forward}{C-s}
304 \key{search backward}{C-r}
305 \key{regular expression search}{C-M-s}
306 \key{reverse regular expression search}{C-M-r}
308 \key{select previous search string}{M-p}
309 \key{select next later search string}{M-n}
310 \key{exit incremental search}{RET}
311 \key{undo effect of last character}{DEL}
312 \key{abort current search}{C-g}
314 Use \kbd{C-s} or \kbd{C-r} again to repeat the search in either direction.
315 If Emacs is still searching, \kbd{C-g} cancels only the part not done.
317 \shortcopyrightnotice
321 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
322 \threecol{{\bf entity to move over}}{{\bf backward}}{{\bf forward}}
323 \threecol{character}{C-b}{C-f}
324 \threecol{word}{M-b}{M-f}
325 \threecol{line}{C-p}{C-n}
326 \threecol{go to line beginning (or end)}{C-a}{C-e}
327 \threecol{sentence}{M-a}{M-e}
328 \threecol{paragraph}{M-\{}{M-\}}
329 \threecol{page}{C-x [}{C-x ]}
330 \threecol{sexp}{C-M-b}{C-M-f}
331 \threecol{function}{C-M-a}{C-M-e}
332 \threecol{go to buffer beginning (or end)}{M-<}{M->}
335 \key{scroll to next screen}{C-v}
336 \key{scroll to previous screen}{M-v}
337 \key{scroll left}{C-x <}
338 \key{scroll right}{C-x >}
339 \key{scroll current line to center of screen}{C-u C-l}
341 \section{Killing and Deleting}
343 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
344 \threecol{{\bf entity to kill}}{{\bf backward}}{{\bf forward}}
345 \threecol{character (delete, not kill)}{DEL}{C-d}
346 \threecol{word}{M-DEL}{M-d}
347 \threecol{line (to end of)}{M-0 C-k}{C-k}
348 \threecol{sentence}{C-x DEL}{M-k}
349 \threecol{sexp}{M-- C-M-k}{C-M-k}
352 \key{kill {\bf region}}{C-w}
353 \key{copy region to kill ring}{M-w}
354 \key{kill through next occurrence of {\it char}}{M-z {\it char}}
356 \key{yank back last thing killed}{C-y}
357 \key{replace last yank with previous kill}{M-y}
361 \key{set mark here}{C-@ {\rm or} C-SPC}
362 \key{exchange point and mark}{C-x C-x}
364 \key{set mark {\it arg\/} {\bf words} away}{M-@}
365 \key{mark {\bf paragraph}}{M-h}
366 \key{mark {\bf page}}{C-x C-p}
367 \key{mark {\bf sexp}}{C-M-@}
368 \key{mark {\bf function}}{C-M-h}
369 \key{mark entire {\bf buffer}}{C-x h}
371 \section{Query Replace}
373 \key{interactively replace a text string}{M-\%}
374 \metax{using regular expressions}{M-x query-replace-regexp}
376 Valid responses in query-replace mode are
378 \key{{\bf replace} this one, go on to next}{SPC {\rm or} y}
379 \key{replace this one, don't move}{,}
380 \key{{\bf skip} to next without replacing}{DEL {\rm or} n}
381 \key{replace all remaining matches}{!}
382 \key{{\bf back up} to the previous match}{^}
383 \key{{\bf exit} query-replace}{ESC}
384 \key{enter recursive edit (\kbd{C-M-c} to exit)}{C-r}
385 \key{delete match and enter recursive edit}{C-w}
387 \section{Multiple Windows}
389 \key{delete all other windows}{C-x 1}
390 \key{delete this window}{C-x 0}
391 \key{split window in two vertically}{C-x 2}
392 \key{split window in two horizontally}{C-x 3}
394 \key{scroll other window}{C-M-v}
395 \key{switch cursor to another window}{C-x o}
397 \metax{shrink window shorter}{M-x shrink-window}
398 \key{grow window taller}{C-x ^}
399 \key{shrink window narrower}{C-x \{}
400 \key{grow window wider}{C-x \}}
402 \key{select buffer in other window}{C-x 4 b}
403 \key{display buffer in other window}{C-x 4 C-o}
404 \key{find file in other window}{C-x 4 f}
405 \key{find file read-only in other window}{C-x 4 r}
406 \key{run Dired in other window}{C-x 4 d}
407 \key{find tag in other window}{C-x 4 .}
411 \key{indent current {\bf line} (mode-dependent)}{TAB}
412 \key{indent {\bf region} (mode-dependent)}{C-M-\\}
413 \key{indent {\bf sexp} (mode-dependent)}{C-M-q}
414 \key{indent region rigidly {\it arg\/} columns}{C-x TAB}
416 \key{insert newline after point}{C-o}
417 \key{move rest of line vertically down}{C-M-o}
418 \key{delete blank lines around point}{C-x C-o}
419 \key{join line with previous (with arg, next)}{M-^}
420 \key{delete all white space around point}{M-\\}
421 \key{put exactly one space at point}{M-SPC}
423 \key{fill paragraph}{M-q}
424 \key{set fill column}{C-x f}
425 \key{set prefix each line starts with}{C-x .}
427 \section{Case Change}
429 \key{uppercase word}{M-u}
430 \key{lowercase word}{M-l}
431 \key{capitalize word}{M-c}
433 \key{uppercase region}{C-x C-u}
434 \key{lowercase region}{C-x C-l}
435 \metax{capitalize region}{M-x capitalize-region}
437 \section{The Minibuffer}
439 The following keys are defined in the minibuffer.
441 \key{complete as much as possible}{TAB}
442 \key{complete up to one word}{SPC}
443 \key{complete and execute}{RET}
444 \key{show possible completions}{?}
445 \key{fetch previous minibuffer input}{M-p}
446 \key{fetch next later minibuffer input}{M-n}
447 \key{regexp search backward through history}{M-r}
448 \key{regexp search forward through history}{M-s}
449 \key{abort command}{C-g}
451 Type \kbd{C-x ESC ESC} to edit and repeat the last command that used the
452 minibuffer. The following keys are then defined.
454 \key{previous minibuffer command}{M-p}
455 \key{next minibuffer command}{M-n}
458 \title{XEmacs Reference Card}
462 \key{select another buffer}{C-x b}
463 \key{list all buffers}{C-x C-b}
464 \key{kill a buffer}{C-x k}
466 \section{Transposing}
468 \key{transpose {\bf characters}}{C-t}
469 \key{transpose {\bf words}}{M-t}
470 \key{transpose {\bf lines}}{C-x C-t}
471 \key{transpose {\bf sexps}}{C-M-t}
473 \section{Spelling Check}
475 \key{check spelling of current word}{M-\$}
476 \metax{check spelling of all words in region}{M-x ispell-region}
477 \metax{check spelling of entire buffer}{M-x ispell-buffer}
481 \key{find a tag (a definition)}{M-.}
482 \key{find next occurrence of tag}{C-u M-.}
483 \metax{specify a new tags file}{M-x visit-tags-table}
485 \metax{regexp search on all files in tags table}{M-x tags-search}
486 \metax{run query-replace on all the files}{M-x tags-query-replace}
487 \key{continue last tags search or query-replace}{M-,}
491 \key{execute a shell command}{M-!}
492 \key{run a shell command on the region}{M-|}
493 \key{filter region through a shell command}{C-u M-|}
494 \metax{start a shell in window \kbd{*shell*}}{M-x shell}
498 \key{copy rectangle to register}{C-x r r}
499 \key{kill rectangle}{C-x r k}
500 \key{yank rectangle}{C-x r y}
501 \key{open rectangle, shifting text right}{C-x r o}
502 \metax{blank out rectangle}{M-x clear-rectangle}
503 \metax{prefix each line with a string}{M-x string-rectangle}
504 \key{select rectangle with mouse}{M-button1}
508 \key{add global abbrev}{C-x a g}
509 \key{add mode-local abbrev}{C-x a l}
510 \key{add global expansion for this abbrev}{C-x a i g}
511 \key{add mode-local expansion for this abbrev}{C-x a i l}
512 \key{explicitly expand abbrev}{C-x a e}
514 \key{expand previous word dynamically}{M-/}
516 \section{Regular Expressions}
518 \key{any single character except a newline}{. {\rm(dot)}}
519 \key{zero or more repeats}{*}
520 \key{one or more repeats}{+}
521 \key{zero or one repeat}{?}
522 \key{any character in the set}{[ {\rm$\ldots$} ]}
523 \key{any character not in the set}{[^ {\rm$\ldots$} ]}
524 \key{beginning of line}{^}
525 \key{end of line}{\$}
526 \key{quote a special character {\it c\/}}{\\{\it c}}
527 \key{alternative (``or'')}{\\|}
528 \key{grouping}{\\( {\rm$\ldots$} \\)}
529 \key{{\it n\/}th group}{\\{\it n}}
530 \key{beginning of buffer}{\\`}
531 \key{end of buffer}{\\'}
532 \key{word break}{\\b}
533 \key{not beginning or end of word}{\\B}
534 \key{beginning of word}{\\<}
535 \key{end of word}{\\>}
536 \key{any word-syntax character}{\\w}
537 \key{any non-word-syntax character}{\\W}
538 \key{character with syntax {\it c}}{\\s{\it c}}
539 \key{character with syntax not {\it c}}{\\S{\it c}}
543 \key{save region in register}{C-x r s}
544 \key{insert register contents into buffer}{C-x r i}
546 \key{save value of point in register}{C-x r SPC}
547 \key{jump to point saved in register}{C-x r j}
551 \key{enter the Info documentation reader}{C-h i}
554 Moving within a node:
556 \key{scroll forward}{SPC}
557 \key{scroll reverse}{DEL}
558 \key{beginning of node}{. {\rm (dot)}}
560 Moving between nodes:
562 \key{{\bf next} node}{n}
563 \key{{\bf previous} node}{p}
564 \key{move {\bf up}}{u}
565 \key{select menu item by name}{m}
566 \key{select {\it n\/}th menu item by number (1--5)}{{\it n}}
567 \key{follow cross reference (return with \kbd{l})}{f}
568 \key{return to last node you saw}{l}
569 \key{return to directory node}{d}
570 \key{go to any node by name}{g}
574 \key{run Info {\bf tutorial}}{h}
575 \key{list Info commands}{?}
576 \key{{\bf quit} Info}{q}
577 \key{search nodes for regexp}{s}
581 \section{Keyboard Macros}
583 \key{{\bf start} defining a keyboard macro}{C-x (}
584 \key{{\bf end} keyboard macro definition}{C-x )}
585 \key{{\bf execute} last-defined keyboard macro}{C-x e}
586 \key{{\bf edit} keyboard macro}{C-x C-k}
587 \key{append to last keyboard macro}{C-u C-x (}
588 \metax{name last keyboard macro}{M-x name-last-kbd-macro}
589 \metax{insert Lisp definition in buffer}{M-x insert-kbd-macro}
591 \section{Commands Dealing with Emacs Lisp}
593 \key{eval {\bf sexp} before point}{C-x C-e}
594 \key{eval current {\bf defun}}{C-M-x}
595 \metax{eval {\bf region}}{M-x eval-region}
596 \metax{eval entire {\bf buffer}}{M-x eval-current-buffer}
597 \key{read and eval minibuffer}{M-ESC}
598 \key{re-execute last minibuffer command}{C-x ESC ESC}
599 \metax{read and eval Emacs Lisp file}{M-x load-file}
600 \metax{load from standard system directory}{M-x load-library}
602 \section{Simple Customization}
604 % The intended audience here is the person who wants to make simple
605 % customizations and knows Lisp syntax.
607 Here are some examples of binding global keys in Emacs Lisp.
610 (global-set-key [(control c) g] 'goto-line)
611 (global-set-key [(control x) (control k)] 'kill-region)
612 (global-set-key [(meta \#)] 'query-replace-regexp)
615 An example of setting a variable in Emacs Lisp:
618 (setq backup-by-copying-when-linked t)
621 \section{Writing Commands}
624 (defun \<command-name> (\<args>)
626 (interactive "\<template>")
633 (defun this-line-to-top-of-window (line)
634 "Reposition line point is on to top of window.
635 With ARG, put point on line ARG.
636 Negative counts from bottom."
638 (recenter (if (null line)
640 (prefix-numeric-value line))))
643 The argument to \kbd{interactive} is a string specifying how to get
644 the arguments when the function is called interactively.
645 Type \kbd{C-h f interactive} for more information.
652 % compile-command: "tex refcard"