|
Unix Programming - A Tale of Five Editors - Emacs
Emacs
Emacs is undoubtedly the most
powerful programmer's editor in existence. It's a big, feature-laden
program with a great deal of flexibility and customizability. As we
observed in the Chapter14
section on Emacs Lisp, Emacs has an entire programming language inside
it that can be used to write arbitrarily powerful editor
functions.
Unlike
vi,
Emacs doesn't have interface modes;
instead, commands are normally control characters or prefixed with an
ESC. However, in Emacs it is possible to
bind just about any key sequence to any command, and commands can be
stock or customized Lisp programs.
Emacs can edit multiple files, each
in a separate buffer, and supports moving text among the buffers.
Versions running under X have native mouse support.
The Lisp programs bound to Emacs keystrokes can perform
arbitrary text transformations on a buffer. This capability is
heavily used, among other things to define syntax-aware and rich-text
editing modes for dozens of different languages and markup formats
(beginning with support and color highlighting of C code as in
vi, but going way beyond that). Each mode
is simply a library file of Lisp code that is loaded on demand.
Emacs Lisp programs can also interactively control arbitrary
subprocesses. Some notable consequences of this capability were
listed earlier, including the ability to serve as a front end for
version-control systems, debuggers, and the like.
The designers of Emacs[119] built a programmable editor
that could have task-related intelligence customized into it for
hundreds of different specialized editing jobs. They then gave it the
ability to drive other tools. As a result, Emacs supports dealing with
all things textual in one shared context — files, mail, news,
debugger symbols. It can serve as a customizable front end to any
command with an interactive textual interface.
It is a common joke, both among fans and detractors of
Emacs, to describe it as an operating
system masquerading as an editor. That overstates the case, but
Emacs certainly does fulfill the role
occupied by integrated development environments (IDEs) under non-Unix
operating systems (a theme to which we shall return in Chapter15).
This power comes at a price in complexity. To use a customized
Emacs you have to carry around the Lisp
files that define your personal Emacs
preferences. Learning how to customize
Emacs is an entire art in
itself. Emacs is correspondingly harder to
learn than vi.
[an error occurred while processing this directive]
|