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

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

Интервал:

Закладка:

Сделать

2.7 Making Emacs Work the Way You Want

If you've been reading straight through this book, you may have started a list of things you'd like to change about Emacs, such as

• Hiding the toolbar

• Changing Emacs cut and paste commands to C-x, C-c, and C-v

• Turning on text mode and a fill mode so Emacs does word wrap

• Changing the way some of the keys work

We're going to tell you how to give Emacs the to-do list, a list of options to turn on each time you enter Emacs. These options are defined in an initialization file called .emacs . Initialization files run automatically. Some run when you start up your computer. Others, like .emacs , run when you start up an associated software program. So .emacs runs automatically when you start Emacs and turns on whatever options the file defines. Emacs doesn't need this file to run; its only purpose is to make Emacs work the way you want it to.

The .emacs file consists of Lisp statements. If you're not a Lisp programmer, you can think of each line as an incantation that follows a certain pattern; you need to type it exactly.

Emacs now has another way to handle customization: an interactive interface called Custom that writes Lisp for you and automatically inserts it in your .emacs file. The Custom interface is discussed in Chapter 10, but we'll show you an even faster method for common options.

When you want to add a line to your .emacs file directly, take these steps:

1. Enter Emacs (if you're not already there).

2. Type C-x C-f ~/.emacs Enter.

3. Type the line to be added exactly as shown in this book and press Enter.

4. Press C-x C-sto save the .emacs file.

5. Press C-x C-cto exit Emacs.

6. Restart Emacs to have the line take effect.

If you make a minor typing mistake (such as forgetting a single quotation mark or a parenthesis), you are likely to get an error message that says Error in init filewhen you restart Emacs. Simply edit the .emacs file again, checking the line you added against the place you got it from, whether from this book or another user's .emacs file. Usually, you can find the error if you look hard enough; if not, find someone who has a .emacs file (and preferably understands Lisp) and ask for help. Make the changes, save the file, and restart Emacs.

What if you make a change that essentially keeps Emacs from being able to start? You can still exit Emacs, rename the file, edit it, then save it as .emacs and try again.

2.7.1 Hiding the Toolbar

New users may find the toolbar helpful. Others may not. It's easy to hide it by selecting Options → Show/Hide → Toolbar, and then Options → Save Options.

When Emacs sets options for you through Custom (and this is what it is doing even when you use the Options menu), it writes your .emacs file. If you already have a .emacs file, it appends to it. Custom essentially groups all of its settings in one part of the file, and it is commented to indicate that you should not change it manually. Here's the .emacs file that we created by selecting this option:

(custom-set-variables

;; custom-set-variables was added by Custom.

;; If you edit it by hand, you could mess it up, so be careful.

;; Your init file should contain only one such instance.

;; If there is more than one, they won't work right.

'(tool-bar-mode nil nil (tool-bar)))

(custom-set-faces

;; custom-set-faces was added by Custom.

;; If you edit it by hand, you could mess it up, so be careful.

;; Your init file should contain only one such instance.

;; If there is more than one, they won't work right.

)

This may seem a bit bulky, but as we'll see in the next section, Emacs adds this section only once and then augments it when you set more options either through the options menu or directly through the Custom interface. Also note that this auto-generated Lisp is certainly less clean than Lisp statements you'll typically see in .emacs files. That's another reason not to edit Custom's work directly.

2.7.2 Turning On CUA Mode for C-x, C-c, and C-v to Cut, Copy, and Paste

If you're new to Emacs, you might be used to the Common User Access (CUA) conventions for cutting, copying, and pasting, C-x, C-c, and C-vrespectively. You might reach for C-zfor undo. CUA mode was once an add-on mode that you had to install separately, but it became so popular that it is now part of Emacs. It's coded in a clever way that doesn't interfere with Emacs keystrokes that are prefixed with C-xand C-c. Details on CUA mode can be found in Chapter 13.

You can turn this feature on through the Options menu to try it out. Simply choose Options → C-x/C-c/C-v cut and paste (CUA). After you select this option, a check mark appears next to it on the Options menu. To keep it for subsequent sections, select Save Options from the Options menu. Emacs writes your .emacs file for you. If you turned off the toolbar and then set this option, your .emacs file would look like this (note that the line relating to CUA mode is bold so you can see the difference from the previous example):

(custom-set-variables

;; custom-set-variables was added by Custom.

;; If you edit it by hand, you could mess it up, so be careful.

;; Your init file should contain only one such instance.

;; If there is more than one, they won't work right.

' (cua-mode t nil (cua-base))

'(tool-bar-mode nil nil (tool-bar)))

(custom-set-faces

;; custom-set-faces was added by Custom.

;; If you edit it by hand, you could mess it up, so be careful.

;; Your init file should contain only one such instance.

;; If there is more than one, they won't work right.

)

Interestingly, Emacs happily writes the .emacs file even if it is open at the time. You can watch Emacs change the file if you have it open when you choose Save Options.

2.7.3 Turning On Text Mode and Auto-Fill Mode Automatically

To make text mode the default major mode and start auto-fill mode automatically each time you enter Emacs, add these lines to your .emacs file:

(setq default-major-mode 'text-mode)

(add-hook 'text-mode-hook 'turn-on-auto-fill)

The first line tells Emacs to make text mode the default major mode; in other words, "Turn on text mode unless I tell you otherwise." The second line turns on auto-fill mode whenever you are in text mode. Alternatively, selecting Options→ Word Wrap in Text Modes, and then Options→ Save Options adds auto-fill mode to your .emacs file directly. It doesn't make text mode the default major mode, however.

If you prefer refill mode, replace the second line of code with this line:

(add-hook 'text-mode-hook (lambda ( ) (refill-mode 1)))

2.7.4 Remapping Keys

Another major use of the .emacs file is to redefine things about Emacs that irritate you. You may have ergonomic concerns about Emacs; more than one person has aggravated carpal tunnel syndrome using the default bindings. You may simply be used to reaching for certain keys for certain functions and would rather change Emacs than your habits. Whatever the case, this section gives a brief introduction to key remapping; for more details, see Chapter 10.

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

Интервал:

Закладка:

Сделать

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

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


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

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

x