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

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

Интервал:

Закладка:

Сделать

Because }is a parenthesis-type character, Emacs attempts to "flash" a matching {when you type }. If the matching {is outside of the text displayed in your window, Emacs instead prints the line containing the {in the minibuffer. Furthermore, if only whitespace (blanks or tabs) follows the {on its line, Emacs also prints a ^J(for C-j) followed by the next line, thus giving a better idea of the context of the {.

Recall the "times" example earlier in this chapter. Let's say you are typing in a }to end the function, and the {that begins the function body is off-screen. There is no code on the line following the beginning {, so you see the following in the minibuffer after you type }:

Matches {^J int i;

9.3.2 Customizing Code Indentation Style

Coding style in C—or any programming language for that matter—is a very personal thing. C programmers learn from various books or by referring to various different pieces of other people's code; eventually they evolve a personal style that may or may not conform to those that they learned from.

C mode provides a rich set of features for customizing its indentation behavior that mirrors this way of learning the language. At the simplest level, you can choose a coding style by name. Then, if you're not satisfied, you can customize your chosen style or even create your own from scratch. The latter tasks, however, require a fair amount of Emacs Lisp programming knowledge (see Chapter 11) and perhaps a bit of bravery.

You can choose a named coding style with the command M-x c-set-style. This command prompts you for the name of the style you want. The easiest thing to do at this point is to type Tab, the completion character (see Chapter 14 Chapter 14. The Help System Emacs has the most comprehensive help facility of any text editor—and one of the best such facilities of any program at all. In fact, the Emacs help facilities probably cut down the time it took for us to write this book by an order of magnitude, and they can help you immeasurably in your ongoing quest to learn more about Emacs. In this chapter, we describe Emacs help in the following areas: • The tutorial. • The help key ( C-h ) and Help menu, which allow you to get help on a wide variety of topics. • The help facilities of complex commands like query-replace and dired . • Navigating Emacs manuals and using the info documentation reader. • Completion , in which Emacs helps you finish typing names of functions, variables, filenames, and more. Completion not only saves you time and helps you complete names of functions you know about but can help you discover new commands and variables. ), which brings up a *Completions*window that lists all of the choices. Type one of them and press Enterto select it.

By default, Emacs comes loaded with the styles shown in Table 9-4.

Table 9-4. Built-in cc-mode indentation styles

Style Description
bsd Style used in code for BSD-derived versions of Unix.
cc-mode The default coding style, from which all others are derived.
ellemtel Style used in C++ documentation from Ellemtel Telecommunication Systems Laboratories in Sweden.
gnu Style used in C code for Emacs itself and other GNU-related programs.
java Style used in Java code (the default for Java mode).
k&r Style of the classic text on C, Kernighan and Ritchie's The C Programming Language .
linux Style used in C code that is part of the Linux kernel.
python Style used in python extensions.
stroustrup C++ coding style of the standard reference work, Bjarne Stroustrup's The C++ Programming Language .
user Customizations you make to .emacs or via Custom (see Chapter 10). All other styles inherit these customizations if you set them.
whitesmith Style used in Whitesmith Ltd.'s documentation for their C and C++ compilers.

To show how some of these styles work, let's start with the C function example from earlier in this chapter:

int times (x, y)

int x, y;

{

int i;

int result = 0;

for (i = 0; i < x; i++)

{

result += y;

}

}

If you define a region around this code and you type C-M-\(for indent-region), Emacs reformats the code in the default style like this:

int times (x, y)

int x, y;

{

int i;

int result = 0;

for (i = 0; i < x; i++)

{

result += y;

}

}

If you type C-c. (for c-set-style), enter k&r, and then repeat the reformatting, the code looks like this:

int times (x, y)

int x, y;

{

int i;

int result = 0;

for (i = 0; i < x; i++)

{

result += y;

}

}

Or, if you want to switch to GNU-style indentation, choose the style gnuand reformat. The result is:

int times (x, y)

int x, y;

{

int i;

int result = 0;

for (i = 0; i < x; i++)

{

result += y;

}

}

Once you decide on a coding style, you can set it up permanently by putting a line in your .emacs file that looks like this:

(add-hook 'c-mode-hook

'(lambda ( )

(c-set-style " stylename ")))

Unfortunately, we'll have to wait until Chapter 11to understand exactly what this code does. For now, make sure that you insert a single quote (') before the (lambdain the second line.

Each coding style contains subtleties that makes it nontrivial for Emacs to implement. Older versions of Emacs did this by defining several variables that controlled various indentation levels; these were not easy to work with and, frankly, did not really cover 100 percent of the nuances of each style. The current version of C mode, in contrast, uses a considerably larger set of variables—too large, in fact, for anyone other than hardy Emacs Lisp hackers to deal with.

Therefore, C mode keeps track of groups of these variables and their values under named styles. One huge variable, called c-style-alist, contains all of the styles and their associated information. You can customize this beast either by changing values of variables within existing styles or by adding a style of your own. For further details, look in the file cc-mode.el in your system's Emacs Lisp directory (see Chapter 11).

9.3.3 Additional C and C++ Mode Features

C mode contains a number of other useful features, ranging from the generally useful to the arcanely obscure. Perhaps the most interesting of these are two ways of adding additional electric functionality to certain keystrokes, called auto-newline and hungry-delete-key . [64]

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

Интервал:

Закладка:

Сделать

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

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


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

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

x