Emacs Tutorial (i)

Source: Internet
Author: User
Tags apple keyboard

Http://www.cnblogs.com/robertzml/archive/2009/09/10/1564108.html
Preface preface: I also beginner emacs, before to Vim also only touch a little, so also not to which more like, also cannot divide which is better. The purpose of this tutorial is to make it easier for you to learn Emacs,
Two is nothing to do. If there are experts passing still look at more guidance.

Preface: The famous Emacs, the legendary programmer's ultimate weapon, has crossed the text editor, the IDE's realm, can replace the operating system GUI Dongdong. With a kind of worship of the mood I decided to start learning Emacs, hoping one day can become a generation of Emacs heroes.

Bibliography:
1. GNU Emacs Manual (Emacs website)
2. O ' relly learning GNU Emacs, 3rd Edition

I. Installation and use of Emacs
The first thing to learn software is of course to put it down, http://ftp.gnu.org/pub/gnu/emacs/windows/emacs-23.1-bin-i386.zip The latest version of the 23.1, the number is scary, opera's 10.0 is less than half of others. Unfortunately, I'm using the Windows version.
Installation process is simple, direct decompression on the line, but the path can not contain spaces, so the table to Program Files folder under the Lost, I was directly placed in the root directory, find it convenient. You can add a Start menu shortcut by running Addpm.exe in the bin directory. You can also run Runemacs.exe directly to start Emacs.
Uninstall is also very convenient, Emacs will not write any garbage to the system, directly delete the folder can be uninstalled, as well as your shortcut.
The interface after starting Emacs is as follows:

Hard to see, nothing too good place, feel relatively humble. The above is the title bar, the menu bar, the toolbar, a large chunk of the middle is the place to edit the text, the following two lines are mode line and Echo area.
The Echo area is where you enter commands and display messages.
In mode line, the first character represents the character set, C for CHINESE-GBK, the following \ symbol for the newline type, \ refers to the DOS CRLF line break, and the Unix LF line break and the Mac's CR wrap. Then a character that indicates whether the open file is writable (first known as a file for ease of understanding, actually buffer),% for read only,-and * for writable. Another character indicates whether the file is written,% or-indicates that it has not moved, * indicates that it has changed. The two characters combine to have four states.

Symbol Said
%% Read-only, unchanged
-- Writable, unchanged
** Writable, changed
%* Read-only, changed

The back one-represents the path, and the *gnu emacs* in the back of the blackbody represents the name of the buffer. The all behind indicates the position of the cursor, which is all when the file can be displayed on a page, plus the top, Bot, and current position percentages. L5 represents line fifth. Fundamental is a pattern name, a variety of patterns, this is introduced later.
If this is the first time, click on Emacs Tutorial, there are some basic introduction of Emacs, but also in Chinese.

Second, Emacs button
Vim divides control and editing into two modes, which operate independently of each other. Emacs is both edit and control, but control commands require the use of control keys.
Emacs's control keys are available on three control,shift and Meta,control and Shift keyboards, and Meta is alt in the American keyboard, which is the four-lap key on the Apple keyboard, if there is no alt on the keyboard (This is for some European talent will encounter) can use ESC instead, the other ESC do not want ALT usually when the combination of keys, it should be a separate click, and then press the other.
The control commands are then expressed as follows:
C-f ctrl+f
C-m-f ctrl+alt+f
C-_ ctrl+shift+-
In Emacs, these key combinations are actually shortcuts to some functions, such as c-n, which are shortcuts to next-line. We can call the function directly in addition to using the combination key unexpectedly.
Press M-x, and then enter the function name to invoke the function.

Iii. Entering and exiting Emacs
Into the front already said, now say how to quit.
The most direct way, point to the top right corner of the fork, of course, there is no technical content.
A more civilized approach, c-x c-c, if the current file has been modified will ask you whether to save.
The method of the savage point, called the function Kill-emacs, namely M-x Kill-emacs, exits directly, whether or not modified.
However, after exiting directly, Emacs retains the same file name as the beginning of the # number in the same directory, and the next boot can be restored using M-x recover-file. If it is saved more than once, there will be a file ending with a ~ that saves the last message.


The first part of the tutorial is written here, although there are not many practical things, finally opened the bar.

Emacs Tutorial (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.