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

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

Интервал:

Закладка:

Сделать

(setq auto-mode-alist (cons '("\\.ada$" . ada-mode) auto-mode-alist))

Make sure you include the single quote after the term consand the dot between " \\.ada$"and ada-mode. The notation '(x . y)is just Lisp syntax for "make x and y a pair." The string "\\.ada$"is a regular expression that means "anything with .ada at the end of it," that is, $matches the end of the string (as opposed to the end of the line, which is what it matches during regular expression search and replace). The entire line of Lisp basically means "add the pair ("\\.ada$", 'ada-mode)to the front of the auto-mode-alist." Note that, because Emacs searches auto-mode-alistfrom the beginning and stops when it finds a match, you can use the above consconstruct to override existing mode associations. [72]

As another example, let's say you save certain mail messages in files whose names begin with msg- , and you want to edit these files in text mode. Here is the way to do it:

(setq auto-mode-alist (cons '("^msg-" . text-mode) auto-mode-alist))

Notice that in this case we are matching the beginning , rather than the end, of the filename. The regular expression operator ( ^) means beginning of string, so the entire regular expression means "anything beginning with msg-."

Finally, if the name of a file you are editing does not match any of the regular expressions in auto-mode-alist, Emacs puts it into the mode whose name is the value of the variable default-major-mode. This mode is normally fundamental mode, a basic mode without special functionality. However, many people like to set their default mode to text mode, accomplished by adding a line like this to .emacs : (setq default-major-mode 'text-mode)

Although we have covered many useful ways to customize Emacs in this chapter, we have really only scratched the surface. To find out more, turn to Chapter 11and find out about Lisp programming, the key to getting Emacs to do just about anything you want.

10.8 Making Emacs Work the Way You Think It Should

Emacs not only has per-user customizations; it can also have sitewide customizations. If Emacs isn't doing what you expect it to, you might want to try inhibiting any global customization file by starting Emacs with no customization.

You can do that by using one of these command-line options when you invoke Emacs.

--no-init-file, -q load neither ~/.emacs nor default.el

--no-site-file do not load site-start.el

If you normally start Emacs from an icon, it's helpful to learn how to start it from the command-line for cases like this. (You may also want to use the -debugoption sometime to help you figure out what's wrong with your .emacs file if it is messed up following a change.) Chapter 13describes how to start Emacs from the command-line for Mac OS X and Windows users.

You can also inhibit global initialization by creating a one-line .emacs file in your home directory. It should look exactly like this:

(setq inhibit-default-init t) ; no global initialization

Start Emacs again. This file prevents Emacs from reading its global initialization file.

There's still one awkward situation: what if you're sitting down at someone else's system? You start Emacs, and all of a sudden you're faced with someone else's "private" key bindings and features. Even in this situation, there's a solution:

• Try using the command emacs -q. The -qoption tells Emacs not to read the user's .emacs file before starting. By doing this, you'll avoid the user's private customizations.

• Let's say that after this step, you still don't have your own customizations. If you want to make Emacs read your .emacs file, even when you're using someone else's account, give the command emacs -u yourname . For example: emacs -u debstarts Emacs with the user Deb's initialization file ( /home/deb/.emacs ).

The -uoption may not work unless you're on a network where users have a shared home directory structure. It assumes either that you have the same home directory on every system, or that you have a different home directory on every system and an up-to-date .emacs file in all of your home directories.

If all that fails, fear not. You have more options. Let's take the worst case scenario: you're on someone else's system and you can't start Emacs from the command line. Go ahead and start Emacs. You can temporarily overwrite the other user's key bindings by loading up your own key bindings file in a buffer and running it with M-x eval-buffer.

You probably should make a separate file with key bindings and other variable options rather than using your .emacs file. That's because many times your .emacs file will have requests to load libraries that exist on a path that works only from your own system. If you find yourself jumping to a lot of different machines, it's worth the effort to create a portable "rebinding" file and put it somewhere accessible like a web page or a shared file server. Then you can evaluate it manually from your current Emacs.

Chapter 11. Emacs Lisp Programming

If you have been using Emacs for a while and have been taking advantage of some of its more advanced features, chances are that you have thought of something useful that Emacs doesn't do. Although Emacs has hundreds of built-in commands, dozens of packages and modes, and so on, everyone eventually runs into some functionality that Emacs doesn't have. Whatever feature you find missing, you can program using Emacs Lisp.

Before you dive in, however, note that this chapter is not for everyone. It is intended for people who have already become comfortable using Emacs and who have a fair bit of programming experience, though not necessarily with Lisp per se . If you have no such experience, you may want to skip this chapter; if there is something specific you would like Emacs to do, you might try to find a friendly Emacs Lisp hacker to help you write the necessary code. Or, if you're a little adventurous, you could skim enough to find the file-template example and learn how to install it—it gives you some useful features.

Readers who are building their Lisp skills but don't necessarily want to read the whole chapter might also want to look for the "Treasure Trove of Examples" section in the middle for a useful tool that can help jumpstart their exploration of the Emacs libraries.

Note that we do not cover Lisp in its entirety in this chapter. That would require another large, dense book. Instead, we cover the basics of the language and other features that are often useful in writing Emacs code. If you wish to go beyond this chapter, refer to the GNU Emacs Lisp Reference Manual , distributed with Emacs (choose Help → More Manuals → Introduction to Lisp and Emacs Lisp Reference) for details about the specific Lisp features in Emacs. You may also turn to any of the various Lisp textbooks [73]available for a solid grounding in the language itself.

Emacs Lisp is a full-blown Lisp implementation; [74]thus it is more than the usual macro or script language found in many text editors. (One of the authors has written a small expert system entirely in Emacs Lisp.) In fact, you could even think of Emacs itself as a Lisp system with lots of built-in functions, many of which happen to pertain to text manipulation, window management, file I/O, and other features useful to text editing. The source code for Emacs, written in C, implements the Lisp interpreter, Lisp primitives, and only the most basic commands for text editing; a large layer of built-in Lisp code and libraries on top of that implements the rest of Emacs's functionality. A current version of Emacs comes with close to 250,000 lines of Lisp.

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

Интервал:

Закладка:

Сделать

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

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


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

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

x