(B-A1E3): Don't map to U+223C.
[chise/xemacs-chise.git.1] / etc / refcard.tex
1 % Reference Card for XEmacs on Unix systems
2 % Time-stamp: <95/02/18 Ben Wing>
3 %**start of header
4 \newcount\columnsperpage
5
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.
8
9 \columnsperpage=1
10
11 % Copyright (c) 1987, 1993, 1995 Free Software Foundation, Inc.
12
13 % This file is part of XEmacs.
14
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)
18 % any later version.
19
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.
24
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.
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 %  Internet: gildea@mit.edu
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 a section on Dired.
53
54 \def\versionnumber{2.0 XEmacs}
55 \def\year{1998}
56 \def\version{April \year\ v\versionnumber}
57
58 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
59   \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
60   Permissions on back.  v\versionnumber}}
61
62 \def\copyrightnotice{
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}
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
75 USA.
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       %horizontal space between columns
84 \newbox\columna                 %boxes to hold columns already built
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 October 1986.
95 % Note that the 1-column format is fontfamily-independent.
96 \if 1\ncolumns                  %one-column format uses normal size
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                           %2 or 3 columns uses prereduced size
108   \hsize 3.2in
109   \vsize 7.95in
110   \hoffset -.75in
111   \voffset -.745in
112   \font\titlefont=cmbx10 \scaledmag2
113   \font\headingfont=cmbx10 \scaledmag1
114   \font\smallfont=cmr6
115   \font\smallsy=cmsy6
116   \font\eightrm=cmr8
117   \font\eightbf=cmbx8
118   \font\eightit=cmti8
119   \font\eighttt=cmtt8
120   \font\eightmi=cmmi8
121   \font\eightsy=cmsy8
122   \textfont0=\eightrm
123   \textfont1=\eightmi
124   \textfont2=\eightsy
125   \def\rm{\eightrm}
126   \def\bf{\eightbf}
127   \def\it{\eightit}
128   \def\tt{\eighttt}
129   \normalbaselineskip=.8\normalbaselineskip
130   \normallineskip=.8\normallineskip
131   \normallineskiplimit=.8\normallineskiplimit
132   \normalbaselines\rm           %make definitions take effect
133
134   \if 2\ncolumns
135     \let\maxcolumn=b
136     \footline{\hss\rm\folio\hss}
137     \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
138   \else \if 3\ncolumns
139     \let\maxcolumn=c
140     \nopagenumbers
141   \else
142     \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
143     \errmessage{Illegal number of columns per page}
144   \fi\fi
145
146   \intercolumnskip=.46in
147   \def\abc{a}
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}
152       \else\if a\abc
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{}
156       \else
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}}
163
164   \def\bye{\par\vfill\supereject
165     \if a\abc \else\null\vfill\eject\fi
166     \if a\abc \else\null\vfill\eject\fi
167     \end}  
168 \fi
169
170 % we won't be using math mode much, so redefine some of the characters
171 % we might want to talk about
172 \catcode`\^=12
173 \catcode`\_=12
174
175 \chardef\\=`\\
176 \chardef\{=`\{
177 \chardef\}=`\}
178
179 \hyphenation{mini-buf-fer}
180
181 \parindent 0pt
182 \parskip 1ex plus .5ex minus .5ex
183
184 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
185
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}
189
190 % title - page title.  Argument is title text.
191 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
192
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}
197
198 \newdimen\keyindent
199
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}
205 \endindentedkeys
206
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}
211
212 % \<...> - surrounds a variable name in a code example
213 \def\<#1>{{\it #1\/}}
214
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
217
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}
224
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}}
232
233 \newbox\metaxbox
234 \setbox\metaxbox\hbox{\kbd{M-x }}
235 \newdimen\metaxwidth
236 \metaxwidth=\wd\metaxbox
237
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
245   \kbd{#2}\hfil}}
246
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}
251
252 %**end of header
253 \f
254
255 \title{XEmacs Reference Card}
256
257 \centerline{(for version 21.0+)}
258
259 \section{Starting Emacs}
260
261 To enter XEmacs, just type its name: \kbd{xemacs}
262
263 To read in a file to edit, see Files, below.
264
265 \section{Leaving Emacs}
266
267 \key{suspend Emacs (or iconify frame under X)}{C-z}
268 \key{exit Emacs permanently}{C-x C-c}
269
270 \section{Files}
271
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}
278
279 \section{Getting Help}
280
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}.
283
284 \key{quit Help window}{q}
285 \key{scroll Help window}{space}
286
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}
291
292 \section{Error Recovery}
293
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}
300
301 \section{Incremental Search}
302
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}
307
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}
313
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.
316
317 \shortcopyrightnotice
318
319 \section{Motion}
320
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->}
333 }
334
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}
340
341 \section{Killing and Deleting}
342
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}
350 }
351
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}}
355
356 \key{yank back last thing killed}{C-y}
357 \key{replace last yank with previous kill}{M-y}
358
359 \section{Marking}
360
361 \key{set mark here}{C-@ {\rm or} C-SPC}
362 \key{exchange point and mark}{C-x C-x}
363
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}
370
371 \section{Query Replace}
372
373 \key{interactively replace a text string}{M-\%}
374 \metax{using regular expressions}{M-x query-replace-regexp}
375
376 Valid responses in query-replace mode are
377
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}
386
387 \section{Multiple Windows}
388
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}
393
394 \key{scroll other window}{C-M-v}
395 \key{switch cursor to another window}{C-x o}
396
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 \}}
401
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 .}
408
409 \section{Formatting}
410
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}
415
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}
422
423 \key{fill paragraph}{M-q}
424 \key{set fill column}{C-x f}
425 \key{set prefix each line starts with}{C-x .}
426
427 \section{Case Change}
428
429 \key{uppercase word}{M-u}
430 \key{lowercase word}{M-l}
431 \key{capitalize word}{M-c}
432
433 \key{uppercase region}{C-x C-u}
434 \key{lowercase region}{C-x C-l}
435 \metax{capitalize region}{M-x capitalize-region}
436
437 \section{The Minibuffer}
438
439 The following keys are defined in the minibuffer.
440
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}
450
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.
453
454 \key{previous minibuffer command}{M-p}
455 \key{next minibuffer command}{M-n}
456
457 \newcolumn
458 \title{XEmacs Reference Card}
459
460 \section{Buffers}
461
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}
465
466 \section{Transposing}
467
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}
472
473 \section{Spelling Check}
474
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}
478
479 \section{Tags}
480
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}
484
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-,}
488
489 \section{Shells}
490
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}
495
496 \section{Rectangles}
497
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}
505
506 \section{Abbrevs}
507
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}
513
514 \key{expand previous word dynamically}{M-/}
515
516 \section{Regular Expressions}
517
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}}
540
541 \section{Registers}
542
543 \key{save region in register}{C-x r s}
544 \key{insert register contents into buffer}{C-x r i}
545
546 \key{save value of point in register}{C-x r SPC}
547 \key{jump to point saved in register}{C-x r j}
548
549 \section{Info}
550
551 \key{enter the Info documentation reader}{C-h i}
552 \beginindentedkeys
553
554 Moving within a node:
555
556 \key{scroll forward}{SPC}
557 \key{scroll reverse}{DEL}
558 \key{beginning of node}{. {\rm (dot)}}
559
560 Moving between nodes:
561
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}
571
572 Other:
573
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}
578
579 \endindentedkeys
580
581 \section{Keyboard Macros}
582
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}
590
591 \section{Commands Dealing with Emacs Lisp}
592
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}
601
602 \section{Simple Customization}
603
604 % The intended audience here is the person who wants to make simple
605 % customizations and knows Lisp syntax.
606
607 Here are some examples of binding global keys in Emacs Lisp.
608
609 \beginexample%
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)
613 \endexample
614
615 An example of setting a variable in Emacs Lisp:
616
617 \beginexample%
618 (setq backup-by-copying-when-linked t)
619 \endexample
620
621 \section{Writing Commands}
622
623 \beginexample%
624 (defun \<command-name> (\<args>)
625   "\<documentation>"
626   (interactive "\<template>")
627   \<body>)
628 \endexample
629
630 An example:
631
632 \beginexample%
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."
637   (interactive "P")
638   (recenter (if (null line)
639                 0
640               (prefix-numeric-value line))))
641 \endexample
642
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.
646
647 \copyrightnotice
648
649 \bye
650 \f
651 % Local variables:
652 % compile-command: "tex refcard"
653 % End: