GNU
Emacs may be the most significant result of research in AI to date
:). If you have ever been accused of being a geek, then you will
probably learn to love GNU Emacs. Emacs is to `text editor' as the
PPG building is to a mud hut. It has an enormous diskspace footprint,
and is capable of doing just about anything, including reading the
WWW,
sending email,
managing your email,
transparent FTP (/host:filename or /user@host:filename),
archie,
file/directory management,
running (La)TeX,
managing CVS repositories
(CVS),
running interactive shells (M-x shell),
keeping databases,
acting like an arbitrary precision RPN
calculator
with graphics capabilies,
spell-checking (M-$ for word check, M-x
ispell-buffer for buffer check, etc),
reading netnews,
running
a compiler
and moving you to error points in your code,
debugging C programs (M-x gdb),
managing a calendar
and even editing text files.
While editing programs in Lisp,
C,
Scheme, Ada, or other
languages, it is capable of indenting and highlighting your code based
on syntax so that errors may be easily detected before the compiler or
interpreter chokes. In addition, its language
ELISP
(soon to be replaced with GUILE?) is a powerful standalone language
like Common Lisp but specialized for scanning and analyzing text.
C-f (control-f) moves Forward one character
C-b (control-b) moves Back one character
C-n moves to Next line
C-p moves to Previous line
C-v moves down one screen
M-v (meta-v, or "Esc, then v") moves up one screen
M-< Beginning of buffer
M-> End of buffer
C-x C-s Save this buffer
C-x C-c Get me out of Emacs!
Yes, Emacs key bindings are arcane and initially awkward. But they eventually become second nature and can be typed quickly, so Emacs regulars often feel like Emacs is brain-controlled (like in Firefox, if you saw that movie).
C-h i (note that this stands for "Control-h i" or on
most machines means press and hold Control, then press h, then
release both keys and press i). Also note that if you note the
next item, info mode may be more useful to you. Info mode is a
simple documentation environment which you can navigate around
in via links by moving the cursor to a menu entry using
pressing return on links you want to follow. Pressing "u" moves
you up to the last level in the info document, "d" moves you to
the top level, and "q" gets you out. The entries in info mode
are hypertext versions of the entire manuals of GNU programs.
They are very complete and very high quality (especially in
contrast to UNIX man pages!).
Make sure that in your environment, INFOPATH points to a directory full of useful info files. As of the creation of this document, a good directory (CS/VASC) is:
setenv INFOPATH /afs/cs/misc/gnu-emacs/common/alpha/info
C-x C-c
(control-x control-c).
C-q
(Control and `q') Quotes next keystroke, so that it
is not bound to a command (eg. C-q C-q puts a control-q
character in your buffer).
C-x u
(Control and `x', then `u'). This is the `undo'
command. Emacs stores a long history of things you have
done, so you can undo lots of changes by repeating the
sequence until you are happy again. If you want to `undo'
an `undo', just press the spacebar and hit C-x
u twice to undo the space and then the previous undo.
M-q
(meta-q: this usually means press and release the
Esc key, then press q. If you do not have an escape
key, you can replace it with C-[ -- pressing Control and
the `[' key at the same time).
M-q
reflows the current paragraph (breaking lines at the
current fill columns, usually 72 characters if I
remember correctly). A paragraph is usually seperated
from other paragraphs by an empty line in the text.
Somethimes AucTeX mode or another mode tells Emacs how
to be more smart about knowing what is the paragraph
boundary.
M-x
puts the cursor at the bottom of the screen where
you can enter a name of a command which you want to run.
for example:
M-x
`auto-fill-mode' puts you in a `minor-mode' where
lines are automatically broken when you type past the
fill-column.
C-h i
puts you in info mode.
C-h m
gives you information about the mode you are
currently in.
C-x m
brings-up a buffer for sending email (very
convienent). If you have
(add-hook 'mail-setup-hook 'mail-abbrevs-setup)in your
.emacs file (the file in your home directory
which GNU Emacs reads when it starts up -- use this to
specialize your Emacs environment), then pressing
[space] or [return] in the To: or cc: fields will try to
complete a name based on the `alias' entries in your
.mailrc file.
C-x (
starts a keyboard macro. Type a keysequence and
end it with C-x ). Replay it with C-x e. This is
incredibly useful. You can even turn the macro in to
ELISP code (look up in the info mode).
You can define keystroke sequences
which convert a line of data from one format to, say,
Matlab-readable format, then repeat the macro for all
the lines in your file using the following:
M-[number] [key]
(Press Esc, then type an number, then a
keystroke/sequence). This repeats the [key] [number]
times. Thus, `/' `M-70 *' opens a C-comment with a line
of asterics, and `M-9999 C-e' repeats the last defined
keystroke macro may times. If your macro involves
moving to the next line of text, then the
`end-of-buffer' error will stop the repetition of the
keyboard macro when the last line in the file has been
processed. This is a great approach to one-shot
conversions of data. For instance, to generate a
header-file for a C code file, you could enter a
keyboard macro that
M-w
C-x y, then puts a `;' at the end
M-900 C-e to repeat the macro until no further
function definitions are found in the file.
C-s
opens incremental search mode (C-r searches backward
rather than forward).
M-C-s
opens incremental regular-expression-based search
mode. (M-C-r searches backward)
C-[space]
sets a mark in the text.
C-w
deletes text between mark (see C-[space]) and
current position. It puts the text in the `yank' buffer
(think `Cut' in Windows or Mac).
M-w
is like above, but does not delete the text
(think `Copy' in WiMP interfaces).
C-y
copies text in `yank' buffer into text at current
point (WiMP equivalent is `Paste')
C-x 2
splits the screen vertically. C-x o moves to the
next window on the screen, C-x 1 makes the current
window the only window, C-x 0 hides the current window.
C-x 5 2, C-x 5 o and C-X 5 0
are roughly equivalent to
the above commands, but open, move between, and close
X-frames, so that it looks like you are running more
than one copy of Emacs.
3/21/95 Created by Chris Lee.
4/19/95 Redone by Chris Lee (changed from an Emacs modes document to a
general GNU Emacs document).