Build Fix -- compatibility issue with newer autoconf
[sxemacs] / etc / refcard.tex
1 % Reference Card for SXEmacs on Unix systems
2 % Time-stamp: <Monday Nov 26, 2007 11:28:48 steve>
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 SXEmacs.
14
15 % SXEmacs 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 3 of the License, or
18 % (at your option) any later version.
19
20 % SXEmacs 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 this program.  If not, see <http://www.gnu.org/licenses/>.
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 %  Internet: gildea@mit.edu
47 %
48 % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
49 % for their many good ideas.
50
51 % If there were room, it would be nice to see a section on Dired.
52
53 \def\versionnumber{2.0 SXEmacs}
54 \def\year{1998}
55 \def\version{April \year\ v\versionnumber}
56
57 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
58   \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
59   Permissions on back.  v\versionnumber}}
60
61 \def\copyrightnotice{
62 \vskip 1ex plus 2 fill\begingroup\small
63 \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
64 \centerline{designed by Stephen Gildea, \version}
65 \centerline{for GNU Emacs version 19 on Unix systems}
66 \centerline{Updated for XEmacs in February 1995 by Ben Wing}
67
68 Permission is granted to make and distribute copies of
69 this card provided the copyright notice and this permission notice
70 are preserved on all copies.
71
72 For copies of the GNU Emacs manual, write to the Free Software
73 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
74 USA.
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       %horizontal space between columns
83 \newbox\columna                 %boxes to hold columns already built
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 October 1986.
94 % Note that the 1-column format is fontfamily-independent.
95 \if 1\ncolumns                  %one-column format uses normal size
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                           %2 or 3 columns uses prereduced size
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\eightmi=cmmi8
120   \font\eightsy=cmsy8
121   \textfont0=\eightrm
122   \textfont1=\eightmi
123   \textfont2=\eightsy
124   \def\rm{\eightrm}
125   \def\bf{\eightbf}
126   \def\it{\eightit}
127   \def\tt{\eighttt}
128   \normalbaselineskip=.8\normalbaselineskip
129   \normallineskip=.8\normallineskip
130   \normallineskiplimit=.8\normallineskiplimit
131   \normalbaselines\rm           %make definitions take effect
132
133   \if 2\ncolumns
134     \let\maxcolumn=b
135     \footline{\hss\rm\folio\hss}
136     \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
137   \else \if 3\ncolumns
138     \let\maxcolumn=c
139     \nopagenumbers
140   \else
141     \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
142     \errmessage{Illegal number of columns per page}
143   \fi\fi
144
145   \intercolumnskip=.46in
146   \def\abc{a}
147   \output={%                    %see The TeXbook page 257
148       % This next line is useful when designing the layout.
149       %\immediate\write16{Column \folio\abc\space starts with \firstmark}
150       \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
151       \else\if a\abc
152         \global\setbox\columna\columnbox \global\def\abc{b}
153         %% in case we never use \columnb (two-column mode)
154         \global\setbox\columnb\hbox to -\intercolumnskip{}
155       \else
156         \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
157   \def\multicolumnformat{\shipout\vbox{\makeheadline
158       \hbox{\box\columna\hskip\intercolumnskip
159         \box\columnb\hskip\intercolumnskip\columnbox}
160       \makefootline}\advancepageno}
161   \def\columnbox{\leftline{\pagebody}}
162
163   \def\bye{\par\vfill\supereject
164     \if a\abc \else\null\vfill\eject\fi
165     \if a\abc \else\null\vfill\eject\fi
166     \end}  
167 \fi
168
169 % we won't be using math mode much, so redefine some of the characters
170 % we might want to talk about
171 \catcode`\^=12
172 \catcode`\_=12
173
174 \chardef\\=`\\
175 \chardef\{=`\{
176 \chardef\}=`\}
177
178 \hyphenation{mini-buf-fer}
179
180 \parindent 0pt
181 \parskip 1ex plus .5ex minus .5ex
182
183 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
184
185 % newcolumn - force a new column.  Use sparingly, probably only for
186 % the first column of a page, which should have a title anyway.
187 \outer\def\newcolumn{\vfill\eject}
188
189 % title - page title.  Argument is title text.
190 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
191
192 % section - new major section.  Argument is section name.
193 \outer\def\section#1{\par\filbreak
194   \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
195   \vskip 2ex plus 1ex minus 1.5ex}
196
197 \newdimen\keyindent
198
199 % beginindentedkeys...endindentedkeys - key definitions will be
200 % indented, but running text, typically used as headings to group
201 % definitions, will not.
202 \def\beginindentedkeys{\keyindent=1em}
203 \def\endindentedkeys{\keyindent=0em}
204 \endindentedkeys
205
206 % paralign - begin paragraph containing an alignment.
207 % If an \halign is entered while in vertical mode, a parskip is never
208 % inserted.  Using \paralign instead of \halign solves this problem.
209 \def\paralign{\vskip\parskip\halign}
210
211 % \<...> - surrounds a variable name in a code example
212 \def\<#1>{{\it #1\/}}
213
214 % kbd - argument is characters typed literally.  Like the Texinfo command.
215 \def\kbd#1{{\tt#1}\null}        %\null so not an abbrev even if period follows
216
217 % beginexample...endexample - surrounds literal text, such a code example.
218 % typeset in a typewriter font with line breaks preserved
219 \def\beginexample{\par\leavevmode\begingroup
220   \obeylines\obeyspaces\parskip0pt\tt}
221 {\obeyspaces\global\let =\ }
222 \def\endexample{\endgroup}
223
224 % key - definition of a key.
225 % \key{description of key}{key-name}
226 % prints the description left-justified, and the key-name in a \kbd
227 % form near the right margin.
228 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
229   {\hsize=.75\hsize\rightskip=1em
230   \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
231
232 \newbox\metaxbox
233 \setbox\metaxbox\hbox{\kbd{M-x }}
234 \newdimen\metaxwidth
235 \metaxwidth=\wd\metaxbox
236
237 % metax - definition of a M-x command.
238 % \metax{description of command}{M-x command-name}
239 % Tries to justify the beginning of the command name at the same place
240 % as \key starts the key name.  (The "M-x " sticks out to the left.)
241 \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
242   {\hskip\keyindent\relax#1\hfil}%
243   \hskip -\metaxwidth minus 1fil
244   \kbd{#2}\hfil}}
245
246 % threecol - like "key" but with two key names.
247 % for example, one for doing the action backward, and one for forward.
248 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\hfil\quad
249   &\kbd{#3}\hfil\quad\cr}
250
251 %**end of header
252 \f
253
254 \title{SXEmacs Reference Card}
255
256 \centerline{(for version 21.0+)}
257
258 \section{Starting Emacs}
259
260 To enter SXEmacs, just type its name: \kbd{sxemacs}
261
262 To read in a file to edit, see Files, below.
263
264 \section{Leaving Emacs}
265
266 \key{suspend Emacs (or iconify frame under X)}{C-z}
267 \key{exit Emacs permanently}{C-x C-c}
268
269 \section{Files}
270
271 \key{{\bf read} a file into Emacs}{C-x C-f}
272 \key{{\bf save} a file back to disk}{C-x C-s}
273 \key{save {\bf all} files}{C-x s}
274 \key{{\bf insert} contents of another file into this buffer}{C-x i}
275 \key{replace this file with the file you really want}{C-x C-v}
276 \key{write buffer to a specified file}{C-x C-w}
277
278 \section{Getting Help}
279
280 The Help system is simple.  Type \kbd{C-h} and follow the directions.
281 If you are a first-time user, type \kbd{C-h t} for a {\bf tutorial}.
282
283 \key{quit Help window}{q}
284 \key{scroll Help window}{space}
285
286 \key{apropos: show commands matching a string}{C-h a}
287 \key{show the function a key runs}{C-h c}
288 \key{describe a function}{C-h f}
289 \key{get mode-specific information}{C-h m}
290
291 \section{Error Recovery}
292
293 \key{{\bf abort} partially typed or executing command}{C-g}
294 \metax{{\bf recover} a file lost by a system crash}{M-x recover-file}
295 \metax{{\bf recover} files from a previous Emacs session}{M-x recover-session}
296 \key{{\bf undo} an unwanted change}{C-x u {\rm or} C-_}
297 \metax{restore a buffer to its original contents}{M-x revert-buffer}
298 \key{redraw garbaged screen}{C-l}
299
300 \section{Incremental Search}
301
302 \key{search forward}{C-s}
303 \key{search backward}{C-r}
304 \key{regular expression search}{C-M-s}
305 \key{reverse regular expression search}{C-M-r}
306
307 \key{select previous search string}{M-p}
308 \key{select next later search string}{M-n}
309 \key{exit incremental search}{RET}
310 \key{undo effect of last character}{DEL}
311 \key{abort current search}{C-g}
312
313 Use \kbd{C-s} or \kbd{C-r} again to repeat the search in either direction.
314 If Emacs is still searching, \kbd{C-g} cancels only the part not done.
315
316 \shortcopyrightnotice
317
318 \section{Motion}
319
320 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
321 \threecol{{\bf entity to move over}}{{\bf backward}}{{\bf forward}}
322 \threecol{character}{C-b}{C-f}
323 \threecol{word}{M-b}{M-f}
324 \threecol{line}{C-p}{C-n}
325 \threecol{go to line beginning (or end)}{C-a}{C-e}
326 \threecol{sentence}{M-a}{M-e}
327 \threecol{paragraph}{M-\{}{M-\}}
328 \threecol{page}{C-x [}{C-x ]}
329 \threecol{sexp}{C-M-b}{C-M-f}
330 \threecol{function}{C-M-a}{C-M-e}
331 \threecol{go to buffer beginning (or end)}{M-<}{M->}
332 }
333
334 \key{scroll to next screen}{C-v}
335 \key{scroll to previous screen}{M-v}
336 \key{scroll left}{C-x <}
337 \key{scroll right}{C-x >}
338 \key{scroll current line to center of screen}{C-u C-l}
339
340 \section{Killing and Deleting}
341
342 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
343 \threecol{{\bf entity to kill}}{{\bf backward}}{{\bf forward}}
344 \threecol{character (delete, not kill)}{DEL}{C-d}
345 \threecol{word}{M-DEL}{M-d}
346 \threecol{line (to end of)}{M-0 C-k}{C-k}
347 \threecol{sentence}{C-x DEL}{M-k}
348 \threecol{sexp}{M-- C-M-k}{C-M-k}
349 }
350
351 \key{kill {\bf region}}{C-w}
352 \key{copy region to kill ring}{M-w}
353 \key{kill through next occurrence of {\it char}}{M-z {\it char}}
354
355 \key{yank back last thing killed}{C-y}
356 \key{replace last yank with previous kill}{M-y}
357
358 \section{Marking}
359
360 \key{set mark here}{C-@ {\rm or} C-SPC}
361 \key{exchange point and mark}{C-x C-x}
362
363 \key{set mark {\it arg\/} {\bf words} away}{M-@}
364 \key{mark {\bf paragraph}}{M-h}
365 \key{mark {\bf page}}{C-x C-p}
366 \key{mark {\bf sexp}}{C-M-@}
367 \key{mark {\bf function}}{C-M-h}
368 \key{mark entire {\bf buffer}}{C-x h}
369
370 \section{Query Replace}
371
372 \key{interactively replace a text string}{M-\%}
373 \metax{using regular expressions}{M-x query-replace-regexp}
374
375 Valid responses in query-replace mode are
376
377 \key{{\bf replace} this one, go on to next}{SPC {\rm or} y}
378 \key{replace this one, don't move}{,}
379 \key{{\bf skip} to next without replacing}{DEL {\rm or} n}
380 \key{replace all remaining matches}{!}
381 \key{{\bf back up} to the previous match}{^}
382 \key{{\bf exit} query-replace}{ESC}
383 \key{enter recursive edit (\kbd{C-M-c} to exit)}{C-r}
384 \key{delete match and enter recursive edit}{C-w}
385
386 \section{Multiple Windows}
387
388 \key{delete all other windows}{C-x 1}
389 \key{delete this window}{C-x 0}
390 \key{split window in two vertically}{C-x 2}
391 \key{split window in two horizontally}{C-x 3}
392
393 \key{scroll other window}{C-M-v}
394 \key{switch cursor to another window}{C-x o}
395
396 \metax{shrink window shorter}{M-x shrink-window}
397 \key{grow window taller}{C-x ^}
398 \key{shrink window narrower}{C-x \{}
399 \key{grow window wider}{C-x \}}
400
401 \key{select buffer in other window}{C-x 4 b}
402 \key{display buffer in other window}{C-x 4 C-o}
403 \key{find file in other window}{C-x 4 f}
404 \key{find file read-only in other window}{C-x 4 r}
405 \key{run Dired in other window}{C-x 4 d}
406 \key{find tag in other window}{C-x 4 .}
407
408 \section{Formatting}
409
410 \key{indent current {\bf line} (mode-dependent)}{TAB}
411 \key{indent {\bf region} (mode-dependent)}{C-M-\\}
412 \key{indent {\bf sexp} (mode-dependent)}{C-M-q}
413 \key{indent region rigidly {\it arg\/} columns}{C-x TAB}
414
415 \key{insert newline after point}{C-o}
416 \key{move rest of line vertically down}{C-M-o}
417 \key{delete blank lines around point}{C-x C-o}
418 \key{join line with previous (with arg, next)}{M-^}
419 \key{delete all white space around point}{M-\\}
420 \key{put exactly one space at point}{M-SPC}
421
422 \key{fill paragraph}{M-q}
423 \key{set fill column}{C-x f}
424 \key{set prefix each line starts with}{C-x .}
425
426 \section{Case Change}
427
428 \key{uppercase word}{M-u}
429 \key{lowercase word}{M-l}
430 \key{capitalize word}{M-c}
431
432 \key{uppercase region}{C-x C-u}
433 \key{lowercase region}{C-x C-l}
434 \metax{capitalize region}{M-x capitalize-region}
435
436 \section{The Minibuffer}
437
438 The following keys are defined in the minibuffer.
439
440 \key{complete as much as possible}{TAB}
441 \key{complete up to one word}{SPC}
442 \key{complete and execute}{RET}
443 \key{show possible completions}{?}
444 \key{fetch previous minibuffer input}{M-p}
445 \key{fetch next later minibuffer input}{M-n}
446 \key{regexp search backward through history}{M-r}
447 \key{regexp search forward through history}{M-s}
448 \key{abort command}{C-g}
449
450 Type \kbd{C-x ESC ESC} to edit and repeat the last command that used the
451 minibuffer.  The following keys are then defined.
452
453 \key{previous minibuffer command}{M-p}
454 \key{next minibuffer command}{M-n}
455
456 \newcolumn
457 \title{SXEmacs Reference Card}
458
459 \section{Buffers}
460
461 \key{select another buffer}{C-x b}
462 \key{list all buffers}{C-x C-b}
463 \key{kill a buffer}{C-x k}
464
465 \section{Transposing}
466
467 \key{transpose {\bf characters}}{C-t}
468 \key{transpose {\bf words}}{M-t}
469 \key{transpose {\bf lines}}{C-x C-t}
470 \key{transpose {\bf sexps}}{C-M-t}
471
472 \section{Spelling Check}
473
474 \key{check spelling of current word}{M-\$}
475 \metax{check spelling of all words in region}{M-x ispell-region}
476 \metax{check spelling of entire buffer}{M-x ispell-buffer}
477
478 \section{Tags}
479
480 \key{find a tag (a definition)}{M-.}
481 \key{find next occurrence of tag}{C-u M-.}
482 \metax{specify a new tags file}{M-x visit-tags-table}
483
484 \metax{regexp search on all files in tags table}{M-x tags-search}
485 \metax{run query-replace on all the files}{M-x tags-query-replace}
486 \key{continue last tags search or query-replace}{M-,}
487
488 \section{Shells}
489
490 \key{execute a shell command}{M-!}
491 \key{run a shell command on the region}{M-|}
492 \key{filter region through a shell command}{C-u M-|}
493 \metax{start a shell in window \kbd{*shell*}}{M-x shell}
494
495 \section{Rectangles}
496
497 \key{copy rectangle to register}{C-x r r}
498 \key{kill rectangle}{C-x r k}
499 \key{yank rectangle}{C-x r y}
500 \key{open rectangle, shifting text right}{C-x r o}
501 \metax{blank out rectangle}{M-x clear-rectangle}
502 \metax{prefix each line with a string}{M-x string-rectangle}
503 \key{select rectangle with mouse}{M-button1}
504
505 \section{Abbrevs}
506
507 \key{add global abbrev}{C-x a g}
508 \key{add mode-local abbrev}{C-x a l}
509 \key{add global expansion for this abbrev}{C-x a i g}
510 \key{add mode-local expansion for this abbrev}{C-x a i l}
511 \key{explicitly expand abbrev}{C-x a e}
512
513 \key{expand previous word dynamically}{M-/}
514
515 \section{Regular Expressions}
516
517 \key{any single character except a newline}{. {\rm(dot)}}
518 \key{zero or more repeats}{*}
519 \key{one or more repeats}{+}
520 \key{zero or one repeat}{?}
521 \key{any character in the set}{[ {\rm$\ldots$} ]}
522 \key{any character not in the set}{[^ {\rm$\ldots$} ]}
523 \key{beginning of line}{^}
524 \key{end of line}{\$}
525 \key{quote a special character {\it c\/}}{\\{\it c}}
526 \key{alternative (``or'')}{\\|}
527 \key{grouping}{\\( {\rm$\ldots$} \\)}
528 \key{{\it n\/}th group}{\\{\it n}}
529 \key{beginning of buffer}{\\`}
530 \key{end of buffer}{\\'}
531 \key{word break}{\\b}
532 \key{not beginning or end of word}{\\B}
533 \key{beginning of word}{\\<}
534 \key{end of word}{\\>}
535 \key{any word-syntax character}{\\w}
536 \key{any non-word-syntax character}{\\W}
537 \key{character with syntax {\it c}}{\\s{\it c}}
538 \key{character with syntax not {\it c}}{\\S{\it c}}
539
540 \section{Registers}
541
542 \key{save region in register}{C-x r s}
543 \key{insert register contents into buffer}{C-x r i}
544
545 \key{save value of point in register}{C-x r SPC}
546 \key{jump to point saved in register}{C-x r j}
547
548 \section{Info}
549
550 \key{enter the Info documentation reader}{C-h i}
551 \beginindentedkeys
552
553 Moving within a node:
554
555 \key{scroll forward}{SPC}
556 \key{scroll reverse}{DEL}
557 \key{beginning of node}{. {\rm (dot)}}
558
559 Moving between nodes:
560
561 \key{{\bf next} node}{n}
562 \key{{\bf previous} node}{p}
563 \key{move {\bf up}}{u}
564 \key{select menu item by name}{m}
565 \key{select {\it n\/}th menu item by number (1--5)}{{\it n}}
566 \key{follow cross reference  (return with \kbd{l})}{f}
567 \key{return to last node you saw}{l}
568 \key{return to directory node}{d}
569 \key{go to any node by name}{g}
570
571 Other:
572
573 \key{run Info {\bf tutorial}}{h}
574 \key{list Info commands}{?}
575 \key{{\bf quit} Info}{q}
576 \key{search nodes for regexp}{s}
577
578 \endindentedkeys
579
580 \section{Keyboard Macros}
581
582 \key{{\bf start} defining a keyboard macro}{C-x (}
583 \key{{\bf end} keyboard macro definition}{C-x )}
584 \key{{\bf execute} last-defined keyboard macro}{C-x e}
585 \key{{\bf edit} keyboard macro}{C-x C-k}
586 \key{append to last keyboard macro}{C-u C-x (}
587 \metax{name last keyboard macro}{M-x name-last-kbd-macro}
588 \metax{insert Lisp definition in buffer}{M-x insert-kbd-macro}
589
590 \section{Commands Dealing with Emacs Lisp}
591
592 \key{eval {\bf sexp} before point}{C-x C-e}
593 \key{eval current {\bf defun}}{C-M-x}
594 \metax{eval {\bf region}}{M-x eval-region}
595 \metax{eval entire {\bf buffer}}{M-x eval-current-buffer}
596 \key{read and eval minibuffer}{M-ESC}
597 \key{re-execute last minibuffer command}{C-x ESC ESC}
598 \metax{read and eval Emacs Lisp file}{M-x load-file}
599 \metax{load from standard system directory}{M-x load-library}
600
601 \section{Simple Customization}
602
603 % The intended audience here is the person who wants to make simple
604 % customizations and knows Lisp syntax.
605
606 Here are some examples of binding global keys in Emacs Lisp.
607
608 \beginexample%
609 (global-set-key [(control c) g] 'goto-line)
610 (global-set-key [(control x) (control k)] 'kill-region)
611 (global-set-key [(meta \#)] 'query-replace-regexp)
612 \endexample
613
614 An example of setting a variable in Emacs Lisp:
615
616 \beginexample%
617 (setq backup-by-copying-when-linked t)
618 \endexample
619
620 \section{Writing Commands}
621
622 \beginexample%
623 (defun \<command-name> (\<args>)
624   "\<documentation>"
625   (interactive "\<template>")
626   \<body>)
627 \endexample
628
629 An example:
630
631 \beginexample%
632 (defun this-line-to-top-of-window (line)
633   "Reposition line point is on to top of window.
634 With ARG, put point on line ARG.
635 Negative counts from bottom."
636   (interactive "P")
637   (recenter (if (null line)
638                 0
639               (prefix-numeric-value line))))
640 \endexample
641
642 The argument to \kbd{interactive} is a string specifying how to get
643 the arguments when the function is called interactively.
644 Type \kbd{C-h f interactive} for more information.
645
646 \copyrightnotice
647
648 \bye
649 \f
650 % Local variables:
651 % compile-command: "tex refcard"
652 % End: