Skip to Content
Learning GNU Emacs, Second Edition
book

Learning GNU Emacs, Second Edition

by Debra Cameron, Bill Rosenblatt, Eric S. Raymond
September 1996
Beginner to intermediate
568 pages
20h 31m
English
O'Reilly Media, Inc.
Content preview from Learning GNU Emacs, Second Edition

Editing Tricks and Shortcuts

Now that you’ve learned the basics of editing--moving the cursor to the right position, deleting, copying, and moving text—you can learn some tricks that make editing easier.

Fixing Transpositions

The most common typo involves the transposition of two letters, and most typos are noticed immediately after you make them. Pressing C-t transposes two letters, to put them in the right order:

Before C-t

After C-t

the best of timse, it

the best of times, it

To transpose two letters, put the cursor on the second of the two letters to be transposed. Press C-t. (If you often transpose letters, word abbreviation mode, discussed in Chapter 3, cleans up typos automatically.)

You can also transpose two words, lines, paragraphs, or sentences. To transpose two words, put the cursor between the two words and press ESC t. After Emacs has finished, the cursor follows the second of the two (transposed) words:

Before ESC t

After ESC t

one three two

one two three

To transpose two lines, put the cursor anywhere on the second of the two and press C-x C-t. Emacs moves the second before the first:

Before C-x C-t

After C-x C-t

second line

first line

first line

second line

third line

third line

Table 2-5 summarizes the transposition commands.

Table 3-5. Transposition Commands

Keystrokes

Command Name

Action

C-t

transpose-chars

Transpose two letters.

ESC t

transpose-words

Transpose two words.

C-x C-t

transpose-lines ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning GNU Emacs, 3rd Edition

Learning GNU Emacs, 3rd Edition

Debra Cameron, James Elliott, Marc Loy, Eric S. Raymond, Bill Rosenblatt

Publisher Resources

ISBN: 1565921526Catalog PageErrata