Книга: Learning GNU Emacs, 3rd Edition
3.1.3 Word Search
3.1.3 Word Search
If you're searching for a phrase and you know it's in the file but you can't find it with incremental search, try word search. (You probably can't find your phrase with incremental search because the phrase has a line break in it.) Word search is a nonincremental search that ignores line breaks, spaces, and punctuation. It also requires that your search string match entire words in the file.
To do a word search, type C-s Enter C-w (for word-search-forward). The prompt Word search
appears in the minibuffer. (Don't be put off by the prompts that appear along the way: you'll see an I-search
prompt after typing C-s and a Search
prompt after pressing Enter. Ignore these.) Type the search string and press Enter. Emacs searches for the given string. To do a word search backwards, type C-r Enter C-w instead. For example, assume that you have the following text, with the cursor at the beginning:
He said, "All good elephants are wise, aren't they?"
She answered, "Some are smarter than others, but we
think this is socially conditioned."
The command C-s Enter C-w they she Enter positions the cursor after the word She. This command looks complicated, but it's really nothing more than a word search (C-s Enter C-w) for the word they, followed by the word she. It ignores the punctuation (?") and the newline between they and she.
Assume that you're looking for the word the. You don't want to bother with thence, there, theater, thesis, blithe, or any other word that happens to contain the letters the. In this situation, neither an incremental search nor a simple search is very useful—you need a word search. If you're writing a paper, word search is often exactly what you need. It is the only one of the three basic search commands that allows you to find what you want even if the phrase is split between two lines.
Now that you've seen the three most commonly used searches, you might want to experiment and see which you find most useful.
- Searching for a Match
- 3.2.6 Regular Expressions for Search and Replacement Operations
- 3.2.5 Are Emacs Searches Case-Sensitive?
- Как уменьшить размер документа Microsoft Word?
- Как в документ Microsoft Word вставить текст, в котором отсутствует форматирование?
- Foreword
- Я слышал, что в Microsoft Word можно играть в шахматы. Каким образом?
- Не всегда хочется, чтобы остальные пользователи знали, с какими документами я работал, однако Microsoft Word сохраняет и...
- Как установить пароль на документ в Microsoft Word?
- Открываю документ, распечатываю его, а при закрытии Microsoft Word уточняет, хочу ли я сохранить внесенные изменения. По...
- Есть ли надстройка для Microsoft Word, позволяющая открывать документы в том месте, где в прошлый раз была завершена пра...
- В Microsoft Word исчезли все панели и строка меню… Как их вернуть?