comparison etc/refcard.tex @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 262b8bb4a523
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
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{1995}
56 \def\version{February \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., 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 %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
253
254 \title{XEmacs Reference Card}
255
256 \centerline{(for version 19)}
257
258 \section{Starting Emacs}
259
260 To enter XEmacs, just type its name: \kbd{xemacs}
261
262 To read in a file to edit, see Files, below.
263
264 \section{Leaving Emacs}
265
266 \key{suspend Emacs (or iconify it 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{remove Help window}{C-x 1}
284 \key{scroll Help window}{ESC C-v}
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 \key{{\bf undo} an unwanted change}{C-x u {\rm or} C-_}
296 \metax{restore a buffer to its original contents}{M-x revert-buffer}
297 \key{redraw garbaged screen}{C-l}
298
299 \section{Incremental Search}
300
301 \key{search forward}{C-s}
302 \key{search backward}{C-r}
303 \key{regular expression search}{C-M-s}
304 \key{reverse regular expression search}{C-M-r}
305
306 \key{select previous search string}{M-p}
307 \key{select next later search string}{M-n}
308 \key{exit incremental search}{RET}
309 \key{undo effect of last character}{DEL}
310 \key{abort current search}{C-g}
311
312 Use \kbd{C-s} or \kbd{C-r} again to repeat the search in either direction.
313 If Emacs is still searching, \kbd{C-g} cancels only the part not done.
314
315 \shortcopyrightnotice
316
317 \section{Motion}
318
319 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
320 \threecol{{\bf entity to move over}}{{\bf backward}}{{\bf forward}}
321 \threecol{character}{C-b}{C-f}
322 \threecol{word}{M-b}{M-f}
323 \threecol{line}{C-p}{C-n}
324 \threecol{go to line beginning (or end)}{C-a}{C-e}
325 \threecol{sentence}{M-a}{M-e}
326 \threecol{paragraph}{M-\{}{M-\}}
327 \threecol{page}{C-x [}{C-x ]}
328 \threecol{sexp}{C-M-b}{C-M-f}
329 \threecol{function}{C-M-a}{C-M-e}
330 \threecol{go to buffer beginning (or end)}{M-<}{M->}
331 }
332
333 \key{scroll to next screen}{C-v}
334 \key{scroll to previous screen}{M-v}
335 \key{scroll left}{C-x <}
336 \key{scroll right}{C-x >}
337 \key{scroll current line to center of screen}{C-u C-l}
338
339 \section{Killing and Deleting}
340
341 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
342 \threecol{{\bf entity to kill}}{{\bf backward}}{{\bf forward}}
343 \threecol{character (delete, not kill)}{DEL}{C-d}
344 \threecol{word}{M-DEL}{M-d}
345 \threecol{line (to end of)}{M-0 C-k}{C-k}
346 \threecol{sentence}{C-x DEL}{M-k}
347 \threecol{sexp}{M-- C-M-k}{C-M-k}
348 }
349
350 \key{kill {\bf region}}{C-w}
351 \key{copy region to kill ring}{M-w}
352 \key{kill through next occurrence of {\it char}}{M-z {\it char}}
353
354 \key{yank back last thing killed}{C-y}
355 \key{replace last yank with previous kill}{M-y}
356
357 \section{Marking}
358
359 \key{set mark here}{C-@ {\rm or} C-SPC}
360 \key{exchange point and mark}{C-x C-x}
361
362 \key{set mark {\it arg\/} {\bf words} away}{M-@}
363 \key{mark {\bf paragraph}}{M-h}
364 \key{mark {\bf page}}{C-x C-p}
365 \key{mark {\bf sexp}}{C-M-@}
366 \key{mark {\bf function}}{C-M-h}
367 \key{mark entire {\bf buffer}}{C-x h}
368
369 \section{Query Replace}
370
371 \key{interactively replace a text string}{M-\%}
372 \metax{using regular expressions}{M-x query-replace-regexp}
373
374 Valid responses in query-replace mode are
375
376 \key{{\bf replace} this one, go on to next}{SPC}
377 \key{replace this one, don't move}{,}
378 \key{{\bf skip} to next without replacing}{DEL}
379 \key{replace all remaining matches}{!}
380 \key{{\bf back up} to the previous match}{^}
381 \key{{\bf exit} query-replace}{ESC}
382 \key{enter recursive edit (\kbd{C-M-c} to exit)}{C-r}
383
384 \section{Multiple Windows}
385
386 \key{delete all other windows}{C-x 1}
387 \key{delete this window}{C-x 0}
388 \key{split window in two vertically}{C-x 2}
389 \key{split window in two horizontally}{C-x 3}
390
391 \key{scroll other window}{C-M-v}
392 \key{switch cursor to another window}{C-x o}
393
394 \metax{shrink window shorter}{M-x shrink-window}
395 \key{grow window taller}{C-x ^}
396 \key{shrink window narrower}{C-x \{}
397 \key{grow window wider}{C-x \}}
398
399 \key{select buffer in other window}{C-x 4 b}
400 \key{display buffer in other window}{C-x 4 C-o}
401 \key{find file in other window}{C-x 4 f}
402 \key{find file read-only in other window}{C-x 4 r}
403 \key{run Dired in other window}{C-x 4 d}
404 \key{find tag in other window}{C-x 4 .}
405
406 \section{Formatting}
407
408 \key{indent current {\bf line} (mode-dependent)}{TAB}
409 \key{indent {\bf region} (mode-dependent)}{C-M-\\}
410 \key{indent {\bf sexp} (mode-dependent)}{C-M-q}
411 \key{indent region rigidly {\it arg\/} columns}{C-x TAB}
412
413 \key{insert newline after point}{C-o}
414 \key{move rest of line vertically down}{C-M-o}
415 \key{delete blank lines around point}{C-x C-o}
416 \key{join line with previous (with arg, next)}{M-^}
417 \key{delete all white space around point}{M-\\}
418 \key{put exactly one space at point}{M-SPC}
419
420 \key{fill paragraph}{M-q}
421 \key{set fill column}{C-x f}
422 \key{set prefix each line starts with}{C-x .}
423
424 \section{Case Change}
425
426 \key{uppercase word}{M-u}
427 \key{lowercase word}{M-l}
428 \key{capitalize word}{M-c}
429
430 \key{uppercase region}{C-x C-u}
431 \key{lowercase region}{C-x C-l}
432 \metax{capitalize region}{M-x capitalize-region}
433
434 \section{The Minibuffer}
435
436 The following keys are defined in the minibuffer.
437
438 \key{complete as much as possible}{TAB}
439 \key{complete up to one word}{SPC}
440 \key{complete and execute}{RET}
441 \key{show possible completions}{?}
442 \key{fetch previous minibuffer input}{M-p}
443 \key{fetch next later minibuffer input}{M-n}
444 \key{regexp search backward through history}{M-r}
445 \key{regexp search forward through history}{M-s}
446 \key{abort command}{C-g}
447
448 Type \kbd{C-x ESC ESC} to edit and repeat the last command that used the
449 minibuffer. The following keys are then defined.
450
451 \key{previous minibuffer command}{M-p}
452 \key{next minibuffer command}{M-n}
453
454 \newcolumn
455 \title{XEmacs Reference Card}
456
457 \section{Buffers}
458
459 \key{select another buffer}{C-x b}
460 \key{list all buffers}{C-x C-b}
461 \key{kill a buffer}{C-x k}
462
463 \section{Transposing}
464
465 \key{transpose {\bf characters}}{C-t}
466 \key{transpose {\bf words}}{M-t}
467 \key{transpose {\bf lines}}{C-x C-t}
468 \key{transpose {\bf sexps}}{C-M-t}
469
470 \section{Spelling Check}
471
472 \key{check spelling of current word}{M-\$}
473 \metax{check spelling of all words in region}{M-x ispell-region}
474 \metax{check spelling of entire buffer}{M-x ispell-buffer}
475
476 \section{Tags}
477
478 \key{find a tag (a definition)}{M-.}
479 \key{find next occurrence of tag}{C-u M-.}
480 \metax{specify a new tags file}{M-x visit-tags-table}
481
482 \metax{regexp search on all files in tags table}{M-x tags-search}
483 \metax{run query-replace on all the files}{M-x tags-query-replace}
484 \key{continue last tags search or query-replace}{M-,}
485
486 \section{Shells}
487
488 \key{execute a shell command}{M-!}
489 \key{run a shell command on the region}{M-|}
490 \key{filter region through a shell command}{C-u M-|}
491 \metax{start a shell in window \kbd{*shell*}}{M-x shell}
492
493 \section{Rectangles}
494
495 \key{copy rectangle to register}{C-x r r}
496 \key{kill rectangle}{C-x r k}
497 \key{yank rectangle}{C-x r y}
498 \key{open rectangle, shifting text right}{C-x r o}
499 \metax{blank out rectangle}{M-x clear-rectangle}
500 \metax{prefix each line with a string}{M-x string-rectangle}
501
502 \section{Abbrevs}
503
504 \key{add global abbrev}{C-x a g}
505 \key{add mode-local abbrev}{C-x a l}
506 \key{add global expansion for this abbrev}{C-x a i g}
507 \key{add mode-local expansion for this abbrev}{C-x a i l}
508 \key{explicitly expand abbrev}{C-x a e}
509
510 \key{expand previous word dynamically}{M-/}
511
512 \section{Regular Expressions}
513
514 \key{any single character except a newline}{. {\rm(dot)}}
515 \key{zero or more repeats}{*}
516 \key{one or more repeats}{+}
517 \key{zero or one repeat}{?}
518 \key{any character in the set}{[ {\rm$\ldots$} ]}
519 \key{any character not in the set}{[^ {\rm$\ldots$} ]}
520 \key{beginning of line}{^}
521 \key{end of line}{\$}
522 \key{quote a special character {\it c\/}}{\\{\it c}}
523 \key{alternative (``or'')}{\\|}
524 \key{grouping}{\\( {\rm$\ldots$} \\)}
525 \key{{\it n\/}th group}{\\{\it n}}
526 \key{beginning of buffer}{\\`}
527 \key{end of buffer}{\\'}
528 \key{word break}{\\b}
529 \key{not beginning or end of word}{\\B}
530 \key{beginning of word}{\\<}
531 \key{end of word}{\\>}
532 \key{any word-syntax character}{\\w}
533 \key{any non-word-syntax character}{\\W}
534 \key{character with syntax {\it c}}{\\s{\it c}}
535 \key{character with syntax not {\it c}}{\\S{\it c}}
536
537 \section{Registers}
538
539 \key{save region in register}{C-x r s}
540 \key{insert register contents into buffer}{C-x r i}
541
542 \key{save value of point in register}{C-x r SPC}
543 \key{jump to point saved in register}{C-x r j}
544
545 \section{Info}
546
547 \key{enter the Info documentation reader}{C-h i}
548 \beginindentedkeys
549
550 Moving within a node:
551
552 \key{scroll forward}{SPC}
553 \key{scroll reverse}{DEL}
554 \key{beginning of node}{. {\rm (dot)}}
555
556 Moving between nodes:
557
558 \key{{\bf next} node}{n}
559 \key{{\bf previous} node}{p}
560 \key{move {\bf up}}{u}
561 \key{select menu item by name}{m}
562 \key{select {\it n\/}th menu item by number (1--5)}{{\it n}}
563 \key{follow cross reference (return with \kbd{l})}{f}
564 \key{return to last node you saw}{l}
565 \key{return to directory node}{d}
566 \key{go to any node by name}{g}
567
568 Other:
569
570 \key{run Info {\bf tutorial}}{h}
571 \key{list Info commands}{?}
572 \key{{\bf quit} Info}{q}
573 \key{search nodes for regexp}{s}
574
575 \endindentedkeys
576
577 \section{Keyboard Macros}
578
579 \key{{\bf start} defining a keyboard macro}{C-x (}
580 \key{{\bf end} keyboard macro definition}{C-x )}
581 \key{{\bf execute} last-defined keyboard macro}{C-x e}
582 \key{append to last keyboard macro}{C-u C-x (}
583 \metax{name last keyboard macro}{M-x name-last-kbd-macro}
584 \metax{insert Lisp definition in buffer}{M-x insert-kbd-macro}
585
586 \section{Commands Dealing with Emacs Lisp}
587
588 \key{eval {\bf sexp} before point}{C-x C-e}
589 \key{eval current {\bf defun}}{C-M-x}
590 \metax{eval {\bf region}}{M-x eval-region}
591 \metax{eval entire {\bf buffer}}{M-x eval-current-buffer}
592 \key{read and eval minibuffer}{M-ESC}
593 \key{re-execute last minibuffer command}{C-x ESC ESC}
594 \metax{read and eval Emacs Lisp file}{M-x load-file}
595 \metax{load from standard system directory}{M-x load-library}
596
597 \section{Simple Customization}
598
599 % The intended audience here is the person who wants to make simple
600 % customizations and knows Lisp syntax.
601
602 Here are some examples of binding global keys in Emacs Lisp.
603
604 \beginexample%
605 (global-set-key [(control c) g] 'goto-line)
606 (global-set-key [(control x) (control k)] 'kill-region)
607 (global-set-key [(meta \#)] 'query-replace-regexp)
608 \endexample
609
610 An example of setting a variable in Emacs Lisp:
611
612 \beginexample%
613 (setq backup-by-copying-when-linked t)
614 \endexample
615
616 \section{Writing Commands}
617
618 \beginexample%
619 (defun \<command-name> (\<args>)
620 "\<documentation>"
621 (interactive "\<template>")
622 \<body>)
623 \endexample
624
625 An example:
626
627 \beginexample%
628 (defun this-line-to-top-of-window (line)
629 "Reposition line point is on to top of window.
630 With ARG, put point on line ARG.
631 Negative counts from bottom."
632 (interactive "P")
633 (recenter (if (null line)
634 0
635 (prefix-numeric-value line))))
636 \endexample
637
638 The argument to \kbd{interactive} is a string specifying how to get
639 the arguments when the function is called interactively.
640 Type \kbd{C-h f interactive} for more information.
641
642 \copyrightnotice
643
644 \bye
645
646 % Local variables:
647 % compile-command: "tex refcard"
648 % End: