GNU EMACS: UNIX Text Editing and Programming, 1st edition
Authors: Michael A. Schoonover, Steven Schoonover
Venue:  (1991)

From the Book:PREFACE: GNU Emacs is a powerful, integrated computing environment for UNIX that lets you perform a wide range of editing, programming, and file management tasks. If you have never used Emacs, this book will gently but rapidly introduce you to its most serviceable features. If you are a casual Emacs user, we will attempt to show you ways to edit and manage your files more efficiently. And for experienced users, we have included advanced techniques and reference information to help you unlock the power and flexibility of the environment. Always our emphasis is on practical information, on the commands and features we have found in our own experience to be most useful and powerful.What is GNU Emacs?The name, Emacs, is an acronym derived from "Editor MACroS." A macro is a command that reduces a multi-step process to just a few keystrokes. Emacs uses the Control key and other keys to define a set of one, two, or three keystroke macros (commands) that execute all of its functions. The original set of macros from which Emacs evolved was developed by Richard Stallman and Guy Steele at MIT. Stallman later went on to form the Free Software Foundation, an organization that develops and distributes Emacs and other free software products."GNU"-pronounced "G-Nu"-is a self-referencing acronym derived from the phrase, "GNU's Not UNIX." GNU is the Free Software Foundation's name for a complete set of UNIX-compatible programs, of which Emacs is a part. When completed, GNU will replace many of the standard components of the UNIX operating system.While many UNIX users regard GNU Emacs as an excellent alternative to the vi editor, true Emacs aficionados understand that Emacs isnotmerely an editor, but a complete environment for performing many common computing tasks. Some of the tasks you can perform in the Emacs environment include:Text Editing. Emacs provides unrivaled text-editing power. You can edit multiple documents simultaneously, use specialized editing modes designed specifically for your editing task, create your own powerful keyboard macros, and spell-check your document, to name just a few capabilities.Software Development. Emacs provides several programming language modes, including C, FORTRAN, and Lisp (Pascal mode, while not included with GNU Emacs, is available from other sources; see Appendix A). Emacs provides a complete environment for editing, formatting, and compiling source code.File Management. Emacs provides facilities for manipulating files and directories on your UNIX system.Outlining. Emacs lets you create and edit outlines, using Emacs' special outline mode.Electronic Mail Processing. the Emacs mail handler lets you compose, send, and receive electronic mail (e-mail) messages.Environment Customization. Emacs itself is open to customization and extension to suit you individual preferences and needs. You can replace one command key-sequence with another, and develop and integrate you own commands.About This BookThis book is designed to be a practical companion to Emacs, with examples, tutorials, reference information, and advice for new and experienced users alike. Some of its key features include:Graduated Instructions. New users will quickly learn the basics by working through the "Quick Tour" in Chapter 1, which introduces the key Emacs features and commands. Subsequent chapters build upon this foundation by introducing more efficient and advanced editing techniques.Extensive Tutorials and Examples. Every important feature is thoroughly explained, then demonstrated with an example or short tutorial that you can try on your own Emacs system.Comprehensive Emacs Reference. Advanced users will appreciate the command and function reference in Appendix D, as well as the summary of commands and concepts provided at the end of each chapter.vi-to-Emacs Migration Guide. For vi users who want to move to Emacs, Appendix C lists Emacs equivalents for most vi editor commands.Language-specific Programming Chapters. Individual chapters are provided for programming with C, FORTRAN, Lisp, and Pascal, including advanced instructions for customizing indentation and commenting styles.Customization Instructions. Advanced Emacs users will find helpful advice for customizing and extending Emacs, with a supporting introduction to Emacs-Lisp in Appendix B.Because Emacs is such an extensive and versatile system, you should read this book selectively, focusing on the material that relates to your immediate needs.Part 1, "Text Editing in Emacs," helps you build the basic skills you will need regardless of how you intend to use Emacs. It also describes more efficient and advanced editing techniques for those who need them. This part of the book along with the reference information in Appendix D, may be all you need to read if you are interested solely in proficient text editing.Chapters in this section include:Chapter 1: A Quick Tour of Emacs. This chapter briefly surveys all aspects of the Emacs environment. Here you will learn to use some common editing commands and be introduced to the online help facility, the electronic mail handler, and the file management facility.Chapter 2: Basic Editing Commands. This chapter teaches you how to load and save files, insert and delete text, move around your documents, cut and past regions of text, and perform keyword searches. The features described here are prerequisites to using the more advanced capabilities described in the later chapters.Chapter 3: More Efficient Editing. This chapter describes more efficient ways to edit your documents, including performing operations multiple times, editing words, sentences, paragraphs and pages, using abbreviations and macros, and working with multiple windows.Chapter 4: Advanced Editing. This chapter describes advanced text-editing features, such as changing Emacs' default behavior, searching for regular expressions, and editing outlines, as well as advanced file, buffer, and window operations.Part 2, "Programming in Emacs," describes how to use Emacs as a software development environment. Read Chapter 5 to get an overview of features that are common to all programming languages. Then read Chapter 6 (C), Chapter 7 (FORTRAN), Chapter 8 (Lisp), or Appendix A (Pascal) depending upon which programming language you are using. Chapters in this section include:Chapter 5: Program Development in Emacs. This chapter describes features that are common to all Emacs programming language modes, such as moving around your program, indenting and commenting programs, using tag tables to edit across multiple files, keeping track of source-code changes with ChangeLogs, and compiling programs.Chapter 6: Editing in C Mode. This chapter describes features that are particular to editing C programs, such as moving among and marking C functions, indenting and commenting C programs, working with sexps and lists, and customizing C indentation and commenting styles.Chapter 7: Editing in FORTRAN Mode. This chapter describes features that are particular to editing FORTRAN programs, such as moving among and marking subprograms, indenting and commenting FORTRAN programs, labeling lines, using keyword abbreviations, working with sexps and lists, and customizing FORTRAN indentation and commenting styles.Chapter 8: Editing in Lisp Modes. This chapter describes features that are particular to editing Lisp programs, such as moving among defuns, sexps, and lists, marking text, transposing sexps, killing sexps, indenting and commenting Lisp programs, evaluating Lisp code, and customizing Lisp indentation and commenting styles.Part 3, "Additional Emacs Features," describes various supporting Emacs features such as the online help facility, electronic mail facility, file and buffer management facilities, and spelling checker. Scan these chapters for the features that interest you. Chapters in this section include:Chapter 9: Getting Online Help. This chapter describes how to get online help for Emacs commands, functions, and variables, and how to run the Emacs online tutorial.Chapter 10: Using Emacs for Electronic Mail. This chapter describes how to use the Emacs electronic mail facility, RMAIL, to read and send e-mail messages.Chapter 11: Managing Files and Buffers. This chapter describes how to use the Dired facility to manage your files, and the Buffer-Menu facility to manage your buffers.Chapter 12: Miscellaneous Emacs Features. This chapter summarizes the remaining features of Emacs, including the spelling checker, the auto-save feature, and the UNIX shell mode. Specialized modes for editing Tex, Troff and pictures are also discussed.Part 4, "Customizing and Administering Emacs," describes how to customize, extend, install, configure, and maintain the Emacs environment. Chapters in this section include:Chapter 13: Customizing the Emacs Environment. This chapter describes several ways to customize Emacs to suit your needs and preferences. You will learn how to edit the .emacs start-up file, use variables to change Emacs' behavior, and change command key bindings.Chapter 14: Administering Emacs. This chapter provides UNIX system administrators with advice on installing and maintaining Emacs.Finally, four appendices provide additional details on specialized Emacs topics:Appendix A: Editing in Pascal Mode. This appendix describes how to use a non-standard Pascal mode for editing Pascal programs in Emacs.Appendix B: Emacs-Lisp Programming. This provides a brief introduction to Emacs-Lisp programming. It is intended for experienced Lisp programmers who want to write Emacs-Lisp functions to modify or extend the Emacs environment.Appendix C: Switching from vi to Emacs. This appendix helps vi users make the transition to Emacs by listing the Emacs equivalents for many common vi commands.Appendix D: Emacs Command Reference. This appendix provides a comprehensive quick reference to Emacs commands, functions, and variables.A Word About VersionsThis book describes the features of version 18.57 of industry-standard GNU Emacs as provided by the Free Software Foundation. You may be using a different version-or even a different implementation-of Emacs than ours.During the past several years, programmers have modified, customized, extended, ported, and adapted Emacs until many implementations exist today (gnumacs, GNU, Emacs, x11macs, gnuvo, and MicroEmacs, for example). Even if you are using version 18.57 of GNU Emacs, it's possible that someone has customized your Emacs to work differently than standard Emacs, has added specialized extensions, or has removed functionality that was deemed unnecessary. As a result, some of the commands we describe may be invoked by different key sequences on your systems or may work differently. If your system behaves differently than this book describes, you should consult your UNIX system administrator about modifications made to your system.Versions of Emacs have also been developed that run on the MS-DOS operating system on PCs (for example, MG, MicroEmacs, and Freemacs), and on other specialized hardware and operating systems. These implementations of Emacs are not discussed in this book, but most attempt to emulate many of the features and commands of GNU Emacs.Don't be discouraged by these possible differences. If you have a recent version of Emacs, it will probably behave in much the same way as we describe. And the online help system, if kept up-to-date, may clarify any differences you discover.Key Naming ConventionsFinally, before using Emacs, you should understand the key naming conventions used in this book and in the Emacs online help system. Some of these may be confusing if you have never used Emacs; if so, periodically refer back to this section as you gain experience working through the first few chapters.Table 1.1 describes the default operation of commonly used Emacs keys.AcknowledgmentsWe would like to thank the many people who have contributed their time and talents to this project.We are indebted to Alan Apt, our editor at Addison-Wesley, who had the foresight to recognize the need for such a book as this. And to our reviewers--Darryl Okahata, David Wolpert, Eddie Williamson, Jim Bigelow, Peter Salus, and Adil Lotia--we owe several of the book's features, and have them to thank for its accuracy and thoroughness. We would also like to thank the administrative and production staff at Addison-Wesley--Shirley McGuire and Peggy McMahon--for taking care of all the little and not so little details.At Hewlett-Packard, we have Michael Kolesar, Marl Godfrey, and Bob Silvey to thank for including us in the first crop of Hewlett-Packard Press books.Last and most, we appreciate the patience and support of our families over the course of this long and occasionally arduous project. 0201563452P04062001