Learning notes for Emacs (2): First knowledge of Emacs

Source: Internet
Author: User
ArticleDirectory
    • 1. What is Emacs?
    • 2. What can Emacs do?
    • 3. emacs Interface
    • 4. Basic concepts-Commands
    • 5. Basic concepts-Shortcut Keys
    • 6. Basic Concept-Mode

Contents

1. What is Emacs?

2. What can Emacs do?

3. emacs Interface

4. Basic concepts-Commands

5. Basic concepts-Shortcut Keys

6. Basic Concept-Mode

Emacs Study Notes 2: What is emacs1.emacs

In fact, it is difficult to define Emacs. The orthodox saying may be "Emacs is editor macros (macro Editor), a text editor ".

At first, people thought that Emacs was an editor. Together with vim, it was called two major artifacts. It is said that Vim is the god of the editor, and Emacs is the editor of the gods.ProgramThere are three types of members: Emacs, Vim, and others.

Some people think that Emacs is an integrated environment of the architecture in the editor. Besides the most basic editing functions, you can also complete file management, terminal simulation, Web browsing, sending and receiving emails, compiling programs, and coffee.

Some people say that Emacs is an operating system disguised as an editor, or even a belief.

Emacs was initially developed by Richard Stallman in 1975, and many derivative versions were generated later. Currently, the two most widely used versions are gnuemacs developed by Richard Stallman in 1984 and xemacs written by jamiezawinski in 1991. Emacs has a long history. The current version of GNU Emacs is 23.4. The history of an Emacs is equivalent to the history of a computer and a history of world hackers. This article does not want to burn the War of the editor here, so I will stop here to see what Emacs can do.

2. What can Emacs do?

Said Brother Wang:

As far as I know, the capabilities of Emacs include:
1. edit text
2. Edit the program
3. Interface for other programs
4. As an operating system
5. Coffee

Emacs is an operating platform with super scalability and super customization. What it can do depends on your customization and expansion. Emacs is powerful because of its almost unlimited customization and scalability.

3. emacs Interface

Shows the uncustomized Emacs:

The entire window is called frame in Emacs. emacs in the graphic interface can open multiple frames. Each frame is divided into three parts: the buffer zone, the status bar, And the echo area.

The buffer zone is the primary area for editing, but the operation here is not really a file, but a cache of the file (buffer ). The buffer content is written to a file only when the write operation is executed. The buffer zone can be divided into multiple regions to buffer different contents. These areas are "Windows" in Emacs ".

Below the buffer is the status bar, displaying some current status information, from left to right in sequence:
U: The current file encoding is UTF-8, if it is GBK it will show C
**: File status. ** indicates that the file is not saved. -- indicates that the file is writable. % indicates that the file is read-only.
Emacs1: the name of the currently edited file.
ALL: indicates that all content of the file has been displayed in the current buffer; otherwise, it will be displayed, for example, bot, indicating that it is at the end of the file.
L23: number of rows where the current cursor is located
Fundamental: Current Mode
And so on. the status bar content of Emacs may be different for different releases.

At the bottom is the echo area, prompting you for ongoing operations. For example, "saved files. If a command is not completed, the entered command is displayed, prompting the user.

4. Basic concepts-Commands

All Emacs operations are implemented by calling commands. For some common commands, the shortcut keys are defined for quick use.
You can run the command in M-x command mode regardless of whether there is a shortcut key. (M-X, that is, ALT + X, is a shortcut key, which will be introduced later) for example, enter a carriage return, which is equivalent:
M-x newline
When executing a command through M-X, you can use tab to complete, use M-P to flip up, and m-N to flip down.
In Emacs, cancellation is usually performed by pressing ESC three times:
ESC (m-x keyboard-escape-Quit)
However, during command execution, it is possible that the command cannot be used (for example, some commands are interactive and some parameters need to be entered ), therefore, it is best to use C-g (m-x keyboard-Quit) to abort the execution of a command ).

5. Basic concepts-Shortcut Keys

In essence, shortcuts are just a way to send commands!
The shortcut keys of Emacs are usually defined in combination. For example, M-X indicates Alt + X. The above letter M represents the modifier. The modifier defined by Emacs is as follows:
C-: Control
M-: ALT (it should be meta. on PC, the meta key usually corresponds to the Alt key)
C-M-: Hold down CTRL and ALT at the same time
S-: Shift
RET: Return
Tab: Tab
ESC: ESC, equivalent to m -. For example, C-m-R is equivalent to ESC c-r.
SPC: Space key
DEL: Return key
Delete: delete key

The above mentioned ESC c-r. This is a combination, which means to Press ESC first and then c-r. Many shortcut keys in Emacs are defined as a combination. For example, C-x C-C (m-x save-Buffers-kill-Emacs)
In addition, some commands can pass parameters, which are represented by (#) in Emacs notation. For example:
C-U (#) C-F indicates repetition # times C-F

6. Basic Concept-Mode

Emacs is a "pattern" editor. It is easy to understand if Vim is used. However, emacs has two modes: Major mode and minor mode.
The main mode is determined by the file type. The main mode is determined by the file type when each Buffer opens the file. Common modes include:

Fundamental-mode: Default Emacs mode, with minimum settings and bindings
Text-mode: Basic Mode for editing text
C-mode: used to edit C ProgramsSource code
LISP-interaction-mode: used to edit and compile LISPCode
Ptex-mode: used to edit the Tex document

Secondary modes can be combined into primary modes. Common Secondary modes include:

Abbrev-mode: used to generate and use abbreviations
Auto-fill-mode: used to automatically wrap text and fill long lines and paragraphs
Line-number-mode: displays the current row number.
Overwrite-mode: overwrite mode, which replaces the default insert mode.

You can use a command to specify the mode: M-x mode_name
For a buffer, the current primary mode can only be one. When the primary mode is specified, the original primary mode will be replaced, and the current secondary mode can be multiple.
If the input mode is included in the current mode, all secondary modes are cleared for the primary mode. For the secondary mode, the secondary mode is disabled.
The mode changes are displayed in the status bar.

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.