learning emacs (was Re: [lug] vi/vim HOWTO, part 2)
Tkil
tkil at scrye.com
Mon Apr 3 20:56:11 MDT 2000
note that if you simply start up emacs with no other options, it will
tell you that you can access the tutorial (Control+h then "T" on non-x
systems, Help menu -> tutorial on X versions.)
the tutorial will tell you the basics of what you need to know.
after that, learn the standard notation for control keys (although the
presence of a menu bar removes much of the need for heavy memorization
of baroque key sequences): C-x means "hold down control, and then
press the 'X' key once". this is similar to other notations, such as
Ctrl+T, ^t or ^T, etc. "M-" is "meta", which is the diamond key on
suns, and is often the Alt key. but note that the alt key can itself
be used as a modifier (with the expected "A-" prefix).
if your alt key is not a meta key, you can use a single "esc" press
before the letter. so M-x would be "tap esc, tap x". combinations
are possible; C-M-f, for instance, actually does something useful.
the next thing to learn is the info system. this is a tree-structured
hypertext system. you can get into the first screen by typing "C-h
i", then follow that with an "h" for the first-time-user primer (as
the screen will tell you).
this is where all the documentation for emacs lives. also, major
packages have their own documentation trees here. finally, most of
the gnu utilities are documented most thoroughly in info pages, not
man pages (i'm neutral on that decision, however).
as for setting it up to help programmers, you should first try loading
a file of code in that language. emacs can auto-detect many file
types, based either on suffixes (.c, .C, .py, etc) or on the first
line of a file (that is, it recognizes "#!" lines in a limited sense).
some of the modes that ship with emacs might be out of date, or they
might have been superseded. cc-mode and cperl-mode are examples of
these, respectively; cc-mode might have a more current version, and
cperl-mode is a much more capable mode than the standard perl-mode.
syntax-sensitive highlighting is performed by "font-lock", in
cooperation with the various programming modes. see the info pages
for more information on this.
you can configure things (load paths, font colors, modes, etc) in your
~/.emacs file; this is also covered in the info pages.
finally, there are many other sources to learn from. there are books
available; i know o'reilly has at least one book out that is
explicitly for learning emacs, and the FSF sells various gnu emacs
manuals (which are stocked down at the tattered cover in denver, at
the very least).
there are newsgroups (gnu.emacs*?), there is an emacs FAQ out there
somewhere, there is the xemacs site (www.xemacs.org), there are man
pages, there is deja.com for old postings to the newsgroups, and most
importantly, there are other people whose .emacs files you can borrow
and attempt to get working.
this last is how i learned much of my elisp programming skill, and it
is pretty effective (although it does run the risk of accumulating
cruft; new ways of getting things done do accumulate.)
i personally use xemacs, and you can view my .emacs file and various
screenshots at:
http://slinky.scrye.com/~tkil/elisp/
hm, ".emacs" doesn't show up there. you can read it, though, if you
enter ".emacs" as a file name there:
http://slinky.scrye.com/~tkil/elisp/.emacs
a final editorial: don't think of emacs as "just an editor". it is
an environment which happens to include a very powerful text editor.
it also includes a newsreader (gnus), mail readers (mh-e, vm, rmail),
web browsers (emacs-w3), directory browser (dired), file viewer
(view-file and friends), scripting language (emacs-lisp, and someone
managed to strap perl onto gnu emacs), a tower-of-hanoi simulation,
support for many programming languages, ability to run subshells for
things like compilation or even simple command lines with filename
completion, and much more.
so, hopefully this has answered some questions. read the FAQ, do the
tutorial, learn the info system, read other people's init files, and
so on.
note that init files are not the only way to make permanent changes.
for quite a few years now, emacs has had a "customize" package to
make these sort of appearance and behavior modifications through a
gui, with no elisp coding required. as i said, my .emacs file has
accumulated some cruft over the years.
if you are a vi fan, but would like to try out emacs, there are
various vi emulation modes.
and as an absolutely last comment, *do* take care of your wrists if
you start to use emacs heavily. its reliance on key chording is
probably a contributing factor to RSI in its users. take common-
sense precautions, take breaks, use the arrow keys and mouse for a
change of pace.
any questions?
t.
More information about the LUG
mailing list