Debra Cameron - Learning GNU Emacs, 3rd Edition

Здесь есть возможность читать онлайн «Debra Cameron - Learning GNU Emacs, 3rd Edition» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Год выпуска: 2004, ISBN: 2004, Издательство: O'Reilly Media, Жанр: Программы, Программирование, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Learning GNU Emacs, 3rd Edition: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Learning GNU Emacs, 3rd Edition»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

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.
, 3rd Edition tells readers how to get started with the GNU Emacs editor. It is a thorough guide that 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 third edition of
describes Emacs 21.3 from the ground up, including new user interface features such as an icon-based toolbar and an interactive interface to Emacs customization. A new chapter details how to install and run Emacs on Mac OS X, Windows, and Linux, including tips for using Emacs effectively on those platforms.
, third edition, covers:
• How to edit files with Emacs
• Using the operating system shell through Emacs
• How to use multiple buffers, windows, and frames
• Customizing Emacs interactively and through startup files
• Writing macros to circumvent repetitious tasks
• Emacs as a programming environment for Java, C++, and Perl, among others
• Using Emacs as an integrated development environment (IDE)
• Integrating Emacs with CVS, Subversion and other change control systems for projects with multiple developers
• Writing HTML, XHTML, and XML with Emacs
• The basics of Emacs Lisp
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.

Learning GNU Emacs, 3rd Edition — читать онлайн бесплатно полную книгу (весь текст) целиком

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Learning GNU Emacs, 3rd Edition», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

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 searchappears in the minibuffer. (Don't be put off by the prompts that appear along the way: you'll see an I-searchprompt after typing C-sand a Searchprompt 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-winstead. 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 Enterpositions 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.

3.2 Search and Replace

Search and replace definitely go together, like coffee and cream. Let's say you're working on a new software application and at the last possible moment, the Marketing Department decides to change the product's name.

There's a press release for Whirligig, an email service that periodically reminds you to make healthy lifestyle changes like exercising, drinking water, and taking vitamins. The level of harassment or, as the marketing department says, encouragement, can be set by the user. Whirligig isn't really the most descriptive name, so at the last minute the Marketing Department changes it to HealthBug.

3.2.1 Simple Search and Replace Operations

Assume you're in the situation we just described. You want to replace every occurrence of one string with another. You know that Whirligig is never correct, and there is absolutely no ambiguity about how you want to replace it. When you want to replace every instance of a given string, you can use a simple command that tells Emacs to do just that. Type M-x replace-string Enter, then type the search string and press Enter. Now type the replacement string and press Enteragain. Emacs replaces all occurrences in the file from the cursor position onward. If you want to search and replace throughout the file, press M-<to go to the beginning of the file before typing this command. Here's a quick example of using replace-string.

Initial state:

Whirligig appears four times but the cursor is positioned after the first - фото 34

Whirligig appears four times, but the cursor is positioned after the first instance.

Now we'll do the replacement.

Type: M-x replace-string Enter Whirligig Enter HealthBug Enter

Emacs replaces all instances from the cursor position onward The replacement - фото 35

Emacs replaces all instances from the cursor position onward.

The replacement occurs only from the cursor position onward; Whirligig in the first sentence is still incorrect. We'll work with this example again in a moment.

3.2.2 Query-Replace

Few search and replace situations are as straightforward as those we've described. Often you're not sure that you want to replace every appearance of your search string: a global replacement can be reckless. If you want to decide whether to replace the string on a case-by-case basis, use a query-replace, which allows you to change a string conditionally throughout a file. After Emacs finds an occurrence of the search string, it asks whether it should replace it, and you respond accordingly.

To use query-replace, go to the beginning of the buffer using M-<and then type M-%. The prompt Query replace:appears in the minibuffer. Type the search string and press Enter. Now this appears:

Query replace searchstring with:

Type the replacement string and press Enter. So far, this procedure is almost identical to a replace-stringoperation; only the prompts are different.

Emacs now searches for the first occurrence of the search string. When it finds one, a new prompt appears:

Query replacing searchstring with newstring

Before performing the replacement, Emacs waits for a response to tell it what to do. Table 3-3lists the possible responses and their results.

Table 3-3. Responses during query-replace

Keystrokes Action
Spaceor y Replace searchstring with newstring and go to the next instance of the string.
Delor n Don't replace; move to next instance.
. Replace the current instance and quit.
, Replace and let me see the result before moving on. (Press Spaceor yto move on.)
! Replace all the rest and don't ask.
^ Back up to the previous instance.
Enteror q Exit query-replace.
E Modify the replacement string.
C-r Enter a recursive edit (discussed in detail later).
C-w Delete this instance and enter a recursive edit (so you can make a custom replacement).
C-M-c Exit recursive edit and resume query-replace.
C-] Exit recursive edit and exit query-replace.

This list seems like a lot of keystrokes to remember, but you can get away with knowing two or three. Most of the time you'll respond to the prompt by pressing Space, telling Emacs to perform the replacement and go on to the next instance, or nto skip this replacement and go on to the next instance. If you're not too sure what will happen, enter a comma ( ,); Emacs makes the replacement but doesn't go on until you press Space. After performing the first few replaces, you may realize that there's no need to inspect every change individually. Typing an exclamation mark ( !) tells Emacs to go ahead and finish the job without bothering you anymore. If you remember these keystrokes, you're all set.

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Learning GNU Emacs, 3rd Edition»

Представляем Вашему вниманию похожие книги на «Learning GNU Emacs, 3rd Edition» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Learning GNU Emacs, 3rd Edition»

Обсуждение, отзывы о книге «Learning GNU Emacs, 3rd Edition» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x