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

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

Интервал:

Закладка:

Сделать

(:foreground "Firebrick" :slant italic)))))

Note that not all displays support all of the possible variations of bold, italic, underline, colors, and so on. This is a classic case of "your mileage may vary." Still, with the ability to customize it all yourself, you should be able to find a combination that works well on your system.

The remaining sections in this chapter deal with several of the language-specific modes including JDEE, a suite of packages devoted to the world of Java development in Emacs.

You need not read all of these sections if you are interested in only one or two of the languages. If you program in another language for which Emacs has a mode, you may want to read one of the following sections to get the "flavor" of a language mode; all language modes have the same basic concepts, so this should get you off to a good start. Indeed, many language modes use another mode as a base. For example, Java mode is really just an extension of C mode.

9.3 C and C++ Support

Emacs automatically enters C mode when you visit a file whose suffix is .c , .h , .y (for yaccgrammars), or .lex ( lexspecification files). Emacs invokes C++ mode when you visit a file whose suffix is .C , .H , .cc , .hh , .cpp , .cxx , .hxx , .c++ , or .h++ . You can also put any file in C mode manually by typing M-x c-mode Enter. Similarly, you can use c++-modeto put a buffer into C++ mode.

Both C and C++ modes are implemented in the same Emacs Lisp package, called cc-mode, [62]which also includes a mode for the Objective-C language used in Mac OS X. C mode understands both ANSI C and the older Kernighan and Ritchie C syntax. We describe C mode functions, but you should assume that everything also applies to C++ mode. C++ mode has a small number of additional features, which we describe at the end of this section.

We should also note that the Emacs mode for Perl is derived from an older version of C mode. If you program in Perl, you will find that virtually all of the motion, indentation, and formatting commands in C mode apply equally to Perl mode, with perl-replacing c-in their names. Emacs invokes Perl mode on files with suffix .pl . (However, to be honest we prefer CPerl mode, discussed later in this chapter.)

In C mode, Emacs understands the syntax elements described earlier in this chapter. The characters semicolon (;), colon (:), comma (,) curly braces ({ and }), and pound sign (#, for C preprocessor commands) are all electric, meaning that Emacs automatically indents the current line when you type them. It also actively uses the font options when you have font-lock mode turned on.

9.3.1 Motion Commands

In addition to the standard Emacs commands for words and sentences (which are mainly useful only inside multiline comments), C mode contains advanced commands that know about statements, functions, [63]and preprocessor conditionals. A summary of these commands appears in Table 9-3.

Table 9-3. Advanced C motion commands

Keystrokes Command name Action
M-a c-beginning-of-statement Move to the beginning of the current statement.
M-e c-end-of-statement Move to the end of the current statement.
M-q c-fill-paragraph If in comment, fill the paragraph, preserving indentations and decorations.
C-M-a beginning-of-defun Move to the beginning of the body of the function surrounding the point.
C-M-e end-of-defun Move to the end of the function.
C-M-h c-mark-function Put the cursor at the beginning of the function, the mark at the end.
C-c C-q c-indent-defun Indent the entire function according to indentation style.
C-c C-u c-up-conditional Move to the beginning of the current preprocessor conditional.
C-c C-p c-backward-conditional Move to the previous preprocessor conditional.
C-c C-n c-forward-conditional Move to the next preprocessor conditional.

Notice that the statement motion commands have the same key bindings as backward-sentenceand forward-sentence, respectively. In fact, they act as sentence commands if you use them within a C comment.

Similarly, M-qis normally the fill-paragraphcommand; C mode augments it with the ability to preserve indentations and decorative characters at the beginnings of lines. For example, if your cursor is anywhere in this comment:

/* This is

* a

* comment paragraph with wildly differing right

* margins.

* It goes on for a while,

* then stops. */

typing M-qhas this result:

/* This is a comment paragraph with wildly differing right margins.

* It goes on for a while, then stops. */

You will find that the preprocessor conditional motion commands are a godsend if you have to slog through someone else's voluminous code. Especially if you're faced with code built to run on a variety of systems—like Emacs itself—often the most important question you need answered is, "What code is actually compiled?"

With C-c C-u, you can tell instantly what preprocessor conditional governs the code in question. Consider this code block:

#define LUCYX

#define BADEXIT -1

#ifdef LUCYX

...

*ptyv = open ("/dev/ptc", O_RDWR | O_NDELAY, 0);

if (fd < 0)

return BADEXIT;

...

#else

...

fprintf (stderr, "You can't do that on this system!");

...

#endif

Imagine that the ellipses ( ...) represent hundreds of lines of code. Now suppose you are trying to determine under what conditions the file /dev/ptc is opened. If your cursor is on that line of code, you can type C-c C-u, and the cursor moves to the line #ifdef LUCYX—telling you that the code is compiled if you're on a LUCYX system. If you want to skip the code that would not be compiled and go directly to the end of the conditional, type C-c C-n. We will see another command that is useful for dealing with C preprocessor code later in this section.

C statement and statement block delimiter characters are bound to commands that, in addition to inserting the appropriate character, also provide proper indentation. These characters are {, }, ;, and : (for labels and switchcases). For example, if you are closing out a statement block or function body, you can press C-j(or Enter) and type }, and Emacs lines it up with its matching {. This eliminates the need for you to scroll back through the code to find out what column the {is in.

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

Интервал:

Закладка:

Сделать

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

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


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

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

x