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