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

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

Интервал:

Закладка:

Сделать

The best approach is to install the JDEE and start coding with it. If you find yourself saying "There should be a way to do X," get out the documentation. Chances are there is a way to do X—usually with more options than you could hope for!

9.6 Perl Support

Emacs has Perl support. Indeed, much like Perl itself, there are multiple ways to get things done—in this case, multiple Perl modes: the classic Perl mode (which comes up by default) and the more popular CPerl mode.

You should have a version of CPerl mode built right in, but you can also pick up the latest release from CPAN (the Comprehensive Perl Archive Network) online at http://www.cpan.org.

You can add one of the following pairs of lines to your .emacs file to make sure CPerl mode is invoked rather than Perl mode

;; load cperl-mode for perl files

(fset 'perl-mode 'cperl-mode)

;; or maybe use an alias

(defalias 'perl-mode 'cperl-mode)

CPerl mode is mostly like cc-modewith respect to motion and other programming language features. It also includes fun debug operations. You can start the debugger with M-x cperl-db. You'll be prompted to verify the debugger command and then be dropped into a split-screen mode. One buffer allows you to drive the normal perldbenvironment with all the regular commands you're accustomed to using in the Perl debugger.

The other buffer shows your script and follows along as you work through the debugger. It tracks the line you're about to execute as you issue commands in the other buffer. It's amazing how quickly you grow to depend on having such tools available while you're developing scripts. It is worth trying out if you've never done it before.

9.6.1 Perl Caveats

A big reason we wanted to mention Perl mode here is to highlight a few caveats. Perl is an amazingly expressive language much more akin to the idioms found in human languages than just about any other computer language out there. That expressiveness can cause problems—especially when considering the expressiveness of regular expressions.

Perl supports all sorts of "funny" variable names like $'and $/. CPerl mode boasts the use of a syntax table to help understand most of Perl's odd and occasionally disruptive verbiage. The older Perl mode has no such trick up its sleeves and suffers under many circumstances in the font-lock and indentation realms. This is one of the main reasons to make the leap into CPerl mode.

Even with that syntax table, though, you'll probably find some combinations of variables and strings that give Emacs headaches. Sometimes restructuring your code will help, sometimes not. The important thing to remember is that it won't harm your program at all. It might make things a bit less readable, but the script itself should run just fine. And if it doesn't, you can always launch the debugger to find out why!

Here are some parting .emacs thoughts for you Perl programmers. These lines select cperl-modeas the default and make sure the syntax highlighting is turned on. These lines also turn on folding ( outline-minor-modein the snippet below). Folding allows you to "hide" chunks of your code, such as functions where the body of the function is "folded" into the name. That can make it easier to get a grip on everything that is going on in the file. Try it—it can become addictive!

;; Turn on highlighting globally

(global-font-lock-mode t)

;; automatically load cperl-mode for perl files

(fset 'perl-mode 'cperl-mode)

;; show only the toplevel nodes when loading a file

(add-hook 'cperl-mode-hook 'hide-body)

;; outline minor mode with cperl

(add-hook 'cperl-mode-hook 'outline-minor-mode)

;; Change the prefix for outline commands from C-c @ to C-c C-o

(setq outline-minor-mode-prefix "\C-co")

(load-file "cperl-mode.el")

9.7 SQL Support

For you database folks out there, you can even run interactive SQL sessions through Emacs. You can navigate through your SQL command history using normal motion commands and even create complex SQL statements in any buffer and then shuttle them off to the interactive area for debugging.

9.7.1 Prerequisites

Before we get started with SQL queries, you do need to have a few things in place. Most of the SQL interaction modes require an actual client application for their particular database. For example, we use the MySQL server. We have to install the MySQL client programs ( mysql, at a minimum) on any system where we want to use SQL mode. Even though the MySQL version of SQL mode is built-in, we still need access to a real client. This is true for every type of database you expect to access.

And speaking of communicating with the database, you must also have the basics of communication taken care of. You need to have network access to the server in question. You also need to have a valid username and password for connecting to that server. A good rule before jumping into SQL mode in Emacs is to make sure you can connect and interact with your database server from your machine. If it works from a terminal window or other client application, you can make it work in Emacs.

One last thing to remember: the various SQL modes in Emacs are just helpers, so you can't do anything with them that you couldn't do with your normal database client. You won't magically have access to that restricted table with everyone's salaries. Sorry. Even so, it's just more convenient to stay in Emacs when possible, so let's forge ahead.

9.7.2 Modes of Operation

You'll find two modes of operation for dealing with SQL. The interactive mode lets you communicate directly with a database server and run commands and view their output immediately. The editing mode allows you to build up (and edit) more complex commands. If you want, you can have the editing buffer send parts of itself to the interactive session for testing and verification.

9.7.2.1 Interactive mode

Start the interactive mode by typing M-x sql-mysql(or rather, your own variant of the interactive modes shown in Table 9-9).

Table 9-9. Commands for entering database-specific SQL modes

sql-db2 sql-linter sql-postgres
sql-informix sql-ms (Microsoft) sql-solid
sql-ingres sql-mysql sql-sqlite
sql-interbase sql-oracle sql-sybase

You'll be prompted for things like your username and password, the database or catalog to use, and the server to contact. Remember the prerequisites, though; many modes require that you have a normal command-line client available. The mode simply supplies an intelligent layer on top of those clients.

After you get connected, just type normal SQL commands that your server understands. Most interactive clients have some type of "end-of-line" marker to let the system know when to send a completed command. In MySQL, for example, you can end statements with a semicolon (;) or the \gsequence.

Emacs keeps these commands in a history buffer for you so that you can revisit them. M-pand M-nallow you navigate to previous and next commands respectively. ( C-pand C-nsimply allow you to move around in the buffer as you would expect.)

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

Интервал:

Закладка:

Сделать

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

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


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

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

x