Preface
Emacs is the most powerful text editor available today. Unlike mostother editors (in particular, unlike the standard Unix editor, vi ), Emacs is a complete workingenvironment. No matter what you do, you can start Emacs in themorning, work all day and all night, and never leave it: you can useit to edit, rename, delete, and organize files; to compile programs;to run shell commands; and so on. Before windowing systems like X andMicrosoft Windows became popular, Emacs often served as a completewindowing system of its own. All you needed was a terminal, and youcould live within Emacs forever. Emacs is also infinitely flexible;you can write your own commands, change the keys that are associatedwith commands, and (if you are willing to take the time) do justabout anything you want.
Why Read This Book?
Because it does so much, Emacs has a reputation for being extremelycomplicated. We don't think that'swarranted; we teach you Emacs from the ground up, covering first thebasics and then some of the more advanced features.
In this book, we have tried to reach as broad an audience aspossible: from casual users to professional writers and web authorsto programmers to system administrators. No matter what you do withEmacs, you will find it's easy to learn; after oneor two sessions, you'll know the basics of editingany file. After you learn the basics, you can go on to learn aboutmore advanced topics that provide the real benefits of using Emacs.These include:
Using multiple windows and buffers so you can work on several filesat once
Customizing keyboard commands
Tailoring Emacs to fit your work style
Making Emacs your work environment where you can do all your everydaytasks, such as organizing files, compiling programs, and issuingshell commands
Creating macros to streamline repetitive tasks
Using Emacs to support programming in many languages (including C,C++, Lisp, Java, and Perl)
Formatting files with various markup languages, such as HTML and XML
Using word abbreviations to avoid spelling out long phrases or tocorrect common misspellings
Of course, many of the topics may not apply to you; some topics maybe appropriate for a second reading but not for the first. Toward theend of the preface, we'll sketch several differentways to approach the book, depending on your interests andexperience.
Which Emacs Is Which?
]
This book covers GNU Emacs. Since its appearance, GNU Emacs hasbecome the most popular, powerful, and flexible Emacs, andthere's no reason to believe that this situationwill change. If you know GNU Emacs, you will be able to adapt to anyother Emacs implementation with no trouble; it's notso easy to go in the other direction.
This book, however, isn't limited to GNU Emacsusers. Because of the similarities between different Emacsimplementations, this book should help you get started with any Emacseditor. The basic keyboard commands change little from one editor toanotheryou'll find that C-n (for Ctrl-n ) almost always means"move to the next line." Emacseditors tend to differ in the more advanced commands and features,but if you are using these more advanced facilities and youaren't using GNU Emacs, you should consider makingthe switch.
[] Quite a few issues come up in discussions of GNU Emacs versus XEmacs,with character encoding schemes, user interface differences, andcopyright issues among them. We're not interested intaking sides in the battles between these emacsen.
What's New in This Edition?
This third edition covers GNU Emacs 21, specifically 21.3 and evenmore specifically 21.3.5.[] This new edition has been completely revised and expandedto cover new features and to meet the evolving needs of Emacs users.
Here are some of the highlights of what we'vechanged:
User interface changes, including the addition of an icon-basedtoolbar, extensive changes to menus, and a more graphical interface()
How Emacs interacts with the operating system clipboard, includingspecific clipboard-related commands ()
Dynamic abbreviations ()
Expanded coverage of the directory editor, Dired, to help youorganize and work with files more efficiently ()
Changes to the way Emacs handles tabs and indentation and how to getEmacs to do what you want it to ()
Artist mode for drawing with the mouse ()
Inserting characters from other character sets in HTML files ()
Using font-lock mode for coloring text for easier editing ()
Expanded Java coverage, including how to install and use the JavaDevelopment Environment for Emacs (JDEE) ()
Perl support with Cperl mode ()
Managing changes to large, multiple file projects more effectivelyusing etags ()
Customizing Emacs through the interactive Custom interface or throughthe .emacs startup file ()
Expanded coverage of how version control mode connects with a varietyof change control systems, including CVS, RCS, Subversion, and SCCS()
A new chapter on platform-specific considerations, including detailson how to install the latest version of Emacs on Unix, Windows, andMac OS X ()
[] Typically we would notfind the need to be quite so specific, but the user interface changedat Emacs 21.3.5; in particular you'll noticedifferent toolbar icons if you have an earlier version.
GNU Emacs and the Free Software Foundation
You don't need toknow its history to use GNU Emacs, but its origins are an interestingpart of computer history. The Free Software Foundation (FSF), whichmaintains and distributes GNU Emacs, has become an important part ofcomputer culture.
A longtime ago (1975) at MIT, Richard Stallman wrote the first Emacseditor. According to the folklore, the original Emacs editor was aset of macros for TECO, an almost incomprehensible and now obsoleteline editor. The name Emacs stands for "EditingMacros." Tradition also has it that Emacs is a playon the name of a favorite ice cream store. Much has happened since1975. TECO has slipped into deserved obscurity, and Emacs has beenrewritten as an independent program. Several commercial versions ofEmacs appeared, of which Unipress Emacs and CCA Emacs were the mostimportant. For several years, these commercial implementations werethe Emacs editors you were most likely to run across outside of theacademic world.
Stallman's Emacs became prominent with the birth ofthe Free Software Foundation (FSF) and the GNU Project in 1984. GNUstands for "GNU's NotUnix" and refers to a complete Unix-like operatingsystem (OS) that Stallman and his associates were building.
Stallman founded the FSF to guarantee that some software would alwaysremain free. Note that Free does not necessarilymean cheap (you may have to pay a fee to cover the cost ofdistribution); it most definitely does mean liberated fromrestrictions about how it can be used and specifically how it can beshared.
Stallman is widely recognized as the founder of the free softwaremovement, which was an important predecessor of the open sourcemovement. Linux is now the most prominent example of open sourcesoftware, and it falls under the GNU Public License or GPL (availableonline at http://www.gnu.org/copyleft/gpl.html).Stallman argues that much of Linux outside the kernel itself is GNUsoftware and so he refers to it as GNU/Linux. All controversiesaside, Stallman's contribution to the open sourcemovement cannot be overestimated. GNU software and open sourcesoftware distributed under the GPL are a mainstay for developers andcomputer users all over the world.