1 % Reference Card for GNU Emacs
3 % Copyright (C) 1987, 1993, 1996-1997, 2001-2016 Free Software
6 % Author: Stephen Gildea <gildea@stop.mail-abuse.org>
8 % This document is free software: you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation, either version 3 of the License, or
11 % (at your option) any later version.
13 % As a special additional permission, you may distribute reference cards
14 % printed, or formatted for printing, with the notice "Released under
15 % the terms of the GNU General Public License version 3 or later"
16 % instead of the usual distributed-under-the-GNU-GPL notice, and without
17 % a copy of the GPL itself.
19 % This document is distributed in the hope that it will be useful,
20 % but WITHOUT ANY WARRANTY; without even the implied warranty of
21 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 % GNU General Public License for more details.
24 % You should have received a copy of the GNU General Public License
25 % along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 % This file is intended to be processed by plain TeX (TeX82).
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:
33 % produces six separate pages, each of which needs to be reduced to 80%.
34 % This gives the best resolution.
36 % produces three already-reduced pages.
37 % You will still need to cut and paste.
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.
44 % To compile and print this document:
46 % dvips -t landscape refcard.dvi
48 % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
49 % for their many good ideas.
52 \newcount\columnsperpage
55 % This file can be printed with 1, 2, or 3 columns per page.
56 % Specify how many you want here.
59 % Set letterpaper to 0 for A4 paper, 1 for letter (US) paper. Useful
60 % only when columnsperpage is 2 or 3.
63 % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
68 % Nothing else needs to be changed below this line.
72 \def\shortcopyrightnotice{\vskip 1ex plus
2 fill
73 \centerline{\small \copyright\
\year\ Free Software Foundation, Inc.
74 Permissions on back.
}}
77 \vskip 1ex plus
2 fill
\begingroup\small
78 \centerline{Copyright
\copyright\
\year\ Free Software Foundation, Inc.
}
79 \centerline{For GNU Emacs version
\versionemacs}
80 \centerline{Designed by Stephen Gildea
}
82 Released under the terms of the GNU General Public License version
3 or later.
84 \TeX{} source for this card is distributed with Emacs in
{\tt etc/refcards/
}
86 For copies of the GNU Emacs manual, see:
88 {\tt http://www.gnu.org/software/emacs/\#Manuals
}
91 % make \bye not \outer so that the \def\bye in the \else clause below
92 % can be scanned without complaint.
93 \def\bye{\par\vfill\supereject\end}
95 \newdimen\intercolumnskip %horizontal space between columns
96 \newbox\columna %boxes to hold columns already built
99 \def\ncolumns{\the\columnsperpage}
101 \message{[\ncolumns\space
102 column
\if 1\ncolumns\else s
\fi\space per page
]}
104 \def\scaledmag#1{ scaled
\magstep #1}
106 % This multi-way format was designed by Stephen Gildea October 1986.
107 % Note that the 1-column format is fontfamily-independent.
108 \if 1\ncolumns %one-column format uses normal size
112 \font\titlefont=
\fontname\tenbf \scaledmag3
113 \font\headingfont=
\fontname\tenbf \scaledmag2
114 \font\smallfont=
\fontname\sevenrm
115 \font\smallsy=
\fontname\sevensy
117 \footline{\hss\folio}
118 \def\makefootline{\baselineskip10pt\hsize6.5in
\line{\the\footline}}
119 \else %2 or 3 columns uses prereduced size
121 \if 1\the\letterpaper
128 \font\titlefont=cmbx10
\scaledmag2
129 \font\headingfont=cmbx10
\scaledmag1
145 \if 1\the\letterpaper
146 \normalbaselineskip=
.8\normalbaselineskip
148 \normalbaselineskip=
.7\normalbaselineskip
150 \normallineskip=
.8\normallineskip
151 \normallineskiplimit=
.8\normallineskiplimit
152 \normalbaselines\rm %make definitions take effect
156 \footline{\hss\rm\folio\hss}
157 \def\makefootline{\vskip 2in
\hsize=
6.86in
\line{\the\footline}}
162 \errhelp{You must set
\columnsperpage equal to
1,
2, or
3.
}
163 \errmessage{Illegal number of columns per page
}
166 \intercolumnskip=
.46in
168 \output=
{% %see The TeXbook page 257
169 % This next line is useful when designing the layout.
170 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
171 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a
}
173 \global\setbox\columna\columnbox \global\def\abc{b
}
174 %% in case we never use \columnb (two-column mode)
175 \global\setbox\columnb\hbox to -
\intercolumnskip{}
177 \global\setbox\columnb\columnbox \global\def\abc{c
}\fi\fi}
178 \def\multicolumnformat{\shipout\vbox{\makeheadline
179 \hbox{\box\columna\hskip\intercolumnskip
180 \box\columnb\hskip\intercolumnskip\columnbox}
181 \makefootline}\advancepageno}
182 \def\columnbox{\leftline{\pagebody}}
184 \def\bye{\par\vfill\supereject
185 \if a
\abc \else\null\vfill\eject\fi
186 \if a
\abc \else\null\vfill\eject\fi
190 % we won't be using math mode much, so redefine some of the characters
191 % we might want to talk about
199 \hyphenation{mini-buf-fer
}
202 \parskip 1ex plus
.5ex minus
.5ex
204 \def\small{\smallfont\textfont2=
\smallsy\baselineskip=
.8\baselineskip}
206 % newcolumn - force a new column. Use sparingly, probably only for
207 % the first column of a page, which should have a title anyway.
208 \outer\def\newcolumn{\vfill\eject}
210 % title - page title. Argument is title text.
211 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus
.5ex
}
213 % section - new major section. Argument is section name.
214 \outer\def\section#1{\par\filbreak
215 \vskip 3ex plus
2ex minus
2ex
{\headingfont #1}\mark{#1}%
216 \vskip 2ex plus
1ex minus
1.5ex
}
220 % beginindentedkeys...endindentedkeys - key definitions will be
221 % indented, but running text, typically used as headings to group
222 % definitions, will not.
223 \def\beginindentedkeys{\keyindent=
1em
}
224 \def\endindentedkeys{\keyindent=
0em
}
227 % paralign - begin paragraph containing an alignment.
228 % If an \halign is entered while in vertical mode, a parskip is never
229 % inserted. Using \paralign instead of \halign solves this problem.
230 \def\paralign{\vskip\parskip\halign}
232 % \<...> - surrounds a variable name in a code example
233 \def\<
#1>
{{\it #1\/
}}
235 % kbd - argument is characters typed literally. Like the Texinfo command.
236 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
238 % beginexample...endexample - surrounds literal text, such a code example.
239 % typeset in a typewriter font with line breaks preserved
240 \def\beginexample{\par\leavevmode\begingroup
241 \obeylines\obeyspaces\parskip0pt\tt}
242 {\obeyspaces\global\let =\
}
243 \def\endexample{\endgroup}
245 % key - definition of a key.
246 % \key{description of key}{key-name}
247 % prints the description left-justified, and the key-name in a \kbd
248 % form near the right margin.
249 \def\key#1#2{\leavevmode\hbox to
\hsize{\vtop
250 {\hsize=
.75\hsize\rightskip=
1em
251 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
254 \setbox\metaxbox\hbox{\kbd{M-x
}}
256 \metaxwidth=
\wd\metaxbox
258 % metax - definition of a M-x command.
259 % \metax{description of command}{M-x command-name}
260 % Tries to justify the beginning of the command name at the same place
261 % as \key starts the key name. (The "M-x " sticks out to the left.)
262 \def\metax#1#2{\leavevmode\hbox to
\hsize{\hbox to
.75\hsize
263 {\hskip\keyindent\relax#1\hfil}%
264 \hskip -
\metaxwidth minus
1fil
267 % threecol - like "key" but with two key names.
268 % for example, one for doing the action backward, and one for forward.
269 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&
\kbd{#2}\hfil\quad
270 &
\kbd{#3}\hfil\quad\cr}
275 \title{GNU Emacs Reference Card
}
277 \centerline{(for version
\versionemacs)
}
279 \section{Starting Emacs
}
281 To enter GNU Emacs
\versionemacs, just type its name:
\kbd{emacs
}
283 \section{Leaving Emacs
}
285 \key{suspend Emacs (or iconify it under X)
}{C-z
}
286 \key{exit Emacs permanently
}{C-x C-c
}
290 \key{{\bf read
} a file into Emacs
}{C-x C-f
}
291 \key{{\bf save
} a file back to disk
}{C-x C-s
}
292 \key{save
{\bf all
} files
}{C-x s
}
293 \key{{\bf insert
} contents of another file into this buffer
}{C-x i
}
294 \key{replace this file with the file you really want
}{C-x C-v
}
295 \key{write buffer to a specified file
}{C-x C-w
}
296 \key{toggle read-only status of buffer
}{C-x C-q
}
298 \section{Getting Help
}
300 The help system is simple. Type
\kbd{C-h
} (or
\kbd{F1
}) and follow
301 the directions. If you are a first-time user, type
\kbd{C-h t
} for a
304 \key{remove help window
}{C-x
1}
305 \key{scroll help window
}{C-M-v
}
307 \key{apropos: show commands matching a string
}{C-h a
}
308 \key{describe the function a key runs
}{C-h k
}
309 \key{describe a function
}{C-h f
}
310 \key{get mode-specific information
}{C-h m
}
312 \section{Error Recovery
}
314 \key{{\bf abort
} partially typed or executing command
}{C-g
}
315 \metax{{\bf recover
} files lost by a system crash
}{M-x recover-session
}
316 \metax{{\bf undo
} an unwanted change
}{C-x u, C-_
{\rm or
} C-/
}
317 \metax{restore a buffer to its original contents
}{M-x revert-buffer
}
318 \key{redraw garbaged screen
}{C-l
}
320 \section{Incremental Search
}
322 \key{search forward
}{C-s
}
323 \key{search backward
}{C-r
}
324 \key{regular expression search
}{C-M-s
}
325 \key{reverse regular expression search
}{C-M-r
}
327 \key{select previous search string
}{M-p
}
328 \key{select next later search string
}{M-n
}
329 \key{exit incremental search
}{RET
}
330 \key{undo effect of last character
}{DEL
}
331 \key{abort current search
}{C-g
}
333 Use
\kbd{C-s
} or
\kbd{C-r
} again to repeat the search in either direction.
334 If Emacs is still searching,
\kbd{C-g
} cancels only the part not matched.
336 \shortcopyrightnotice
341 \paralign to
\hsize{#
\tabskip=
10pt plus
1 fil&#
\tabskip=
0pt&#
\cr
342 \threecol{{\bf entity to move over
}}{{\bf backward
}}{{\bf forward
}}
343 \threecol{character
}{C-b
}{C-f
}
344 \threecol{word
}{M-b
}{M-f
}
345 \threecol{line
}{C-p
}{C-n
}
346 \threecol{go to line beginning (or end)
}{C-a
}{C-e
}
347 \threecol{sentence
}{M-a
}{M-e
}
348 \threecol{paragraph
}{M-\
{}{M-\
}}
349 \threecol{page
}{C-x
[}{C-x
]}
350 \threecol{sexp
}{C-M-b
}{C-M-f
}
351 \threecol{function
}{C-M-a
}{C-M-e
}
352 \threecol{go to buffer beginning (or end)
}{M-<
}{M->
}
355 \key{scroll to next screen
}{C-v
}
356 \key{scroll to previous screen
}{M-v
}
357 \key{scroll left
}{C-x <
}
358 \key{scroll right
}{C-x >
}
359 \key{scroll current line to center, top, bottom
}{C-l
}
361 \key{goto line
}{M-g g
}
362 \key{goto char
}{M-g c
}
363 \key{back to indentation
}{M-m
}
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
{\rm or
} y
}
405 \key{replace this one, don't move
}{,
}
406 \key{{\bf skip
} to next without replacing
}{DEL
{\rm or
} n
}
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
}
413 \section{Multiple Windows
}
415 When two commands are shown, the second is a similar command for a
416 frame instead of a window.
418 {\setbox0=
\hbox{\kbd{0}}\advance\hsize by
0\wd0
419 \paralign to
\hsize{#
\tabskip=
10pt plus
1 fil&#
\tabskip=
0pt&#
\cr
420 \threecol{delete all other windows
}{C-x
1\ \ \ \
}{C-x
5 1}
421 \threecol{split window, above and below
}{C-x
2\ \ \ \
}{C-x
5 2}
422 \threecol{delete this window
}{C-x
0\ \ \ \
}{C-x
5 0}
424 \key{split window, side by side
}{C-x
3}
426 \key{scroll other window
}{C-M-v
}
428 {\setbox0=
\hbox{\kbd{0}}\advance\hsize by
2\wd0
429 \paralign to
\hsize{#
\tabskip=
10pt plus
1 fil&#
\tabskip=
0pt&#
\cr
430 \threecol{switch cursor to another window
}{C-x o
}{C-x
5 o
}
432 \threecol{select buffer in other window
}{C-x
4 b
}{C-x
5 b
}
433 \threecol{display buffer in other window
}{C-x
4 C-o
}{C-x
5 C-o
}
434 \threecol{find file in other window
}{C-x
4 f
}{C-x
5 f
}
435 \threecol{find file read-only in other window
}{C-x
4 r
}{C-x
5 r
}
436 \threecol{run Dired in other window
}{C-x
4 d
}{C-x
5 d
}
437 \threecol{find tag in other window
}{C-x
4 .
}{C-x
5 .
}
440 \key{grow window taller
}{C-x ^
}
441 \key{shrink window narrower
}{C-x \
{}
442 \key{grow window wider
}{C-x \
}}
446 \key{indent current
{\bf line
} (mode-dependent)
}{TAB
}
447 \key{indent
{\bf region
} (mode-dependent)
}{C-M-\\
}
448 \key{indent
{\bf sexp
} (mode-dependent)
}{C-M-q
}
449 \key{indent region rigidly
{\it arg\/
} columns
}{C-x TAB
}
450 \key{indent for comment
}{M-;
}
452 \key{insert newline after point
}{C-o
}
453 \key{move rest of line vertically down
}{C-M-o
}
454 \key{delete blank lines around point
}{C-x C-o
}
455 \key{join line with previous (with arg, next)
}{M-^
}
456 \key{delete all white space around point
}{M-\\
}
457 \key{put exactly one space at point
}{M-SPC
}
459 \key{fill paragraph
}{M-q
}
460 \key{set fill column to
{\it arg
}}{C-x f
}
461 \key{set prefix each line starts with
}{C-x .
}
465 \section{Case Change
}
467 \key{uppercase word
}{M-u
}
468 \key{lowercase word
}{M-l
}
469 \key{capitalize word
}{M-c
}
471 \key{uppercase region
}{C-x C-u
}
472 \key{lowercase region
}{C-x C-l
}
474 \section{The Minibuffer
}
476 The following keys are defined in the minibuffer.
478 \key{complete as much as possible
}{TAB
}
479 \key{complete up to one word
}{SPC
}
480 \key{complete and execute
}{RET
}
481 \key{show possible completions
}{?
}
482 \key{fetch previous minibuffer input
}{M-p
}
483 \key{fetch later minibuffer input or default
}{M-n
}
484 \key{regexp search backward through history
}{M-r
}
485 \key{regexp search forward through history
}{M-s
}
486 \key{abort command
}{C-g
}
488 Type
\kbd{C-x ESC ESC
} to edit and repeat the last command that used the
489 minibuffer. Type
\kbd{F10
} to activate menu bar items on text terminals.
492 \title{GNU Emacs Reference Card
}
496 \key{select another buffer
}{C-x b
}
497 \key{list all buffers
}{C-x C-b
}
498 \key{kill a buffer
}{C-x k
}
500 \section{Transposing
}
502 \key{transpose
{\bf characters
}}{C-t
}
503 \key{transpose
{\bf words
}}{M-t
}
504 \key{transpose
{\bf lines
}}{C-x C-t
}
505 \key{transpose
{\bf sexps
}}{C-M-t
}
507 \section{Spelling Check
}
509 \key{check spelling of current word
}{M-\$
}
510 \metax{check spelling of all words in region
}{M-x ispell-region
}
511 \metax{check spelling of entire buffer
}{M-x ispell-buffer
}
512 \metax{toggle on-the-fly spell checking
}{M-x flyspell-mode
}
516 \key{find a tag (a definition)
}{M-.
}
517 \key{find next occurrence of tag
}{C-u M-.
}
518 \metax{specify a new tags file
}{M-x visit-tags-table
}
520 \metax{regexp search on all files in tags table
}{M-x tags-search
}
521 \metax{run query-replace on all the files
}{M-x tags-query-replace
}
522 \key{continue last tags search or query-replace
}{M-,
}
526 \key{execute a shell command
}{M-!
}
527 \key{execute a shell command asynchronously
}{M-\&
}
528 \key{run a shell command on the region
}{M-|
}
529 \key{filter region through a shell command
}{C-u M-|
}
530 \key{start a shell in window
\kbd{*shell*
}}{M-x shell
}
534 \key{copy rectangle to register
}{C-x r r
}
535 \key{kill rectangle
}{C-x r k
}
536 \key{yank rectangle
}{C-x r y
}
537 \key{open rectangle, shifting text right
}{C-x r o
}
538 \key{blank out rectangle
}{C-x r c
}
539 \key{prefix each line with a string
}{C-x r t
}
543 \key{add global abbrev
}{C-x a g
}
544 \key{add mode-local abbrev
}{C-x a l
}
545 \key{add global expansion for this abbrev
}{C-x a i g
}
546 \key{add mode-local expansion for this abbrev
}{C-x a i l
}
547 \key{explicitly expand abbrev
}{C-x a e
}
549 \key{expand previous word dynamically
}{M-/
}
551 \section{Miscellaneous
}
553 \key{numeric argument
}{C-u
{\it num
}}
554 \key{negative argument
}{M--
}
555 \key{quoted insert
}{C-q
{\it char
}}
558 \section{Regular Expressions
}
560 \key{any single character except a newline
}{.
{\rm(dot)
}}
561 \key{zero or more repeats
}{*
}
562 \key{one or more repeats
}{+
}
563 \key{zero or one repeat
}{?
}
564 \key{quote special characters
}{\\
}
565 \key{quote regular expression special character
{\it c\/
}}{\\
{\it c
}}
566 \key{alternative (``or'')
}{\\|
}
567 \key{grouping
}{\\(
{\rm$
\ldots$
} \\)
}
568 \key{shy grouping
}{\\(:?
{\rm$
\ldots$
} \\)
}
569 \key{explicit numbered grouping
}{\\(:NUM
{\rm$
\ldots$
} \\)
}
570 \key{same text as
{\it n\/
}th group
}{\\
{\it n
}}
571 \key{at word break
}{\
\b}
572 \key{not at word break
}{\
\B}
574 \paralign to
\hsize{#
\tabskip=
10pt plus
1 fil&#
\tabskip=
0pt&#
\cr
575 \threecol{{\bf entity
}}{{\bf match start
}}{{\bf match end
}}
576 \threecol{line
}{^
}{\$
}
577 \threecol{word
}{\\<
}{\\>
}
578 \threecol{symbol
}{\
\_<
}{\
\_>
}
579 \threecol{buffer
}{\\`
}{\\'
}
580 %% FIXME: "`" and "'" isn't displayed correctly in the output PDF file
582 \threecol{{\bf class of characters
}}{{\bf match these
}}{{\bf match others
}}
583 \threecol{explicit set
}{[ {\rm$
\ldots$
} ]}{[^
{\rm$
\ldots$
} ]}
584 \threecol{word-syntax character
}{\
\w}{\
\W}
585 \threecol{character with syntax
{\it c
}}{\
\s{\it c
}}{\
\S{\it c
}}
586 \threecol{character with category
{\it c
}}{\
\c{\it c
}}{\
\C{\it c
}}
589 \section{International Character Sets
}
591 \key{specify principal language
}{C-x RET l
}
592 \metax{show all input methods
}{M-x list-input-methods
}
593 \key{enable or disable input method
}{C-\\
}
594 \key{set coding system for next command
}{C-x RET c
}
595 \metax{show all coding systems
}{M-x list-coding-systems
}
596 \metax{choose preferred coding system
}{M-x prefer-coding-system
}
600 \key{enter the Info documentation reader
}{C-h i
}
601 \key{find specified function or variable in Info
}{C-h S
}
604 Moving within a node:
606 \key{scroll forward
}{SPC
}
607 \key{scroll reverse
}{DEL
}
608 \key{beginning of node
}{b
}
610 Moving between nodes:
612 \key{{\bf next
} node
}{n
}
613 \key{{\bf previous
} node
}{p
}
614 \key{move
{\bf up
}}{u
}
615 \key{select menu item by name
}{m
}
616 \key{select
{\it n\/
}th menu item by number (
1--
9)
}{{\it n
}}
617 \key{follow cross reference (return with
\kbd{l
})
}{f
}
618 \key{return to last node you saw
}{l
}
619 \key{return to directory node
}{d
}
620 \key{go to top node of Info file
}{t
}
621 \key{go to any node by name
}{g
}
625 \key{run Info
{\bf tutorial
}}{h
}
626 \key{look up a subject in the indices
}{i
}
627 \key{search nodes for regexp
}{s
}
628 \key{{\bf quit
} Info
}{q
}
635 \key{save region in register
}{C-x r s
}
636 \key{insert register contents into buffer
}{C-x r i
}
638 \key{save value of point in register
}{C-x r SPC
}
639 \key{jump to point saved in register
}{C-x r j
}
641 \section{Keyboard Macros
}
643 \key{{\bf start
} defining a keyboard macro
}{C-x (
}
644 \key{{\bf end
} keyboard macro definition
}{C-x )
}
645 \key{{\bf execute
} last-defined keyboard macro
}{C-x e
}
646 \key{append to last keyboard macro
}{C-u C-x (
}
647 \metax{name last keyboard macro
}{M-x name-last-kbd-macro
}
648 \metax{insert Lisp definition in buffer
}{M-x insert-kbd-macro
}
650 \section{Commands Dealing with Emacs Lisp
}
652 \key{eval
{\bf sexp
} before point
}{C-x C-e
}
653 \key{eval current
{\bf defun
}}{C-M-x
}
654 \metax{eval
{\bf region
}}{M-x eval-region
}
655 \key{read and eval minibuffer
}{M-:
}
656 \metax{load a Lisp library from
{\bf load-path
}}{M-x load-library
}
658 \section{Simple Customization
}
660 \metax{customize variables and faces
}{M-x customize
}
662 % The intended audience here is the person who wants to make simple
663 % customizations and knows Lisp syntax.
665 Making global key bindings in Emacs Lisp (example):
668 (global-set-key (kbd "C-c g") 'search-forward)
669 (global-set-key (kbd "M-\#") 'query-replace-regexp)
672 \section{Writing Commands
}
675 (defun \<command-name> (\<args>)
676 "\<documentation>" (interactive "\<template>")
683 (defun this-line-to-top-of-window (line)
684 "Reposition current line to top of window.
685 With prefix argument LINE, put point on LINE."
687 (recenter (if (null line)
689 (prefix-numeric-value line))))
692 The
\kbd{interactive
} spec says how to read arguments interactively.
693 Type
\kbd{C-h f interactive RET
} for more details.
700 % compile-command: "pdftex refcard"