Learning GNU Emacs, Second Edition

Book description

GNU Emacs is the most popular and widespread of the Emacs family of editors. It is also the most powerful and flexible. Unlike all other text editors, GNU Emacs is a complete working environment -- you can stay within Emacs all day without leaving. This book tells you how to get started with the GNU Emacs editor. It will also "grow" with you: as you become more proficient, this book will help you learn how to use Emacs more effectively. It takes you from basic Emacs usage (simple text editing) to moderately complicated customization and programming. The second edition of Learning GNU Emacs describes all of the new features of GNU Emacs 19.30, including fonts and colors, pull-down menus, scroll bars, enhanced X Window support, and correct bindings for most standard keys. GNUS, a Usenet newsreader, and ange-ftp mode, a transparent interface to the file transfer protocol, are also described. Learning GNU Emacs, second edition, covers:

  • Using Emacs as an Internet Toolkit (to use electronic mail and Usenet news, telnet to other computers, retrieve files using FTP, browse the World Wide Web, and author Web documents)

  • Emacs' rich, comprehensive online help facilities

  • How to edit files with Emacs

  • Using Emacs as a "shell environment"

  • How to take advantage of "built-in" formatting features

  • How to use multiple buffers, Emacs windows, and X Windows

  • Customizing Emacs

  • The Emacs interface to the X Window System, which allows you to use a mouse and pop-up menus

  • Whys and hows of writing macros to circumvent repetitious tasks

  • Emacs as a programming environment

  • The basics of Emacs LISP

  • How to get Emacs

  • The book is aimed at new Emacs users, whether or not they are programmers. Also useful for readers switching from other Emacs implementations to GNU Emacs.

    Table of contents

    1. Learning GNU Emacs, 2nd Edition
      1. 1. Preface
        1. Why Read This Book?
        2. Which Emacs Is Which?
        3. GNU Emacs and the Free Software Foundation
        4. An Approach to Learning Emacs
        5. What We Haven’t Included
        6. Conventions Used in This Book
          1. Emacs Commands
          2. Tables
          3. Examples
          4. Font Usage
        7. How to Contact Us
        8. Acknowledgments
      2. 2. Emacs Basics
        1. Introducing Emacs!
        2. Understanding Files and Buffers
        3. A Word About Modes
        4. Starting Emacs
        5. About the Emacs Screen
          1. X Tips: The Emacs X Window Display
        6. Emacs Commands
          1. X Tips: Using Pull-Down Menus
          2. Using Text-Based Menus
        7. Opening a File
          1. If You Read the Wrong File
          2. Letting Emacs Fill in the Blanks
          3. Inserting and Appending Files
          4. How Emacs Chooses a Default Directory
        8. Saving Files
        9. Leaving Emacs
        10. Getting Help
          1. The Help Menu
        11. Summary
          1. Problems You May Encounter
      3. 3. Editing Files
        1. Moving the Cursor
          1. Other Ways to Move the Cursor
          2. Moving a Screen (or More) at a Time
          3. X Tips: Using the Scrollbar
          4. Repeating Commands
          5. Redrawing the Display
          6. Emacs Commands and Your Keyboard
        2. Deleting Text
          1. Recovering What You’ve Deleted
        3. Marking Text to Delete, Move, or Copy
          1. X Tips: Marking Text with a Mouse
          2. Copying Text
          3. Recovering Earlier Deletions
          4. Selecting and Pasting
        4. Reformatting Paragraphs
        5. Editing Tricks and Shortcuts
          1. Fixing Transpositions
          2. Changing Capitalization
          3. Typing over Old Text with Overwrite Mode
        6. Stopping Commands and Undoing Changes
          1. Stopping Commands
          2. Undoing Changes
          3. Reverting a Buffer from a File
          4. Going Back to a Previous Version: Backup Files
          5. Recovering Lost Changes
        7. Making Emacs Work the Way You Want
          1. Turning On Text Mode and Auto-Fill Mode Automatically
          2. Turning on Transient Mark Mode Automatically
          3. Solving Flow-Control Problems
          4. Remapping Keys
          5. Problems with Help
          6. Turning Off Key Suggestions
          7. Problems You May Encounter
      4. 4. Search and Replace Operations
        1. Different Kinds of Searches
          1. Incremental Search
          2. Simple Searches
          3. Word Search
        2. Search and Replace
          1. Simple Search and Replace Operations
          2. Query-Replace
          3. Repeating Query-Replaces (and Other Complex Commands)
          4. Recursive Editing
          5. Are Emacs Searches Case-Sensitive?
          6. Regular Expressions for Search and Replacement Operations
        3. Checking Spelling
          1. Using Ispell
            1. Checking a single word
            2. The Ispell process
          2. Using the UNIX Spell Checker
            1. Adding words to the UNIX spell checker’s dictionary
        4. Word Abbreviation Mode
          1. Trying Word Abbreviations for One Session
          2. Making Word Abbreviations Part of Your Startup
          3. Deleting a Word Abbreviation
          4. Disabling Word Abbreviations
          5. Abbreviations and Capitalization
          6. Problems You May Encounter
      5. 5. Using Buffers and Windows
        1. Files, Buffers, and Windows
        2. Working with Multiple Buffers
          1. Saving Multiple Buffers
          2. Deleting Buffers
          3. Renaming Buffers
          4. Read-Only Buffers
        3. Working with Windows
          1. Creating Horizontal Windows
          2. Creating Vertical or Side-by-Side Windows
          3. Moving Between Windows
          4. Getting Rid of Windows
          5. Enlarging and Shrinking Windows
          6. Limits on Window Size
          7. Shortcut Commands for Working with Other Windows
          8. Comparing Files Between Windows
          9. Getting a List of Buffers
          10. Working with the Buffer List
        4. Holding Your Place with Bookmarks
          1. Setting Bookmarks
          2. Moving to a Bookmark
          3. Renaming and Deleting Bookmarks
          4. Working with a List of Bookmarks
          5. A Few More Bookmark Commands
        5. Temporarily Suspending Emacs
        6. Using Multiple X Windows
          1. Working with Frames
          2. How Frames and Buffers Are Related
          3. Problems You May Encounter
      6. 6. Emacs as a Work Environment
        1. Executing UNIX Commands in Shell Buffers
          1. Running One Command at a Time
          2. Using Shell Mode
            1. The current directory
            2. Shell initialization
            3. Problems with remote shells
            4. Preventing security problems with shell mode
        2. Working with Files and Directories
          1. Viewing and Editing Files
          2. Deleting, Copying, and Renaming Files
          3. Compressing and Uncompressing Files
          4. Comparing Files
          5. Running UNIX Commands on Files
          6. Working with Groups of Files
            1. Selecting files
            2. Using regular expressions to choose files
            3. Operating on groups of files
          7. Simple Directory Listings
        3. Printing from Emacs
        4. Reading Manpages in Emacs
        5. Using Time Management Tools
          1. Displaying the Time
          2. Displaying the Calendar
            1. Moving in the calendar
            2. Displaying holidays
          3. Using the Diary
            1. Creating a diary file
            2. Adding diary entries
            3. Displaying diary entries
        6. Using Your Emacs Work Environment
      7. 7. Email and Usenet News
        1. Working with Mail
        2. Sending Mail from Within Emacs
          1. Sending Mail from a Window or Frame
          2. Spell Checking Mail Messages
          3. Sending Copies to Other Recipients
          4. Sending Blind Copies
          5. Sending a Copy to a File
          6. Inserting a File in a Mail Message
          7. Signing Your Mail Messages
          8. Using Aliases
          9. Using the Reply-to Field
          10. Outgoing Mail Summary
        3. Reading Mail from Within Emacs
          1. Moving Around in RMAIL
          2. Getting New Mail
          3. Deleting Unwanted Mail
          4. Replying to Mail Messages
          5. Forwarding Mail Messages
          6. Saving Messages in a File
          7. Reading Mail Files
          8. Reading Mail Files Saved in ASCII Format
          9. Using Searches in RMAIL
          10. Working with a List of Mail Messages
          11. Labeling Mail
          12. Sorting the Summary List
        4. Reading Usenet News with Gnus
          1. Starting Gnus
          2. Selecting a Group to Read
          3. Reading News
          4. Listing All the Groups
          5. Noise Reduction Through Kill Files
          6. Getting an FAQ
          7. Posting to Usenet with Gnus
            1. Adding a signature
            2. Posting a new article
            3. Replying to an article
            4. Canceling a posting
          8. Exiting Gnus
          9. Problems You May Encounter
      8. 8. Emacs as an Internet Toolkit
        1. Using Telnet Mode
        2. Using Ange-ftp Mode
          1. Copying Files with Ange-ftp Mode
            1. Binary versus ASCII file copying
          2. Finding Text Files with Ange-ftp Mode
        3. Browsing the Web with W3
          1. Making W3 Part of Your Startup
          2. Going to the Default Home Page
          3. Moving Between WWW Pages
          4. Finding a URL with W3
          5. Using Hotlists
          6. W3 and Multimedia Objects
          7. Viewing the URL
          8. Copying URLs
          9. Viewing the HTML Source for a Page
          10. Opening a Local File
          11. Saving Files in W3
          12. Problems You May Encounter
      9. 9. Simple Text Formatting and Specialized Editing
        1. Indenting Text
          1. Using Tabs
            1. Formatting indented paragraphs
            2. Setting tab stops
            3. Changing tabs to spaces
          2. Using Fill Prefixes
          3. Indented Text Mode
            1. Tab settings in indented text mode
          4. Indenting Regions
          5. Some Other Tricks
        2. Centering Text
        3. Inserting Page Breaks
        4. Rectangle Editing
        5. Making Simple Drawings
          1. Drawing in Picture Mode
          2. Editing in Picture Mode
            1. Moving the cursor in picture mode
            2. Inserting lines
          3. Using Rectangle Commands in Picture Mode
        6. Using Outline Mode
          1. Entering Outline Mode
          2. Hiding and Showing Text
          3. Editing While Text Is Hidden
          4. Using Outline Minor Mode
          5. Customizing Outline Mode
      10. 10. Marking up Text with Emacs
        1. Introduction
          1. Comments
        2. Marking up Text for troff and nroff
          1. Paragraph Formatting
          2. Navigation
          3. Finding Headings
          4. Inserting Macro Pairs
          5. Comments in nroff Mode
          6. Making nroff Mode Part of Your Startup
        3. Marking up Text for TEX and LATEX
          1. Matching Braces
          2. Quotation Marks and Paragraphing
          3. Comments
          4. Processing and Printing Text
          5. Differences for LATEX Mode
        4. Writing HTML
        5. Using Html-helper Mode
          1. Starting Html-helper Mode
          2. Typing Special Characters
          3. Putting in a Skeleton
          4. Putting Tags Around a Region
          5. Using Completion
          6. Turning on Prompting
          7. Automatically Updating Timestamps
      11. 11. Writing Macros
        1. What Is a Macro?
        2. Defining a Macro
          1. Example
            1. Example
        3. Tips for Creating Good Macros
          1. Tips for Creating Good Macros
          2. A More Complicated Macro Example
        4. Adding to an Existing Macro
            1. Example
        5. Naming and Saving Your Macros
        6. Executing a Named Macro
            1. Example
        7. Building More Complicated Macros
          1. Pausing a Macro for Keyboard Input
            1. Example
          2. Adding a Query to a Macro
            1. Example
        8. Beyond Macros
      12. 12. Customizing Emacs
        1. Keyboard Customization
          1. Special Keys
        2. Terminal Support
          1. Getting Around Flow-Control Problems
        3. Emacs Variables
        4. Emacs LISP Packages
        5. Auto-Mode Customization
      13. 13. Emacs for Programmers
        1. Language Modes
          1. Syntax
          2. Formatting
        2. C and C++ Modes
          1. Motion Commands
          2. Customizing Code Indentation Style
          3. Additional C and C++ Mode Features
          4. C++ Mode Differences
          5. etags
        3. The LISP Modes
        4. FORTRAN Mode
        5. Compiling Programs
      14. 14. Emacs LISP Programming
        1. Introduction to LISP
          1. Basic LISP Entities
          2. Defining Functions
          3. Turning LISP Functions into Emacs Commands
        2. LISP Primitive Functions
          1. Statement Blocks
          2. Control Structures
        3. Useful Built-In Emacs Functions
          1. Buffers, Text, and Regions
          2. Regular Expressions
            1. Basic operators
            2. Grouping and alternation
            3. Context
            4. Retrieving portions of matches
            5. Regular expression operator summary
          3. Functions that Use Regular Expressions
          4. Finding Other Built-in Functions
        4. Programming a Major Mode
          1. Components of a Major Mode
          2. More LISP Basics: Lists
          3. The Calculator Mode
          4. LISP Code for the Calculator Mode
        5. Customizing Existing Modes
        6. Building Your Own LISP Library
          1. Byte-Compiling LISP Files
      15. 15. Emacs and X
        1. User-Interface Features
          1. Window Scrollbars and X Mode Lines
          2. The Menu Bar
          3. Other Uses of the Mouse
          4. Emacs and X Selections
          5. Using Frames
        2. Using Emacs with X Fonts and Colors
          1. Automatic Highlighting and Coloring
          2. Interactive Font and Color Changes
          3. Saving Font- and Color-Enriched Text
        3. X Display Customizations
        4. Customizing via Your .Xdefaults File
        5. Properties, Frames, Menus, and Mouse Events
          1. Frames
          2. Text Properties and Overlays
            1. Basic text property programming
            2. Special properties
            3. Making and naming faces
            4. Overlays
          3. X Input Events
            1. Keystrokes
            2. Function keys
            3. Mouse events
            4. Frame-focus events
          4. Menus
        6. Communicating with the X Server
        7. A Note on Good X Programming Style
      16. 16. Version Control Under Emacs
        1. The Uses of Version Control
        2. Version Control Concepts
        3. How VC Helps with Basic Operations
        4. Editing Comment Buffers
        5. VC Command Summary
        6. VC Mode Indicators
        7. Which Version Control System?
        8. Individual VC Commands
          1. Working with Groups and Subtrees of Files
          2. Difference Reports
          3. Retrieving Old Revisions
          4. Viewing Change Histories
          5. Registering a File
          6. Inserting Version Control Headers
          7. Making and Retrieving Snapshots
          8. Updating ChangeLog files
          9. vc-rename-file: Renaming Version-Controlled Files
          10. vc-clear-context: When VC Gets Confused
        9. Customizing VC
        10. Extending VC
        11. What VC Is Not
        12. Using VC Effectively
      17. 17. Online Help
        1. Completion
          1. Customizing Completion
        2. Help Commands
          1. Detail Information
          2. Apropos Commands
          3. General Information
        3. Help in Complex Emacs Commands
      18. A. How to Get Emacs
        1. FTP on the Internet
          1. Uncompressing and Unpacking
        2. Free Software Foundation
        3. Other CD-ROM Sources
        4. Building Emacs
      19. B. Making Emacs Work the Way You Think It Should
      20. C. Emacs Variables
      21. D. Emacs LISP Packages
      22. E. Bugs and Bug Fixes
      23. F. Public Statements
        1. The GNU General Public License
          1. General Public License
        2. GNU Manifesto
        3. The League for Programming Freedom
      24. G. Give and It Shall Be Given
      25. H. Quick Reference
      26. I. Glossary
      27. Index
      28. Colophon

    Product information

    • Title: Learning GNU Emacs, Second Edition
    • Author(s):
    • Release date: September 1996
    • Publisher(s): O'Reilly Media, Inc.
    • ISBN: 9781565921528