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

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

Интервал:

Закладка:

Сделать

syntax error at monthly_orders.pl line 1822, near "$"

The regular expression ignores everything up to at . Then it finds monthly_orders.pl , the filename, as the match to the first subexpression " [^ \n]+" (one or more nonblank, nonnewline characters), and it finds 1822, the line number, as the match to the second subexpression " [0-9]+" (one or more digits).

For the most part, these regular expressions are documented pretty well in their definitions. Understanding them in depth can still be a challenge, and writing them even more so! Suppose we want to tackle Example 5 by adding an element to this list for our new C++ compiler that prints error messages in German. In particular, it prints error messages like this:

Fehler auf Zeile linenum in filename : text of error message

Here is the element we would add to compilation-error-regexp-alist:

("Fehler auf Zeile \\([0-9]+\\) in \\([^: \t]+\\):" 2 1)

In this case, the second parenthesized subexpression matches the filename, and the first matches the line number.

To add this to compilation-error-regexp-alist, we need to put this line in .emacs :

(setq compilation-error-regexp-alist

(cons '("Fehler auf Zeile \\([0-9]+\\) in \\([^: \t]+\\):" 2 1)

compilation-error-regexp-alist))

Notice how this example resembles our example (from Chapter 9) of adding support for a new language mode to auto-mode-alist.

11.3.2.5 Regular expression operator summary

Table 11-6concludes our discussion of regular expression operators with a reference list of all the operators covered.

Table 11-6. Regular expression operators

Operator Function
. Match any character.
* Match 0 or more occurrences of preceding char or group.
+ Match 1 or more occurrences of preceding char or group.
? Match 0 or 1 occurrences of preceding char or group.
[...] Set of characters; see below.
\\( Begin a group.
\\) End a group.
\\| Match the subexpression before or after \\|.
^ At beginning of regexp, match beginning of line or string.
$ At end of regexp, match end of line or string.
\n Match Newline within a regexp.
\t Match Tab within a regexp.
\\< Match beginning of word.
\\> Match end of word.
The following operators are meaningful within character sets :
^ At beginning of set, treat set as chars not to match.
- (dash) Specify range of characters.
The following is also meaningful in regexp replace strings :
\\ n Substitute portion of match within the n th \\(and \\), counting from left \\(to right, starting with 1.

Finally, the following characters are operators (not discussed here) when double-backslash-escaped: b, B, c, C, w, W, s, S, =, _, ', and `. Thus, these are "booby traps" when double-backslash-escaped. Some of these behave similarly to the character class aliases you may have encountered in Perl and Java regular expressions.

11.3.3 A Treasure Trove of Examples

As mentioned above, the full auto-mode-alisthas a lot more entries and documentation than fit in this book. The compile.el module in which it is defined also contains functions that use it. One of the best ways to learn how to use Emacs Lisp (as well as discovering things you might not have even realized you can do) is to browse through the implementations of standard modules that are similar to what you're trying to achieve, or that are simply interesting. But how do you find them?

The manual way is to look at the value of the variable load-path. This is the variable Emacs consults when it needs to load a library file itself, so any library you're looking for must be in one of these directories. (This variable is discussed further in the final section of this chapter.) The problem, as you will see if you look at the current value of the variable, is that it contains a large number of directories for you to wade through, which would be pretty tedious each time you're curious about a library. (An easy way to see the variable's value is through Help's "Describe variable" feature, C-h v.)

One of the authors wrote the command listed in Example 11-1to address this problem and uses it regularly to easily snoop on the source files that make much of Emacs run. If you don't want to type this entire function into your .emacs by hand, you can download it from this book's web site, http://www.oreilly.com/catalog/gnu3.

Example 11-1. find-library-file

(defun find-library-file (library)

"Takes a single argument LIBRARY, being a library file to search for.

Searches for LIBRARY directly (in case relative to current directory,

or absolute) and then searches directories in load-path in order. It

will test LIBRARY with no added extension, then with .el, and finally

with .elc. If a file is found in the search, it is visited. If none

is found, an error is signaled. Note that order of extension searching

is reversed from that of the load function."

(interactive "sFind library file: ")

(let ((path (cons "" load-path)) exact match elc test found)

(while (and (not match) path)

(setq test (concat (car path) "/" library)

match (if (condition-case nil

(file-readable-p test)

(error nil))

test)

path (cdr path)))

(setq path (cons "" load-path))

(or match

(while (and (not elc) path)

(setq test (concat (car path) "/" library ".elc")

elc (if (condition-case nil

(file-readable-p test)

(error nil))

test)

path (cdr path))))

(setq path (cons "" load-path))

(while (and (not match) path)

(setq test (concat (car path) "/" library ".el")

match (if (condition-case nil

(file-readable-p test)

(error nil))

test)

path (cdr path)))

(setq found (or match elc))

(if found

(progn

(find-file found)

(and match elc

(message "(library file %s exists)" elc)

(sit-for 1))

(message "Found library file %s" found))

(error "Library file \"%s\" not found." library))))

Once this command is defined, you can visit any library's implementation by typing M-x find-library file Enter libraryname Enter. If you use it as often as this author does, you too may find it worth binding to a key sequence. We won't present a detailed discussion of how this function works because it goes a bit deeper than this chapter, but if you're curious about what some of the functions do, you can put your cursor in the function name in a Lisp buffer and use the Help system's "Describe function" ( C-h f) feature to get more information about it.

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

Интервал:

Закладка:

Сделать

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

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


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

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

x