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», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

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

Интервал:

Закладка:

Сделать

Tabs provide an easy way to do some simple formatting. While we were revising this book, we found that the way Emacs handles tabs has changed a great deal. This section describes first how Emacs works by default and then discusses what you can do to change the default behavior to meet your needs.

7.1.1 How Emacs 21 Handles Tabs by Default

If you open a new file in text mode, tabs are set every eight spaces by default. (Programming modes have their own indentation behavior; see Chapter 9for details.)

Press Tab.

Pressing Tabin text mode or fundamental mode inserts a tab character that moves - фото 110

Pressing Tabin text mode or fundamental mode inserts a tab character that moves the cursor forward eight columns by default.

Watch what happens when we type a sentence. The default tab stops change automatically.

Type: It was the best of times Enter Tab Tab

Pressing Tabtwice moves the cursor under the word was clearly less than eight - фото 111

Pressing Tabtwice moves the cursor under the word was , clearly less than eight columns.

Every time you press Tab, Emacs moves the cursor under the next word. This is the behavior that many people expect when writing code. Neatly lined up code is easier to read.

As we experimented with this feature, we would tab across under each word, and press Enter. What happens next is surprising if you are not expecting it. Emacs considers that newline to be the only character you typed on the line, so pressing Tabon a subsequent line brings you nearly to the end of the line.

Press Tabrepeatedly to the end of the window, press Enter, then press Tabonce.

Emacs moves the cursor to the column where you pressed Enter If you press - фото 112

Emacs moves the cursor to the column where you pressed Enter.

If you press Enterbut don't press Tabat all, the indentation level moves back to the left margin.

Changing tabs to align with each word can be helpful, if, for example, you're typing tables. However, the default tab behavior may not be helpful to you in all situations. If you are interested in changing the default behavior, read on and we'll describe how to get Emacs to do what you want it to do.

7.1.2 Changing Tab Stops

By default (and if text is not lining up with some previous line of text), tabs are set every eight characters. Emacs allows you to change the positions of the tab stops. To change the tab stops, type M-x edit-tab-stops. A *Tab Stops*buffer appears.

Type: M-x edit-tab-stops

You now see a tab stop ruler colons show the locations of tab stops The - фото 113

You now see a tab stop ruler; colons show the locations of tab stops.

The colons in the first line of the display show you where tab stops are currently located. The next two lines form a ruler that shows each character position on the line. To insert a tab, use C-fto move to the desired column, and then type a colon (:). To delete a tab, move to the desired tab, and press Space. The *Tab Stops*buffer is in overwrite mode, so these changes won't change the position of other tabs. Make sure that you do all your editing in the first line of the display. Changes made to the other lines won't have any effect.

When you're satisfied with the tab stops, press C-c C-cto install them. If you don't make any changes, press C-c C-cto exit the buffer. If you make some changes and then decide you don't want them after all, kill the buffer by typing C-x k Enter. The default tab stops remain in effect.

If you press C-c C-cto install them, the new tab settings affect all buffers that you create but remain in effect for this Emacs session only.

Again, it may well appear to you that this feature doesn't work as you would expect. Because Emacs's default behavior tries to align with preceding lines, changing tab stops really affects only the first line of any buffer.

In this example, we set the first tab at column 51, pressed C-c C-cto install the tab stops, and started a new buffer. Pressing Tabat the beginning of the buffer moves the cursor immediately to column 51. That works fine.

Press Tabonce.

Cursor moves to column 51 Now we press Taba few more times followed by - фото 114

Cursor moves to column 51.

Now we press Taba few more times, followed by Enterto move to a new line.

When we press Tabon the second line, Emacs views the newline as the only item on the last line. Pressing Tabmoves us right to the end of the line.

Press Tabon the next line.

Emacs moves to the end of the line As you can see changing tab stops in this - фото 115

Emacs moves to the end of the line.

As you can see, changing tab stops in this way is of limited efficacy if you're going to add blank lines between rows of your table or whatever you're typing. You'd have to work around this by adding blank lines after typing the whole table, perhaps using a macro as described in Chapter 6.

7.1.3 What if You Want Literal Tabs?

Let's say that all this tab finery is getting on your nerves. You don't want context-sensitive indenting; you don't even want to change tab stops. There is a way to make Emacs treat tabs just like a regular old typewriter did, moving over eight characters at a time. [35]

To insert rigid, typewriter-style tabs, press C-q Tab. In theory, this should insert a tab character into the file, which would look like ^I. In practice, it moves the cursor forward rigidly eight columns.

Type: C-q Tab

The cursor moves eight columns forward and does not align with the text in the - фото 116

The cursor moves eight columns forward and does not align with the text in the previous line.

C-q Tabdoes in fact insert a tab character in the file. You can check that by erasing it with a single press of the Delkey.

7.1.4 Changing Tab Width

One problem with tabs is that there is no universal definition of what a tab means. In vi , the default tab width is four columns versus eight columns in Emacs. Further, Unix generally favors eight columns for tabs while some operating systems tend to use four spaces. Emacs uses eight columns by default no matter what platform it's running on. If you view another user's file in Emacs, Emacs interprets the tabs as eight columns each, throwing things off. For this reason, you might want to set your tab default to four columns by adding this line to your .emacs file:

(setq-default tab-width 4)

You have to press C-q Tabto have the modified tab width take effect.

7.1.5 Tabs and Spaces

Another characteristic of Emacs's default behavior is the fact that it may insert a combination of tabs and spaces when you press Tab. Try to erase a few "tabs" and you'll see that often it isn't one character, but the equivalent number of spaces or a combination of tabs and spaces. Of course, this largely depends on the tab stops compared to setting of the tab-widthvariable. If you set tab stops that are multiples of six while you have a tab-widthof 4 or 8, Emacs is going to have to use a combination of tabs and spaces to achieve the desired tab stops.

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

Интервал:

Закладка:

Сделать

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

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


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

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

x