Table E-6. Search and replace commands ( Chapter 3 Chapter 3. Search and Replace The commands we discussed in the first two chapters are enough to get you started, but they're certainly not enough to do any serious editing. If you're using Emacs for anything longer than a few paragraphs, you'll want the support this chapter describes. In this chapter, we cover the various ways that Emacs lets you search for and replace text. Emacs provides the traditional search and replace facilities you would expect in any editor; it also provides several important variants, including incremental searches, regular expression searches, and query-replace. We also cover spell-checking here, because it is a type of replacement (errors are sought and replaced with corrections). Finally, we cover word abbreviation mode; this feature is a type of automatic replacement that can be a real timesaver.
)
Keystrokes |
Command name |
Action |
C-s Edit → Search → Incremental Search → Forward String |
isearch-forward |
Start incremental search forward; follow by search string. Also, find next occurrence (forward) of search string. |
C-r Edit → Search → Incremental Search → Backward String |
isearch-backward |
Start incremental search backward; follow by search string. Also, find next occurrence (backward) of search string. |
Table E-7. Regular expression search commands
Table E-7. Regular expression search commands ( Chapter 3 Chapter 3. Search and Replace The commands we discussed in the first two chapters are enough to get you started, but they're certainly not enough to do any serious editing. If you're using Emacs for anything longer than a few paragraphs, you'll want the support this chapter describes. In this chapter, we cover the various ways that Emacs lets you search for and replace text. Emacs provides the traditional search and replace facilities you would expect in any editor; it also provides several important variants, including incremental searches, regular expression searches, and query-replace. We also cover spell-checking here, because it is a type of replacement (errors are sought and replaced with corrections). Finally, we cover word abbreviation mode; this feature is a type of automatic replacement that can be a real timesaver.
)
Keystrokes |
Command name |
Action |
C-M-s Enter Edit → Search → Regexp Forward |
re-search-forward |
Search for a regular expression forward. |
C-M-r Enter Edit → Search → Regexp Backwards |
re-search-backward |
Search for a regular expression backward. |
C-M-s Edit → Search → Incremental Search → Forward Regexp |
isearch-forward-regexp |
Search incrementally forward for a regular expression. |
C-M-r Edit → Search → Incremental Search → Backward Regexp |
isearch-backward-regexp |
Search incrementally backward for a regular expression. |
C-M-% Edit → Replace → Replace Regexp |
query-replace-regexp |
Query-replace a regular expression. |
Table E-8. Spell-checking commands
Table E-8. Spell-checking commands ( Chapter 3 Chapter 3. Search and Replace The commands we discussed in the first two chapters are enough to get you started, but they're certainly not enough to do any serious editing. If you're using Emacs for anything longer than a few paragraphs, you'll want the support this chapter describes. In this chapter, we cover the various ways that Emacs lets you search for and replace text. Emacs provides the traditional search and replace facilities you would expect in any editor; it also provides several important variants, including incremental searches, regular expression searches, and query-replace. We also cover spell-checking here, because it is a type of replacement (errors are sought and replaced with corrections). Finally, we cover word abbreviation mode; this feature is a type of automatic replacement that can be a real timesaver.
)
Keystrokes |
Command name |
Action |
( none ) Tools → Spell Checking → Spell-Check Buffer |
ispell-buffer |
Check spelling of the buffer. |
( none ) Tools → Spell Checking → Spell-Check Comments |
ispell-comments-and-strings |
Checks spelling of comments and strings in a program. |
( none ) Tools → Spell Checking → Automatic Spell-Checking (Flyspell) |
flyspell-mode |
Enter the flyspell minor mode, in which incorrectly spelled words are highlighted. |
( none ) |
flyspell-buffer |
Spell-check the current buffer, underlining all misspelled words. Use middle mouse button to correct. |
Table E-9. Buffer commands
Table E-9. Buffer commands ( Chapter 4)
Keystrokes |
Command name |
Action |
C-x b Buffers → Select Named Buffer |
switch-to-buffer |
Move to the buffer specified. |
C-x → Buffers → Next Buffer |
next-buffer |
Move to the next buffer in the buffer list. |
C-x Buffers → Previous Buffer |
previous-buffer |
Move to the previous buffer in the buffer list. |
C-x C-b Buffers → List All Buffers |
list-buffers |
Display the buffer list. |
C-x k |
kill-buffer |
Delete the buffer specified. |
(none) |
kill-some-buffers |
Ask about deleting each buffer. |
Table E-10. Windows and frames
Table E-10. Windows and frames ( Chapter 4)
Keystrokes |
Command name |
Action |
C-x 2 File → Split Window |
split-window-vertically |
Divide current window into two windows, one above the other. |
C-x 3 |
split-window-horizontally |
Divide current window into two side-by-side windows. |
C-x o |
other-window |
Move to the other window; if there are several, move to the next window. |
C-x 0 |
delete-window |
Delete the current window. |
C-x 1 File → Unsplit Windows |
delete-other-windows |
Delete all windows but this one. |
C-x 4 f |
find-file-other-window |
Find a file in the other window. |
C-x 4 b |
switch-to-buffer-other-window |
Select a buffer in the other window. |
( none ) Tools → Compare (Ediff) → This Window and Next Window |
compare-windows |
Compare this window with the next window and show the first difference. |
C-x 5 o Buffers → Frames |
other-frame |
Move to other frame. |
C-x 5 0 File → Delete Frame |
delete-frame |
Delete current frame. |
C-x 5 2 File → New Frame |
make-frame |
Create a new frame on the current buffer. |
C-x 5 f |
find-file-other-frame |
Find file in a new frame. |
C-x 5 r |
find-file-read-only-other-frame |
Finds a file in a new frame, but it is read-only. |
C-x 5 b |
switch-to-buffer-other-frame |
Make frame and display other buffer in it. |
Table E-11. Shell mode commands
Читать дальше