1% Reference Card for GNU Emacs version 22 on Unix systems
2%**start of header
3\newcount\columnsperpage
4\newcount\letterpaper
5
6% This file can be printed with 1, 2, or 3 columns per page (see below).
7% Specify how many you want here.
8
9\columnsperpage=3
10
11% Set letterpapaer to 0 for A4 paper, 1 for letter (US) paper.  Useful
12% only when columnsperpage is 2 or 3.
13
14\letterpaper=1
15
16% Nothing else needs to be changed below this line.
17% Copyright (C) 1987, 1993, 1996, 1997, 2001, 2002, 2003, 2004,
18%   2005, 2006, 2007  Free Software Foundation, Inc.
19
20% This file is part of GNU Emacs.
21
22% GNU Emacs is free software; you can redistribute it and/or modify
23% it under the terms of the GNU General Public License as published by
24% the Free Software Foundation; either version 2, or (at your option)
25% any later version.
26
27% GNU Emacs is distributed in the hope that it will be useful,
28% but WITHOUT ANY WARRANTY; without even the implied warranty of
29% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30% GNU General Public License for more details.
31
32% You should have received a copy of the GNU General Public License
33% along with GNU Emacs; see the file COPYING.  If not, write to
34% the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
35% Boston, MA 02110-1301, USA.
36
37% This file is intended to be processed by plain TeX (TeX82).
38%
39% The final reference card has six columns, three on each side.
40% This file can be used to produce it in any of three ways:
41% 1 column per page
42%    produces six separate pages, each of which needs to be reduced to 80%.
43%    This gives the best resolution.
44% 2 columns per page
45%    produces three already-reduced pages.
46%    You will still need to cut and paste.
47% 3 columns per page
48%    produces two pages which must be printed sideways to make a
49%    ready-to-use 8.5 x 11 inch reference card.
50%    For this you need a dvi device driver that can print sideways.
51% Which mode to use is controlled by setting \columnsperpage above.
52%
53% To compile and print this document:
54% tex refcard.tex
55% dvips -t landscape refcard.dvi
56%
57% Author:
58%  Stephen Gildea
59%  Internet: gildea@stop.mail-abuse.org
60%
61% Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
62% for their many good ideas.
63
64% If there were room, it would be nice to see a section on Dired.
65
66\def\versionnumber{2.3}         % version of this manual
67\def\versionyear{2006}          % year manual was updated
68\def\versionemacs{22}           % version of emacs this manual is for
69\def\year{2007}                 % copyright year
70
71\def\shortcopyrightnotice{\vskip 1ex plus 2 fill
72  \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
73  Permissions on back.  v\versionnumber}}
74
75\def\copyrightnotice{
76\vskip 1ex plus 2 fill\begingroup\small
77\centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
78\centerline{v\versionnumber{} for GNU Emacs version \versionemacs, \versionyear}
79\centerline{designed by Stephen Gildea}
80
81Permission is granted to make and distribute copies of
82this card provided the copyright notice and this permission notice
83are preserved on all copies.
84
85For copies of the GNU Emacs manual, write to the Free Software
86Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
87
88\endgroup}
89
90% make \bye not \outer so that the \def\bye in the \else clause below
91% can be scanned without complaint.
92\def\bye{\par\vfill\supereject\end}
93
94\newdimen\intercolumnskip	%horizontal space between columns
95\newbox\columna			%boxes to hold columns already built
96\newbox\columnb
97
98\def\ncolumns{\the\columnsperpage}
99
100\message{[\ncolumns\space
101  column\if 1\ncolumns\else s\fi\space per page]}
102
103\def\scaledmag#1{ scaled \magstep #1}
104
105% This multi-way format was designed by Stephen Gildea October 1986.
106% Note that the 1-column format is fontfamily-independent.
107\if 1\ncolumns			%one-column format uses normal size
108  \hsize 4in
109  \vsize 10in
110  \voffset -.7in
111  \font\titlefont=\fontname\tenbf \scaledmag3
112  \font\headingfont=\fontname\tenbf \scaledmag2
113  \font\smallfont=\fontname\sevenrm
114  \font\smallsy=\fontname\sevensy
115
116  \footline{\hss\folio}
117  \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
118\else				%2 or 3 columns uses prereduced size
119  \hsize 3.2in
120  \if 1\the\letterpaper
121     \vsize 7.95in
122  \else
123     \vsize 7.65in
124  \fi
125  \hoffset -.75in
126  \voffset -.745in
127  \font\titlefont=cmbx10 \scaledmag2
128  \font\headingfont=cmbx10 \scaledmag1
129  \font\smallfont=cmr6
130  \font\smallsy=cmsy6
131  \font\eightrm=cmr8
132  \font\eightbf=cmbx8
133  \font\eightit=cmti8
134  \font\eighttt=cmtt8
135  \font\eightmi=cmmi8
136  \font\eightsy=cmsy8
137  \textfont0=\eightrm
138  \textfont1=\eightmi
139  \textfont2=\eightsy
140  \def\rm{\eightrm}
141  \def\bf{\eightbf}
142  \def\it{\eightit}
143  \def\tt{\eighttt}
144  \if 1\the\letterpaper
145     \normalbaselineskip=.8\normalbaselineskip
146  \else
147     \normalbaselineskip=.7\normalbaselineskip
148  \fi
149  \normallineskip=.8\normallineskip
150  \normallineskiplimit=.8\normallineskiplimit
151  \normalbaselines\rm		%make definitions take effect
152
153  \if 2\ncolumns
154    \let\maxcolumn=b
155    \footline{\hss\rm\folio\hss}
156    \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
157  \else \if 3\ncolumns
158    \let\maxcolumn=c
159    \nopagenumbers
160  \else
161    \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
162    \errmessage{Illegal number of columns per page}
163  \fi\fi
164
165  \intercolumnskip=.46in
166  \def\abc{a}
167  \output={%			%see The TeXbook page 257
168      % This next line is useful when designing the layout.
169      %\immediate\write16{Column \folio\abc\space starts with \firstmark}
170      \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
171      \else\if a\abc
172	\global\setbox\columna\columnbox \global\def\abc{b}
173        %% in case we never use \columnb (two-column mode)
174        \global\setbox\columnb\hbox to -\intercolumnskip{}
175      \else
176	\global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
177  \def\multicolumnformat{\shipout\vbox{\makeheadline
178      \hbox{\box\columna\hskip\intercolumnskip
179        \box\columnb\hskip\intercolumnskip\columnbox}
180      \makefootline}\advancepageno}
181  \def\columnbox{\leftline{\pagebody}}
182
183  \def\bye{\par\vfill\supereject
184    \if a\abc \else\null\vfill\eject\fi
185    \if a\abc \else\null\vfill\eject\fi
186    \end}
187\fi
188
189% we won't be using math mode much, so redefine some of the characters
190% we might want to talk about
191\catcode`\^=12
192\catcode`\_=12
193
194\chardef\\=`\\
195\chardef\{=`\{
196\chardef\}=`\}
197
198\hyphenation{mini-buf-fer}
199
200\parindent 0pt
201\parskip 1ex plus .5ex minus .5ex
202
203\def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
204
205% newcolumn - force a new column.  Use sparingly, probably only for
206% the first column of a page, which should have a title anyway.
207\outer\def\newcolumn{\vfill\eject}
208
209% title - page title.  Argument is title text.
210\outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
211
212% section - new major section.  Argument is section name.
213\outer\def\section#1{\par\filbreak
214  \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
215  \vskip 2ex plus 1ex minus 1.5ex}
216
217\newdimen\keyindent
218
219% beginindentedkeys...endindentedkeys - key definitions will be
220% indented, but running text, typically used as headings to group
221% definitions, will not.
222\def\beginindentedkeys{\keyindent=1em}
223\def\endindentedkeys{\keyindent=0em}
224\endindentedkeys
225
226% paralign - begin paragraph containing an alignment.
227% If an \halign is entered while in vertical mode, a parskip is never
228% inserted.  Using \paralign instead of \halign solves this problem.
229\def\paralign{\vskip\parskip\halign}
230
231% \<...> - surrounds a variable name in a code example
232\def\<#1>{{\it #1\/}}
233
234% kbd - argument is characters typed literally.  Like the Texinfo command.
235\def\kbd#1{{\tt#1}\null}	%\null so not an abbrev even if period follows
236
237% beginexample...endexample - surrounds literal text, such a code example.
238% typeset in a typewriter font with line breaks preserved
239\def\beginexample{\par\leavevmode\begingroup
240  \obeylines\obeyspaces\parskip0pt\tt}
241{\obeyspaces\global\let =\ }
242\def\endexample{\endgroup}
243
244% key - definition of a key.
245% \key{description of key}{key-name}
246% prints the description left-justified, and the key-name in a \kbd
247% form near the right margin.
248\def\key#1#2{\leavevmode\hbox to \hsize{\vtop
249  {\hsize=.75\hsize\rightskip=1em
250  \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
251
252\newbox\metaxbox
253\setbox\metaxbox\hbox{\kbd{M-x }}
254\newdimen\metaxwidth
255\metaxwidth=\wd\metaxbox
256
257% metax - definition of a M-x command.
258% \metax{description of command}{M-x command-name}
259% Tries to justify the beginning of the command name at the same place
260% as \key starts the key name.  (The "M-x " sticks out to the left.)
261\def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
262  {\hskip\keyindent\relax#1\hfil}%
263  \hskip -\metaxwidth minus 1fil
264  \kbd{#2}\hfil}}
265
266% threecol - like "key" but with two key names.
267% for example, one for doing the action backward, and one for forward.
268\def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\hfil\quad
269  &\kbd{#3}\hfil\quad\cr}
270
271%**end of header
272
273
274\title{GNU Emacs Reference Card}
275
276\centerline{(for version \versionemacs)}
277
278\section{Starting Emacs}
279
280To enter GNU Emacs \versionemacs, just type its name: \kbd{emacs}
281
282\section{Leaving Emacs}
283
284\key{suspend Emacs (or iconify it under X)}{C-z}
285\key{exit Emacs permanently}{C-x C-c}
286
287\section{Files}
288
289\key{{\bf read} a file into Emacs}{C-x C-f}
290\key{{\bf save} a file back to disk}{C-x C-s}
291\key{save {\bf all} files}{C-x s}
292\key{{\bf insert} contents of another file into this buffer}{C-x i}
293\key{replace this file with the file you really want}{C-x C-v}
294\key{write buffer to a specified file}{C-x C-w}
295\key{toggle read-only status of buffer}{C-x C-q}
296
297\section{Getting Help}
298
299The help system is simple.  Type \kbd{C-h} (or \kbd{F1}) and follow
300the directions.  If you are a first-time user, type \kbd{C-h t} for a
301{\bf tutorial}.
302
303\key{remove help window}{C-x 1}
304\key{scroll help window}{C-M-v}
305
306\key{apropos: show commands matching a string}{C-h a}
307\key{describe the function a key runs}{C-h k}
308\key{describe a function}{C-h f}
309\key{get mode-specific information}{C-h m}
310
311\section{Error Recovery}
312
313\key{{\bf abort} partially typed or executing command}{C-g}
314\metax{{\bf recover} files lost by a system crash}{M-x recover-session}
315\metax{{\bf undo} an unwanted change}{C-x u, C-_ {\rm or} C-/}
316\metax{restore a buffer to its original contents}{M-x revert-buffer}
317\key{redraw garbaged screen}{C-l}
318
319\section{Incremental Search}
320
321\key{search forward}{C-s}
322\key{search backward}{C-r}
323\key{regular expression search}{C-M-s}
324\key{reverse regular expression search}{C-M-r}
325
326\key{select previous search string}{M-p}
327\key{select next later search string}{M-n}
328\key{exit incremental search}{RET}
329\key{undo effect of last character}{DEL}
330\key{abort current search}{C-g}
331
332Use \kbd{C-s} or \kbd{C-r} again to repeat the search in either direction.
333If Emacs is still searching, \kbd{C-g} cancels only the part not matched.
334
335\shortcopyrightnotice
336
337\section{Motion}
338
339\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
340\threecol{{\bf entity to move over}}{{\bf backward}}{{\bf forward}}
341\threecol{character}{C-b}{C-f}
342\threecol{word}{M-b}{M-f}
343\threecol{line}{C-p}{C-n}
344\threecol{go to line beginning (or end)}{C-a}{C-e}
345\threecol{sentence}{M-a}{M-e}
346\threecol{paragraph}{M-\{}{M-\}}
347\threecol{page}{C-x [}{C-x ]}
348\threecol{sexp}{C-M-b}{C-M-f}
349\threecol{function}{C-M-a}{C-M-e}
350\threecol{go to buffer beginning (or end)}{M-<}{M->}
351}
352
353\key{scroll to next screen}{C-v}
354\key{scroll to previous screen}{M-v}
355\key{scroll left}{C-x <}
356\key{scroll right}{C-x >}
357\key{scroll current line to center of screen}{C-u C-l}
358
359\section{Killing and Deleting}
360
361\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
362\threecol{{\bf entity to kill}}{{\bf backward}}{{\bf forward}}
363\threecol{character (delete, not kill)}{DEL}{C-d}
364\threecol{word}{M-DEL}{M-d}
365\threecol{line (to end of)}{M-0 C-k}{C-k}
366\threecol{sentence}{C-x DEL}{M-k}
367\threecol{sexp}{M-- C-M-k}{C-M-k}
368}
369
370\key{kill {\bf region}}{C-w}
371\key{copy region to kill ring}{M-w}
372\key{kill through next occurrence of {\it char}}{M-z {\it char}}
373
374\key{yank back last thing killed}{C-y}
375\key{replace last yank with previous kill}{M-y}
376
377\section{Marking}
378
379\key{set mark here}{C-@ {\rm or} C-SPC}
380\key{exchange point and mark}{C-x C-x}
381
382\key{set mark {\it arg\/} {\bf words} away}{M-@}
383\key{mark {\bf paragraph}}{M-h}
384\key{mark {\bf page}}{C-x C-p}
385\key{mark {\bf sexp}}{C-M-@}
386\key{mark {\bf function}}{C-M-h}
387\key{mark entire {\bf buffer}}{C-x h}
388
389\section{Query Replace}
390
391\key{interactively replace a text string}{M-\%}
392% query-replace-regexp is bound to C-M-% but that can't be typed on
393% consoles.
394\metax{using regular expressions}{M-x query-replace-regexp}
395
396Valid responses in query-replace mode are
397
398\key{{\bf replace} this one, go on to next}{SPC}
399\key{replace this one, don't move}{,}
400\key{{\bf skip} to next without replacing}{DEL}
401\key{replace all remaining matches}{!}
402\key{{\bf back up} to the previous match}{^}
403\key{{\bf exit} query-replace}{RET}
404\key{enter recursive edit (\kbd{C-M-c} to exit)}{C-r}
405
406\section{Multiple Windows}
407
408When two commands are shown, the second is a similar command for a
409frame instead of a window.
410
411{\setbox0=\hbox{\kbd{0}}\advance\hsize by 0\wd0
412\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
413\threecol{delete all other windows}{C-x 1\ \ \ \ }{C-x 5 1}
414\threecol{split window, above and below}{C-x 2\ \ \ \ }{C-x 5 2}
415\threecol{delete this window}{C-x 0\ \ \ \ }{C-x 5 0}
416}}
417\key{split window, side by side}{C-x 3}
418
419\key{scroll other window}{C-M-v}
420
421{\setbox0=\hbox{\kbd{0}}\advance\hsize by 2\wd0
422\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
423\threecol{switch cursor to another window}{C-x o}{C-x 5 o}
424
425\threecol{select buffer in other window}{C-x 4 b}{C-x 5 b}
426\threecol{display buffer in other window}{C-x 4 C-o}{C-x 5 C-o}
427\threecol{find file in other window}{C-x 4 f}{C-x 5 f}
428\threecol{find file read-only in other window}{C-x 4 r}{C-x 5 r}
429\threecol{run Dired in other window}{C-x 4 d}{C-x 5 d}
430\threecol{find tag in other window}{C-x 4 .}{C-x 5 .}
431}}
432
433\key{grow window taller}{C-x ^}
434\key{shrink window narrower}{C-x \{}
435\key{grow window wider}{C-x \}}
436
437\section{Formatting}
438
439\key{indent current {\bf line} (mode-dependent)}{TAB}
440\key{indent {\bf region} (mode-dependent)}{C-M-\\}
441\key{indent {\bf sexp} (mode-dependent)}{C-M-q}
442\key{indent region rigidly {\it arg\/} columns}{C-x TAB}
443
444\key{insert newline after point}{C-o}
445\key{move rest of line vertically down}{C-M-o}
446\key{delete blank lines around point}{C-x C-o}
447\key{join line with previous (with arg, next)}{M-^}
448\key{delete all white space around point}{M-\\}
449\key{put exactly one space at point}{M-SPC}
450
451\key{fill paragraph}{M-q}
452\key{set fill column}{C-x f}
453\key{set prefix each line starts with}{C-x .}
454
455\key{set face}{M-o}
456
457\section{Case Change}
458
459\key{uppercase word}{M-u}
460\key{lowercase word}{M-l}
461\key{capitalize word}{M-c}
462
463\key{uppercase region}{C-x C-u}
464\key{lowercase region}{C-x C-l}
465
466\section{The Minibuffer}
467
468The following keys are defined in the minibuffer.
469
470\key{complete as much as possible}{TAB}
471\key{complete up to one word}{SPC}
472\key{complete and execute}{RET}
473\key{show possible completions}{?}
474\key{fetch previous minibuffer input}{M-p}
475\key{fetch later minibuffer input or default}{M-n}
476\key{regexp search backward through history}{M-r}
477\key{regexp search forward through history}{M-s}
478\key{abort command}{C-g}
479
480Type \kbd{C-x ESC ESC} to edit and repeat the last command that used the
481minibuffer.  Type \kbd{F10} to activate menu bar items on text terminals.
482
483\newcolumn
484\title{GNU Emacs Reference Card}
485
486\section{Buffers}
487
488\key{select another buffer}{C-x b}
489\key{list all buffers}{C-x C-b}
490\key{kill a buffer}{C-x k}
491
492\section{Transposing}
493
494\key{transpose {\bf characters}}{C-t}
495\key{transpose {\bf words}}{M-t}
496\key{transpose {\bf lines}}{C-x C-t}
497\key{transpose {\bf sexps}}{C-M-t}
498
499\section{Spelling Check}
500
501\key{check spelling of current word}{M-\$}
502\metax{check spelling of all words in region}{M-x ispell-region}
503\metax{check spelling of entire buffer}{M-x ispell-buffer}
504
505\section{Tags}
506
507\key{find a tag (a definition)}{M-.}
508\key{find next occurrence of tag}{C-u M-.}
509\metax{specify a new tags file}{M-x visit-tags-table}
510
511\metax{regexp search on all files in tags table}{M-x tags-search}
512\metax{run query-replace on all the files}{M-x tags-query-replace}
513\key{continue last tags search or query-replace}{M-,}
514
515\section{Shells}
516
517\key{execute a shell command}{M-!}
518\key{run a shell command on the region}{M-|}
519\key{filter region through a shell command}{C-u M-|}
520\key{start a shell in window \kbd{*shell*}}{M-x shell}
521
522\section{Rectangles}
523
524\key{copy rectangle to register}{C-x r r}
525\key{kill rectangle}{C-x r k}
526\key{yank rectangle}{C-x r y}
527\key{open rectangle, shifting text right}{C-x r o}
528\key{blank out rectangle}{C-x r c}
529\key{prefix each line with a string}{C-x r t}
530
531\section{Abbrevs}
532
533\key{add global abbrev}{C-x a g}
534\key{add mode-local abbrev}{C-x a l}
535\key{add global expansion for this abbrev}{C-x a i g}
536\key{add mode-local expansion for this abbrev}{C-x a i l}
537\key{explicitly expand abbrev}{C-x a e}
538
539\key{expand previous word dynamically}{M-/}
540
541\section{Regular Expressions}
542
543\key{any single character except a newline}{. {\rm(dot)}}
544\key{zero or more repeats}{*}
545\key{one or more repeats}{+}
546\key{zero or one repeat}{?}
547\key{quote regular expression special character {\it c\/}}{\\{\it c}}
548\key{alternative (``or'')}{\\|}
549\key{grouping}{\\( {\rm$\ldots$} \\)}
550\key{same text as {\it n\/}th group}{\\{\it n}}
551\key{at word break}{\\b}
552\key{not at word break}{\\B}
553
554\paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
555\threecol{{\bf entity}}{{\bf match start}}{{\bf match end}}
556\threecol{line}{^}{\$}
557\threecol{word}{\\<}{\\>}
558\threecol{buffer}{\\`}{\\'}
559
560\threecol{{\bf class of characters}}{{\bf match these}}{{\bf match others}}
561\threecol{explicit set}{[ {\rm$\ldots$} ]}{[^ {\rm$\ldots$} ]}
562\threecol{word-syntax character}{\\w}{\\W}
563\threecol{character with syntax {\it c}}{\\s{\it c}}{\\S{\it c}}
564}
565
566\section{International Character Sets}
567
568\key{specify principal language}{C-x RET l}
569\metax{show all input methods}{M-x list-input-methods}
570\key{enable or disable input method}{C-\\}
571\key{set coding system for next command}{C-x RET c}
572\metax{show all coding systems}{M-x list-coding-systems}
573\metax{choose preferred coding system}{M-x prefer-coding-system}
574
575\section{Info}
576
577\key{enter the Info documentation reader}{C-h i}
578\key{find specified function or variable in Info}{C-h S}
579\beginindentedkeys
580
581Moving within a node:
582
583\key{scroll forward}{SPC}
584\key{scroll reverse}{DEL}
585\key{beginning of node}{. {\rm (dot)}}
586
587Moving between nodes:
588
589\key{{\bf next} node}{n}
590\key{{\bf previous} node}{p}
591\key{move {\bf up}}{u}
592\key{select menu item by name}{m}
593\key{select {\it n\/}th menu item by number (1--9)}{{\it n}}
594\key{follow cross reference  (return with \kbd{l})}{f}
595\key{return to last node you saw}{l}
596\key{return to directory node}{d}
597\key{go to top node of Info file}{t}
598\key{go to any node by name}{g}
599
600Other:
601
602\key{run Info {\bf tutorial}}{h}
603\key{look up a subject in the indices}{i}
604\key{search nodes for regexp}{s}
605\key{{\bf quit} Info}{q}
606
607\endindentedkeys
608
609\section{Registers}
610
611\key{save region in register}{C-x r s}
612\key{insert register contents into buffer}{C-x r i}
613
614\key{save value of point in register}{C-x r SPC}
615\key{jump to point saved in register}{C-x r j}
616
617\section{Keyboard Macros}
618
619\key{{\bf start} defining a keyboard macro}{C-x (}
620\key{{\bf end} keyboard macro definition}{C-x )}
621\key{{\bf execute} last-defined keyboard macro}{C-x e}
622\key{append to last keyboard macro}{C-u C-x (}
623\metax{name last keyboard macro}{M-x name-last-kbd-macro}
624\metax{insert Lisp definition in buffer}{M-x insert-kbd-macro}
625
626\section{Commands Dealing with Emacs Lisp}
627
628\key{eval {\bf sexp} before point}{C-x C-e}
629\key{eval current {\bf defun}}{C-M-x}
630\metax{eval {\bf region}}{M-x eval-region}
631\key{read and eval minibuffer}{M-:}
632\metax{load from standard system directory}{M-x load-library}
633
634\section{Simple Customization}
635
636\metax{customize variables and faces}{M-x customize}
637
638% The intended audience here is the person who wants to make simple
639% customizations and knows Lisp syntax.
640
641Making global key bindings in Emacs Lisp (examples):
642
643\beginexample%
644(global-set-key "\\C-cg" 'goto-line)
645(global-set-key "\\M-\#" 'query-replace-regexp)
646\endexample
647
648\section{Writing Commands}
649
650\beginexample%
651(defun \<command-name> (\<args>)
652  "\<documentation>" (interactive "\<template>")
653  \<body>)
654\endexample
655
656An example:
657
658\beginexample%
659(defun this-line-to-top-of-window (line)
660  "Reposition current line to top of window.
661With ARG, put point on line ARG."
662  (interactive "P")
663  (recenter (if (null line)
664                0
665              (prefix-numeric-value line))))
666\endexample
667
668The \kbd{interactive} spec says how to read arguments interactively.
669Type \kbd{C-h f interactive} for more details.
670
671\copyrightnotice
672
673\bye
674
675% Local variables:
676% compile-command: "tex refcard"
677% End:
678
679% arch-tag: d67bdf5d-b77c-44eb-a22e-f4f7d25174d2
680