Emacs Quick Guide (Emacs Tutorial)

xiaoxiao2021-03-06  64

You are reading the Emacs Quick Guide (Emacs Tutorial). Please see the page for copy conditions.

Copyright (C) 1985, 1996, 1998, 2001, 2002 Free Software Foundation.

The Emacs command typically contains a Control key (sometimes in Ctrl or CTL to indicate) or

The META key (sometimes indicated by an EDIT or Alt). In order to avoid writing its full name every time,

We will use the following abbreviations:

C- means holding down the Control key when typing characters . Therefore, C-f is: press

Type F again in the Control button.

M- means holding down the META or EDIT or ALT key when typing characters . If not

When there is a Meta, an Edit or an Alt key, you can use "Press the ESC to let go,

Type the step "to be replaced. We represent the ESC key in .

Important memo: To exit Emacs sessions (SESSION), type C-X C-C (two characters).

The ">>" character in the left side is to let you try the prompts of the command used. for example:

<< Blank Lines Insert Around Following Line By Help-with-Tutorial >>

[Middle of Page Left Blank for Didactic Purposes. Text Continues Below]

>> Type C-V (View Next Screen) to move to the next screen. (Try to see, type characters

V While holding down the Control button)

From now on, you should do this action once every time you read the current screen.

It should be noted that when you move from one screen to another, there will be two lines of repetitions; this is to

Provide some continuity, allowing you to read text.

What you need to know how to move in the text. You already know that you can move forward from C-V

Move a screen. To move a screen back, type M-V (hold down the META button, then type V

, Or if you don't have META, EDIT or ALT buttons, type V).

>> Try to type M-V and then C-V and continue several times.

Now you can move the c-v command to the section of the "translation" in the following, to achieve the translation related to this article

Item; then return here with the m-v command. 】

* Summary

-----------------

The following command is quite useful when browsing the screen: [We now use "screen" to "display files)

The area of ​​the capacity, because it is currently a single-pane display status in Emacs, if

In the state of the multi-pane, the commands described here utilize "panes in the work". About pane

Introduction, please see the Windows section. 】

C-V moving a screen / pane forward

M-V moving a screen / pane

C-L Clear the screen / pane, re-display all text, location of the cursor is displayed

The center of the screen / pane. (Is Control-L instead of Control-1) >> Find the position of the cursor and pay attention to why the text near it. Then type C-L. Look again with the cursor again

The location, confirming that the same text is now near it.

If your terminal has a PageUp and a PageDN key, you can also use them to be single

The place moves, but use C-V and M-V will be more efficient.

* Basic cursor control (Basic Cursor Control)

----------------------------------------

The screen to the screen is very useful, but how do you move to a specific location in the screen in the screen?

There are several ways to do. You can use the arrow keys, but put your hand in the standard [keyboard] bit

Set, and use commands C-P, C-B, C-F and C-N will be more efficient. These characters and four

The arrow keys [function] is equal, as shown below:

Front line C-P

:

:

Move C-B backward .... Current cursor location .... move forward C-F

:

:

After one line C-N

>> Move the cursor to the center of the graph in C-N or C-P. Type C-L will see the entire graphic display on firefly

The center of the curtain.

You will find the meaning representing the letters to remember that they are easy: P Represents previous, n

Next, b represents Backward, and f indicates Forward. You will "always" use these tour

Snorked command.

>> Move the cursor to this line as a few times.

>> Move it to this line in C-F, then move back in C-P. Look at the cursor in the Bank

What is the action of C-P?

Each text is ended as a newline character, which is used as a next line.

In the last line in your file, there should be a newline to end (but Emacs is not

Set it to edit the file).

>> Try to type C-B in the place where the row is started. The result should be moved to the last side of the previous row. this is

Because it passes back to the NewLine character when it moves back.

C-F can also pass the NewLine characters like C-B. [Newline characters are "invisible

(Invisible) characters, generally can't see it in the editor, just tell you:

Going forward, then the cursor will run to the upper party (if any); go back and go back in the distance, then the cursor will

Run to the next line (if any). "Crossing Newline characters" will make the cursor to another line. 】

>> Multiple C-B, you feel the cursor. Then press C-F to the tail of this line several times.

Pressing C-F again to move to the next line.

When you move the cursor above or below the screen, the text outside the boundary shifts into the screen. This

"Rolling". It allows Emacs to move the cursor to any specific location in the text, while

(Cursor) Will not run out of the screen.

>> Try to take the cursor under the screen with C-N, then look at what happened.

If a character moves too slowly, you can move one word one word. M-F

(META-F) moves a word forward, M-B moves back to a word. [For Chinese, it is mobile

To the next or last punctuation. 】

>> Type some M-F and M-B.

When you are in the middle of a word, M-F will move to the tail of this word. When you are in the words and words,

M-F will move to the next word of the word. The effect of M-B is similar, but the direction is different. >> Some C-F and C-B in M-F and M-B, in the middle, so you can observe M-F

And M-B in different positions of "bit in the word or character", the performance.

Please note the similarities between C-F, C-B and M-F, M-B. The situation of "often" is:

Meta characters are used as an operation related to "the unit (word, sentence, paragraph)" defined by language

Working, and the control character is "Basic" unit (character or line "unrelated to your edit

Wait).

This similarities are equally applicable between "row and sentence": C-A and C-E will move the cursor to "one

At the beginning and end of the line, the M-A and M-E move the cursor to the beginning and end of the "one sentence"

Place.

>> Try to press twice C-A and then press twice C-E. Try to press twice M-A and press twice M-E.

Look at why the duplicate C-A command will have no effect, and the repeated m-a command will continue to move.

A sentence. Although this doesn't say it is a complete class, it seems very much.

natural.

The position of the cursor in the text can also be referred to as "Point". Simply, it is: cursor performance

The text location of "point" in the screen.

Here is some simple "cursor-moving operations", including

"Words and sentence" movement commands:

C-F moves a character forward

C-B moving back back a character

M-F moves forward a word [Chinese is moving to the next punctuation]

M-B moving back moving a word [Chinese is moving to the last punctuation]

C-N moves to the next line (move down)

C-P moves to the previous line (move up)

C-A moves to the head

C-E moves to the end

M-A moves back to the sentence

M-E moved to the end of the sentence

>> Exercise several times of these orders. These are the most commonly used commands.

There are also two important cursor-motion commands, M - <(Meta Less-Than), shift

Move to the beginning of the text, and M->-Than, move to the last of the text.

At most endors, "<" is above the COMMA, so you have to use the Shift key to key

Into. On these terminals, you must use the Shift key to type M- <; did not use the Shift key,

You turn into type M-COMMA.

>> Try M- <, moved to the beginning of this fast guide. Then use C-V to return again.

Here.

>> Try M-> now, move to the final guide. Then use M-V to return this again.

in.

If your terminal has a direction key, you can also use the arrow keys to move the cursor. We have three reasons

You learn C-B, C-F, C-N, and C-P: 1. Any terminal can be used. two,

Once you are quite skilled in using Emacs, you will find these Control characters, compared to the user

It's too much to the key (because you don't need to move your hand open the field). Third, once you use these Control

The character command becomes a habit, you can easily learn other advanced cursor action commands.

Most of the EMACS commands accept digital parameters; for most of the commands, its role is to specify the number of repetitions. The number of repetitions you want to specify a command is: Type C-U first, then enter your finger in your key

Type a number of repetitions before the order. If you have a META (or EDIT or Alt) button,

Then you have another alternative to enter a digital parameter: Press and hold the META button to enter this number. I

We recommend that you learn C-U methods because it can be used in any terminal. This number parameter is also

It is called "first parameters" because you type it before this parameter acts.

For example, C-U 8 C-F moves 8 characters forward.

>> Try to use C-N or C-P with a number parameter, only one command moves the cursor to this line.

nearby.

Most of the commands use digital parameters as their repetition, but some commands are as other.

use. There are a few commands (currently you have not learned) use it as a flag - type with a first parameter

Arrive, regardless of why, they make this order to do something different.

C-V and M-V are an exception of another class. When a parameter is given, they are rolled out "specified quantity

Rows (in behavioral units), rather than in units of "screen". For example, C-U 8 C-V

The screen is displayed 8 rows.

>> Now try to type C-U 8 C-V.

This command should have moved the screen up to 8 lines up. If you want to get it down again, you can

Give a given parameter when M-V is executed.

If you are using the X window system, there should be a "rolling axis" on the left hand side of the Emacs window.

Rectangular area. You can use a mouse on the rolling axis to scroll the text.

>> Try to press the intermediate button on the "rolling axis inner inner continent). This should be rolled out to "

The location determined by the places of the mouse.

>> When pressed in the middle, try to move the mouse up and down. You will see the text as you move the mouse and up and down

mobile.

* When Emacs is in a daze (When Emacs Is Hung)

---------------------------------------

If Emacs stops responding to your command, you can type C-G to securely stop it. You can also make

Use C-G to stop performing an overnaughter command.

You can also use C-G to cancel digital parameters or you don't want to complete the command.

>> Type the C-U 100 to set the number parameters of a 100, and then type C-G. Type C-F now

. It should only move one character because you have canceled the parameters in C-G.

If you are not carefully type a , you can C-G to cancel it.

* Incompatible command (Disabled Commands)

-----------------------------------

Some Emacs commands are "invalidated", so beginners will not use them unexpectedly.

If you type an invalid command, Emacs will display a message, indicating that this command is

And ask if you want to continue, then execute this command.

If you really want to try this command, type blank when you ask you when emacs asks you. One

As soon as you don't want to perform this invalid command, please answer it in "N".

>> Type C-X C-L (this is an invalid command) and then type N to answer questions.

* Windows

-----------------

Emacs can have several panes, each showing its own text. We will explain how to use multiple panes later. Now we want to explain how to remove excess pane, then return to the basic single-pane editing.

It is very simple:

C-X 1 One Window (ie, remove all other panes).

That is a number 1 followed by Control-X. C-X 1 expands the pane containing the cursor to the entire screen.

It removes all other panes.

>> Move the cursor to the Bank and type C-U 0 C-L.

>> Type Control-Hk CONTROL-F. Take a look at this pane when a new pane appears (with

When a document for the Control-f command is reduced.

>> Type C-X 1 to disappear with the document list pane.

This command is not like the command you have learned, it includes two characters. It is character

Control-x starts. There is a whole series of commands that start with Control-X; they

Many of them are related to "pane, file, temporary area, and related things". These orders have 2, 3

Or 4 characters long.

* Insert and deletion (Inserting and deleting)

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

If you want to insert a text, type it. The characters you can see are like a, 7, *

Wait, it is considered text by Emacs and can be inserted directly. Type (Carriage-Return

Key) to insert a newline character.

You can type to delete the character you finally typed. is a keyboard key -

That is, you usually use the same "to delete the last type of characters" outside Emacs. Generally

It is a big key in the above, is usually labeled "Delete", "DEL" or

"Backspace".

If there is a big key labeled "Backspace" there, then that one is to use as it.

key. There will be another key to "Delete" in some place, but that

Not .

More general, will be deleted in front of the current cursor position.

>> Do now - Type some characters, then type to remove them several times. do not worry

This file will be fade; you will not affect the original quick guide. (You will see now) this

It is your personal copy.

When a line of text is better than "a line in the pane", this line of writing "continues" to the second window

Live. At this time, an anti-slope "/" (or if you use the window, it is a small bend

The arrow is located at its right border to point out this line.

>> Insert text, until you reach the right bound, then continue insert. You will see a continuous line

Now.

>> Use to delete some text until this is another pane. Continue

.

You can delete newline characters like deleting other characters. Will the newline word in the two lines

Yuan deletion will make them merged. If the result of the merge is too long, it cannot be in line with the window.

The width of the grid will be displayed in a connection.

>> Move the cursor to the beginning of the Bank and type . This will combine the Bank with the previous line

Row.

>> Type to reinsert the newline character you just deleted. Remember that most of the EMACS commands can give a repetition count; this also package

Include text characters. Repeating a text character will insert it several times.

>> Try Now - Type C-U 8 * to insert ********.

You have now learned most of the basic parties that "Type anything in Emacs and the correction error".

law. You can also delete it "in words or behavior units". Here you have a summary of "Delete Operation":

Deletes the previous character where the cursor is located

C-D Removes the latter character in the cursor

M- Deletes the previous word where the cursor is located

M-D Deletes the last word where the cursor is located

C-K deletes characters from the cursor to the "row"

M-K deletes characters between the "sentence tail" where the cursor is located

Note " and C-D" also "M- and M-D" is parallel from C-F and M-F

Expansion (um, is not a control character, but there is nothing to worry about). C-K

And M-K is like C-E and M-E to some extent, if "a line" and "one sentence" as class

Ratio.

You can also remove any part of the buffer in one way, move to some of you want to delete

One end, then type C- @ or C-SPC (any one). (SPC refers to Space Bar

) The other end of the part is moved, then type C-W. This will put the place between these two locations.

There is text deletion.

>> Move the cursor to "you" word at the beginning of the previous paragraph.

>> Type C-SPC. Emacs should display a "Mark Set" message below the screen.

>> Move the "end" word in the second row.

>> Type C-W. This will delete the text from "You" to just "end".

It should be noted that "killing" and "deleting" are different from being killed.

Can be pulled back, but it is not possible. [It is a bit difficult to understand, you can think so: one, "Kill it

"Years of the dead bones, and" deleted ", the bones are not available! It can be seen that "delete" for computer information

More than "killing" serious. Second, in fact, even if it is deleted, we still have a technology to save it.

Back, especially text information, premise is the formatting action of entity memory after deletion. But this

It is impossible for general users, so this situation is not considered. 】 Re-insert being killed

Text is called "Yanking". In general, the command that can remove a lot of words will

Some texts are stored (they can set it back), and those just delete a character or

Just remove the blank line or blank command, these deleted texts will not be stored (so you can't

That text is pulled back).

>> Move the cursor to the beginning of a non-blank line. Then type C-K to kill the text on that line.

>> Type C-K for the second time. You will see that it kills the newline character behind the line.

Please note that the separate C-K will kill the content of a line, and the second C-K will kill the party itself.

And make all other rows move up. C-K handles digital parameters in a very special way, it will

Kill a lot of rows and their content, this is not just repeated, C-U 2 C-K will kill both lines and their newline characters; if only type C-K is two times.

The action that will be recovered to be killed is referred to as "YANKING". (Take it into you

From the things that you take away, pull back) You can pull back in your place where you delete the text, you can

Turn back elsewhere. You can pull back the same text several times to make it a copy of it.

The command pulled back is C-Y. It will reinsert the last killed text in the position of the current cursor.

>> Try to see; type C-Y pull back.

If you have made several C-Ks continuously, all the words killed will be stored together, so do it once.

C-Y will pull all these rows back.

>> Now, type C-K several times.

Now you have to restore those who killed:

>> Type C-Y. Then move the cursor to a few lines, and then type C-Y again. You know now

Copy certain words.

If you have some words you want to pull back, but later you have killed something, so what should you do?

C-Y will pull back recently, but the previous text has not disappeared, you can use M-Y to return

To it. When you have used C-Y to pull the nearest killed back, type M-Y to pull these

The text is replaced with the previously killed. Type M-Y again and again will kill the previous one.

The text belt back. When you get to the text you want, you don't need to do anything to save it, just follow

Continue your editor, stay in these roll-back text is good.

If you have made M-Y many times, you may return to the starting point, that is, killing recently.

>> Kill a line, around it, and then kill another row. Then use C-Y to bring the row of the second kill back

Come. Then use M-Y, it will be replaced by the line of the first killed. Do a few times of M-Y to see you

What will you get. Not interrupted, until the second kills, do it a few times. If you want

If you can try to give M-Y positive or negative parameters.

* Cancel action (UNDO)

------------------

If you have changed the text, then I feel that it is an error, you can cancel this Undo command

Change, C-X u.

Usually C-X u cancels the change caused by a command; if you repeat many times in a row

C-X u, each repetition will cancel additional commands.

But there are two exceptions:

First, there is no change to change the text is not counted (this includes the command of the cursor movement);

Second, the characters typed in a group are processed in a group of one group - up to 20 - each group. (This is

Reduce the number of times you must type C-X u in canceling "Inserting Text Actions))

>> Kill this line with C-K, then type C-X u, it will appear again.

C-_ is another cancellation command; its role is like C-X U, but it is easier in a line.

Type many times. The disadvantage of C-_ is that it is not very clear in some keyboards how to type it, this is why I

They also provide C-X u reasons. In some terminals, you can press and hold the Control and type /,

To type C-_.

A digital parameter is a number of repetitions for C-_ or C-X u.

* File (file)

----------------

In order to make your text permanently save, you must put it in a file. Otherwise, when you quit Emacs, it will disappear. In order to put your text in the file, you must type these

"Find" file before text. (This is also called "Visiting" file)

Find a file indicating that you can see the contents of the file in Emacs. From many ways, it is like

It is the same as you directly edit the file. However, you are using until you "save" this file.

The change made by the Emacs editing will not be saved. That's why you can

Avoid leaving files to half in the system. Even when you are stored, Emacs will also put the original text

For a different name, you can do it later. If you think that your change is a mistake, you can

use it.

At the bottom of the screen, you can see a line that starts with the broken number - usually "-:

Tutorial.cn "or other similar things begins. This is part of the screen, usually used

You are visiting the file. Now, the file you are visiting is called "tutorial.cn", it is you

Human copy. When you find a file with Emacs, the name of that file will appear in that place.

square.

Among the commands of looking for files, there is a very special thing that you must say this name you want.

We said this command "a parameter from the terminal". (In this example, this parameter is

Name of the file) When you type this command,

C-X C-F Find a file

Emacs will want you to type file name. The file name you typed will appear on the bottom of the screen. Be used

When the input is input, the bottom line is called a small buffer. You can use normal

Emacs Edit Commands to Edit this file name.

You can use C-G this life when you are typing the file name (or when you enter any small buffer input)

Order cancels it.

>> Type C-X C-F and type C-G. This will cancel the small buffer and will cancel this

The c-x c-f command of the small buffer. So you didn't find any files.

When you type this file name, type to end it. Then C-X C-F command

Will start working and find the file you selected. The small buffer is at the end of the C-X c-f command

It will disappear.

After a while, the content of the file will appear on the screen, then you can edit its content. When you want

Type this command when you change your changes permanently:

C-X C-S Store this file

This will copy text in Emacs to the file. When you do this action for the first time, Emacs will

Rename the original file into a new name so that it will not disappear. New names usually add

Enter "~" to the name of the original file.

When the store ends, Emacs will list the names of the write file. You should regularly save, this

If the system crashes, you will not lose too much job.

>> Type C-X C-S to store your copy of this Quick Guide. This will

"Wrote ... tutorial.cn" This message is displayed below the screen.

Note: In some systems, type C-X C-S will freeze the screen, you will not see from Emacs

Any output. This means that the operating system is called "function" "" process control "to block the C-S command

Calcloud and do not allow it to pass to Emacs. To cancel the freezing of the screen, type C-Q. Then go to Emacs

In the manual, see the topic of "Spontaneous Entry TOINCREMENTAL SECH" to obtain this "function" suggestion.

You can find an already existing file and watch it or edit it. You can also find one yet.

Existing files. This is a way to build a file with Emacs: find this file, starting from scratch,

Then start inserting a text into this file. When you ask "Storage" file, Emacs will really build

Set up a file and put the text you insert into the file. From then start, you can be used as yourself.

It is edited an existing file.

* Buffer (Buffer)

------------------

If you are "finding the second file in C-X C-F, the first file still exists in Emacs. To switch

Back to it, you can find it once again C-X C-f. In this way, you can open a lot of text in Emacs

Part.

>> Establish a file called "foo" in a way to type C-X C-F foo . Plug

Into some text, edit it, and then store "foo" in C-X C-S. Finally, type C-X

C-F Tutorial.cn Go back to this quick guide.

Emacs stores the text of each file in a piece called "buffer". Find a

The file will create a buffer within Emacs. I want to see the current work of your Emacs.

Rush list, type

C-X C-B lists buffers

>> Try Now C-X C-B

See how each buffer name is named, and it may also have a "file that stores its content".

The name. "Any" text you see in an Emacs pane is part of a buffer.

>> Type C-X 1 to exit the buffer list

When you have several buffers, only one of them is "currently role". And that is

You are editing buffers. If you want to edit another buffer, you must "switch" to it.

If you want to switch to a buffer connected to a file, you can use C-X C-F to visit the one again.

file. But there is a relatively simple way: use C-X b; in this command, you must type slow

The name of the punch.

>> Type C-X B foo to return to the buffer containing the file "foo". Then built

Enter C-X B Tutorial Back to this Quick Guide.

For most cases, the name of the buffer is the same as the name of the file (removed in the file name)

Directory part). However, it is not always the case. The list of buffers you made in C-X C-B is always

Displays the name of each buffer.

Your "any" text you see in an Emacs pane is always part of a buffer. One

Some buffers are not connected to the file. For example, the buffer named "* buffer list *" is named and

No files. It is a buffer that contains a buffer list that you created by the C-X C-B command.

Area. The buffer named "* message" is also not connected to any file; it is in your Emacs

The session contains messages that appear in the bottom.

>> Type C-X B * Messages * to see the message's buffer. Then type C-X B

Tutorial Back to this Quick Guide.

If you have modified the text in the file, then find another file, this action will not store the first one.

file. Its modification still exists in Emacs, which is in the buffer of that file. Second

The establishment or editing of a file does not affect the buffer of the first file. This is very useful, but this situation also shows that you need "a convenient method" to store the first file buffer. Just for

Save the first file must switch the buffer with C-X C-F to save it, always

It is an annoying process. So we have

C-X s stores some buffers

C-X S will ask for each buffer that you have made but have not stored. It will ask you, for

Do you want to store each such a buffer?

>> Insert a line of words and type C-X s. It should ask if you want to store named

Tutorial.cn buffer. Type "Y" to answer.

* Extending The Command Set

-----------------------------------------

Because Emacs has too many commands, even if all the Control and Meta characters are used, they don't do

The method is completely placed. Emacs solves this problem with X (expanded "Extend") command. The expansion command has

Two types:

C-X character expansion. The back is followed by a character.

M-X has a named command expansion. The back is followed by a long name.

There are still some commands to usually use it, but it is less used than you have learned. You already

I have seen two of them: C-X C-F in the file command, and C-X C-S is stored. other

The example has a command to end the Emacs session - this command is C-X C-C. (Don't worry, you will lose

Going to the change, C-X C-C provides a text that stores every change before it kills Emacs.

Opportunity. )

C-z is * temporary * Exit Emacs command - so you can return to the same EMACS session later.

In some systems that allow it, C-Z will "suspends" Emacs, that is

Say, it will return to the shell but will not destroy Emacs. In the most common shell, you can use

"FG" or "% Emacs" two commands restore Emacs.

In systems that do not provide a pause function, C-Z will create a subsidell under EMACS to let

You have the opportunity to perform other programs and return to Emacs later, it doesn't really exit Emacs.

In this example, the shell command "exit" is a normal way from Subshell back to Emacs.

Time to use C-X C-C is when you plan to log out. It is also very suitable for exiting by other mail

Handling programs, as well as Many different applications started with EMACS. However, in general, if

If you don't plan to log out, it is best to pause Emacs instead of exiting it.

There are many commands for C-X. Here is a list you have learned:

C-X C-F File.

C-X C-S Stores the file.

C-X C-B lists the buffer.

C-X C-C exits Emacs.

C-X 1 deletes all other panes except one except one.

C-X u cancels the action.

Command named by expansion is usually uncommonly used commands, or only in a specific mode.

The command. An example is a string command that will replace a string in the whole world. when

When you type m-x, Emacs will ask you on the bottom of the screen, then you should also type this command.

name. In this example, "Replace-String" Just type "REPL S ", then

Emacs will make up this name. End this command name in .

The substitute string command requires two parameters - the substituted string and the string used to replace it. You must

NewLine characters end each parameter.

>> Move the cursor to the lower two lines of the Bank, then type

M-X REPL S Changed Altered .

Please note how this line changes: After the start position of the cursor, you have already put C-H-A-N-G-E-D

This word - no matter where it appears - the word "altered" is replaced.

* Auto Save (Auto Save)

-----------------------

When you have modified in a file, but you have not stored them, then if your computer is

Machines, they will be lost. In order to avoid this situation in your body, Emacs will regularly

The file you are editing is written in the "Auto Save" file. Automatically store files in front of the file name

There is a # symbol; for example, if your file is named "Hello.c", then its automatic storage

The file name of the file is "# Hello.c #". When you store files in a usual way, Emacs will

Remove its automatic storage file.

If you crash, you can find a file normally (referring to the file you edited instead of the auto storage)

Deposit file) Then type M-X Recover File to restore your auto storage file. when it

When you are confirmed, type YES to continue and restore automatic storage.

* Response area (Echo Area)

---------------------

If Emacs sees you slowly type multi-character command, it will display them below the pane,

The area called "response area" is given to you. The response location is in the last line of the pane.

* Mode Line

---------------------

The top of the response area is called "status line". The status line shows some information, such as:

-: ** Tutorial.cn (Fundamental) - L670--58% ----------------

The Bank provides some useful information about the "state of Emacs" and "text you are editing".

You already know what the meaning of the file name is what you are looking for. -Nn% - pointed out that you are now

The location in the text file; it means: There are NN percentage literals on the pane. in case

The top of the file is in the pane, then it will display - TOP - instead - 00% -. If the text

At the bottom of the part in the pane, then it is display --bot -. If you are watching the text file, you are very small,

In the pane, it is enough to see all content, then the status line will display - AlL-.

L and numbers indicate locations in another way: they give the current number of rows (line).

The asterisk near the previous indicates that you have changed these words. Enjoy or store a file when you visited or store

After that, the part of the status will not be as an asterisk, only the dash.

The status line is located in the part of the brackets, which is used to tell you what edit mode is being used. default

The mode is Fundamental, that is, you are now using. It is an example of "main mode".

Emacs has many different main modes. There are some of them to edit different languages ​​and / or

The same type of text, like a LISP mode, Text mode, and more. Only one main model at any time

The style can work, and its name can always be found in the status line, just in the "Fundamental" in "Fundamental".

Each main mode makes some commands behave nothing. For example, in a program

Some commands are used to make a note, and because each program language should be asked for a note.

Once you have different ideas, every main mode must be inserted into a note in different ways. each

A main mode is a name of an extension command so that you can use to switch to that mode. for example,

M-X Fundamental-Mode is a command to switch to the Fundamental mode.

If you want to edit a text file in a human language - like this one now, you should use Text

mode.

>> Type M-X Text Mode .

Don't worry, there is no Emacs command you have already learned, it will be changed to any very different

form. But you can find that M-F and M-B now treat the apostrophe (') as part of the word. first

Before, in the Fundamental mode, M-F and M-B will treat the apostrophe as the separator symbol.

The main mode usually makes some exquisite changes like the above example: most of the commands are in each

"Do the same thing" in the primary mode, but they work in a different way.

[Continue to the head opened above, the recording of the language is mentioned. The same action inserted into the note <

M-; Command Insert>, will vary depending on the program language / main mode you use. If you use C

Language, EMACS insert "/ * _ * /", and placed the cursor in it to start a note; if you are using

FORTRAN language, Emacs insert "C _" because it starts as a note line in character c; if you make

Used in the Perl language, Emacs is inserted into "# _" because it starts with the wellhead number as a note text.

The "_" refers to the position where the insertion is inserted, the position where the cursor is located. The elasticity of the editor is so

There is no need for a different language, purpose or appearance, design a special editor. "Ask Datong, save

Small videos are also established here. 】

To browse the document you are now, type C-H m.

>> Use C-U C-V or several times to bring the Bank to the top of the screen.

>> Type C-H m to see where the Text mode is different from the Fundamental mode.

>> Type C-X 1 Remove the document from the screen.

The reason why main mode is called "Major" is because they also modified (Minor)

Mode). The secondary mode is not the other choice of the main mode, but only the secondary changes. Each time

The style can be enabled or stopped by itself, and all other times are independent, and it is also not your main mode.

turn off. So you can use the secondary mode, or one, or any number of times a combination of times.

There is a second mode called Auto Fill mode very useful, especially in editing human language.

Time. When this mode is enabled, Emacs will put that when you insert the text and make a row too wide.

Row, automatically separated between words and words.

You can enable the Auto Fill mode to M-X Auto Fill Mode . This mode

When enabled, you can use M-X Auto Fill Mode to cancel it. When this mode is not

When used, this command will start it, and when this mode is enabled, this command will turn it off. We said this command is used to "Toggle" mode.

>> Type M-X Auto Fill Mode . Then insert the string "asdf" again and again.

Until you see it into two rows. You must put a blank between them because Auto Fill is only

Blank line.

The boundary is usually set to 70 characters, but you can use the C-X F command to change it. You should

A number of digital parameters to give you the desired boundary setting.

>> Type C-X f and attach the quotient 20: "C-U 2 0 C-X f". Then type some text, see

Look at Emacs with 20 characters, Fill action between rows and rows. Then use once C-X

f Set the boundary back to 70.

If you make changes in a paragraph, Auto Fill mode does not re-add Fill.

Act (RE-FILL). To RE-FILL, type M-Q (Meta-Q), and the cursor must

It is in it.

>> Move the cursor to the previous paragraph, then type M-Q.

* Search (Searching)

-------------------

Emacs can search for strings (strings can be a group of consecutive characters or words) [For Chinese, characters and

The word is basically the same; "Word" referred to here is a character set that is not blank in English.

. 】, You can go back to the search. Searching a string is a cursor mobility command, it will travel

Script moves to the next place where the string appears.

Emacs search commands and most editors have different places where it is "gradually

Incremental ". This means that the search happens after you type the text string you want to search.

The command to start searching is: C-S search forward, C-R goes back. But wait! Now no

Try it.

When you type C-S, it will be found that a string "I-Search" appears in the response area as a prompt.

It tells you that Emacs is now in the state of "progressive search", waiting for you to type you want

Search for strings. will end a search.

>> Now type C-S to start a search. Slow down, type a character once, type "Cursor"

This word, when you type a character, stop, pay attention to what the cursor happens. Now

The word "Cursor" has been searched.

>> Type C-S again to search for the next appearance location of "Cursor".

>> Type four times to see how the cursor moves.

>> Type End Search.

Have you seen what happened? In a gradual search, Emacs tries to go to your typing word.

The next appearance of the string. To move to the next appearance position where the cursor is located, just type C-S

once. If there is no such appearance location, Emacs will clam and tell you the current search.

"failure". In addition, C-G can also be used to end the search.

Note: In some systems, type C-S will freeze the screen, you will not see any from Emacs

What output. This means that the "function" called "Flow Control" is called "Flow Control",

And do not allow it to pass to Emacs. To cancel the freezing of the screen, type C-Q. Then use the Emacs to use

In the manual, you're looking at the topic of "SPONTANEOUS Entry To Incrementals" to obtain this "function" suggestion.

If you are in a progressive search, you can find the search string in the

The last character in the middle is eliminated and the search will return to this search for the last place. Example

Say, suppose you have typed "C", used to find the first appearance of "C". Now if you type

"U", the cursor will move to the first appearance position of "CU". Type now, this will

"U" is eliminated from the search string, and the cursor will move back to the first appearance position of "C".

If you are in the middle of a search and type a Control or Meta character, (but there is

Some exceptions - special characters for search, like C-S and C-R), and search will end.

C-S will start a search, it looks for any appearance of the search string in the current cursor position,

position. If you want to search in the previous text, type C-R as an alternative. In addition to the direction of the search

In addition, what we have said about C-S can be applied to C-R.

* Multiple WINDOWS

------------------------------

One of the most good features of Emacs is that you can show more than one pane simultaneously on the screen.

>> Move the cursor to this line and type C-U 0 C-L.

>> Type C-X 2 now, which will divide the screen into two panes. These two panes show this fast

Speed ​​guide. The cursor stays above the pane.

>> Type C-M-V to roll down the pane below. (If you don't have a true META key, type

ESC C-V can also be. )

>> Type C-X O ("O" refers to the meaning of other "other", move the cursor to the window below

grid.

>> In the lower pane, use C-V and M-V to scroll it. Continue to remain above the pane

Read these guidelines.

>> Type C-X O to move the cursor back to the pane above. The cursor will return to it in the upper pane,

The original location.

You can continue to switch between the panes in the pane. Every pane has its own cursor position, but

It is only one pane that will really display the cursor. All usual editing commands will only apply to that cursor

Pane in the pane. We call this "selected pane".

Command C-M-V Edit text when you are in a pane, and use other panes as a reference,

is very useful. You can keep the cursor in the pane you are editing, and refer to C-M-V

Let the other panes forward. [Verification work is especially suitable for this way, such as GNU

The practice of Chinese translation: find an original English document; find it to translate a good Chinese file, edit this

"The selected pane", with the C-m-V command to keep the passage of the verification .... 】

C-M-V is an example of a Control-Meta character. If you have a true meta key, you can

Press and hold the Control and META and type V to type C-M-V. Control or Meta "Who

I didn't affect it, because the two keys were used to modify the characters you typed.

If you don't have a real META key, you can use ESC to be used as an alternative, so the order

There is a relationship: You must type ESC, follow Type Control-V, and Control-Esc V will not work. This is because ESC is a character with its own role, not a modified key.

>> ((in the upper pane) Type C-X 1 to remove the lower pane.

(If you have typed C-X 1 on the bottom pane, then you will hide the above pane.

Command imagine "only to keep one pane - I am editing this.")

You don't need to display the same buffer in two different panes. If you use C-X C-F in one

File in the pane, the other pane is not changed. You can find it in the independent pane [it

Believe one file.

There is another way here to use two panes to display two different things:

>> Type C-X 4 C-F, follow the name of one of your files. Novels with

bundle. Look at the specified file appears below the pane. The cursor also ran there.

>> Type C-X O to return to the top pane, then remove the lower pane with C-X 1.

* Recursive editing level (Recursive EDITILS)

------------------------------------------

Sometimes you enter the so-called "recursive edit". It is indicated by a square bracket in the state line.

And the pattern name indicated by the brackets is included. For example, you may see

[(Fundamental)], not Fundamental.

To exit the recursive editorial class, type the ESC ESC ESC. This is a full-featured "exit" command. you

It is also possible to use it to remove excess pane and exit the small buffer.

>> Type M-X to enter the small buffer; then type the ESC ESC ESC exit.

You cannot use C-G to exit the recursive editing class. This is because C-G is used to cancel the command and "bit

The "arguments" "in the recursive editorial class.

* A more help (Getting More Help)

-------------------------------------

In this fast guide, we try only to provide just good information, let you start using Emacs. in

There is too much information in Emacs, which is impossible to explain all here. However, you may

Will you want to learn more Emacs related information because it has many other useful features. Emacs

For the "reading about Emacs Commands". These "help" commands are contral-h

The characters are started as the beginning, called "Help Character".

To use the Help function, type C-h characters, then type a word that explains the help you need.

yuan. If you really don't know what to ask, please type "C-H?", At this time Emacs will tell

You can help it. If you have typed C-H, but find you don't need any help, keys

Enter C-G to cancel it.

(Some websites change the meaning of C-H this character. They really should not set it to all

The user is all applicable, so you have a reason to complain about system managers. Hereby

When C-H does not display any messages related to the help at the bottom of the pane, try to type the F1 key,

Or M-X Help . )

The most basic HELP function is C-H C. Type C-H, character c, and one or a string of characters;

The Emacs then displays a very short explanation of this command. >> Type C-H C C-P.

The news should be like this:

C-P Runs the Command Previous-Line

This tells you "The name of the function". The function name is mainly used to customize and expand Emacs. By

The function name is selected by the "What is used to indicate this command, so they can therefore be used as

Very short document - enough to remind you that you have already learned.

The multi-character command is like C-X C-S and (if you don't have a META or EDIT or Alt key) V

It can also appear behind C-H C.

To achieve more information about a command, use C-HK to replace C-H c.

>> Type C-HK C-P.

This will display the documentation documentation of this function in an EMACS pane and its name. When you read it,

Type C-X 1 to jump away from these help characters. You don't need to do it right away. You can do some edits,

Type C-X 1 when referring to the help text.

Here are some other useful C-H options:

C-H f explains a function. You want to type the name of this function.

>> Try to type C-H f Previous-line . This will print all the related "real" related to the EMACS

Information on the function of C-P this command

C-H v This similar command displays documents that "you can use to customize Emacs behavior."

When Emacs requires, you need to type the name of this variable.

C-H A Command Related Find (Command Apropos).

Type a keyword and then Emacs will list all "in its name.

All commands for keywords. All of these commands can be enabled by META-X

move. For some commands, the command-related lookup will also list "

Sthns of one or two characters of the same command.

>> Type C-H A File .

This will display a column that "all M-X commands containing" File "in its name" is displayed in another pane.

table. You will see "Character-Commands" like C-X C-F in its corresponding command name (such as:

Next to Find-file.

>> Type C-M-V to move the Help pane. Try a few times.

>> Type C-X 1 to delete the Help pane.

C-H i Read Online User Manual (A.K.A. Info).

This command will bring you a special buffer called "* info *", where you

You can read the online use manual for the package installed in your system. Type

M Emacs Read the Emacs User Manual. If you are here before

No INFO system has been used, type "?". Emacs will take you into

Guide for the INFO mode function. Once the study of this quick guide is completed,

You should check the Emacs Info manual to use as the primary reference document.

* More Features (more features)

-------------------------------

You can use the emacs manual

(Use the HELP menu or type F10 h r)> to learn more about it. There are two you can

Features that can especially likes is that the COMPLETIS that saves typos and simplifies file processing.

Dired.

Completion is a way to avoid unnecessary typing. For example, if you want to switch

* Messages * buffer, you can type C-X B * m , as long as you can determine from the text you have typed, Emacs will make up the remaining buffer name. Completion is in Emacs

In info, the manual, called "Completion" node is explained.

Dired allows you to list files in a directory (optional optional), in the list

Moving, visiting, renaming, deleting, and performing files. Dired is in the emacs manual

Info, called "Dired" node is explained.

The manual of the User's manual also explains the features of many other Emacs.

* Conclusion

--------------------

Remember, use C-X C-C to completely exit Emacs. To temporarily quit to the shell, then return it later

To Emacs, use C-Z.

This fast guide should be easy to understand for all novices, so if you find any place

Clear, don't just sit down - (to this article author and translation), let's complain!

* Translation

---------------------

The list of translators in this fast guide is as follows, and if you are reading this article, "complete" to Emacs

No concept, please tell us your opinion as a subsequent improvement basis for this article. Translation also provided a copy

"GNU Emacs Chinese Processing Description"

The content has been organized to this Quick Guide>, please also see it.

The editor is the most frequently contacted application of computer users, so it should not be too difficult for beginners.

For a general comment, Emacs is an editor that does not have to learn, but your opinion can make it more

In order to close the general user, the role of the computer as a tool is fully utilized. If you are willing to provide

Improved opinions, please email to . Please don't be shy,

We welcome any discussion; if you don't want to send a list, please email it directly to this article.

Translation . Please include this string in the Title line "Emacs Tutorial:

Issue here> ".

If you are Emacs enthusiasts, GNU Chinese Translators Team (GNU / CTT)

Welcome to join, we are now needed

Personal in translation translation Emacs manual.

This quick guide does not use the translation term used to habits, on the one hand, because of its actual intention

Different from the general editor, the original text is different; on the other hand, because of the visual adopted by Emacs

Design concept, it has already existed before the windowization system, the essence is different. In short, translation is this

It can help understand the entire design philosophy of Emacs. If you receive a reply, most requirements

We are still as good as a stream.

First, in order to avoid the confusion of "cursor movement command", the term adopted in this paper is: move forward

(Move backware); Move Backware, "not recommended to use" post "shift,

Because it is in fact it starts to the file, not to the end of the file>; "PREVIOUS"

Line); Next Line.

Second, in this article, "line" refers to ROW, which is a general habitual usage. In order to avoid misleading

The reader is particularly explained herein. In formal usage: "column" translated into "line", "vertical"

For the line (straight), it is also translated into "column"; "ROW" is translated into "column", with "horizontal" as a column (horizontal).

Readers think about "combined with horizontal" should be understood. About because Chinese is originally straightforward, we

Say "one line" is no problem; but now most of the Chinese is the horizontal book, because the habits are also known

For a line.

Third, related translations from "text" and its collection, the translation is: edited "text":

"Then type some text"; "Document" used as a description function: "This function is described

"Text" of the content described in its illustrated: "The actual effectiveness is based on English." Even

"One line", as long as it is used as an explanation, the translation is deemed to "document".

Fourth, "CUT" is divided into "killing" and "delete" in Emacs, and the difference is as follows:

"CUT" in the editor: Only the text recently passed to the clipboard; "Kill

(Killing) ": The text killed, all is added to Kill Ring;" Delete

(Deleding) ": The text deleted is deleted. So in the general editor, you can only

Paste "Recently" is written by CUT; and in Emacs, you can "pull back" any previously killed

The text is lost, and it is easy. As deleted, because it is used as a "delete" function

Command, the number of words that can be removed is very small, so there is nothing to pull back; if you really want to recover

These words, Undo your movements are.

5. "Window" is translated into "Windows" and "Windows", the former indicates the current concept

Window system, such as "X Window"; the latter represents the window in Emacs, translated here is called "pane".

Emacs' "Pane" can work normally even under the command tips, this basic characteristic is obviously worthy of

We describe it in another dedicated term.

Sixth, the term "find" a file in Emacs, "Find" in Emacs: Find a "Not

The file that exists "should be recognized as" new files "; find a" existing "file, then

"Open the old file". Emacs is only solved by a "find" action, the main reason is "actually"

Software works. The hackers should find this more natural because it reflects the work side of the computer.

When it is operated, it is less nonsense.

Seven, in the [】 text in the [] Remarks.

Eight, the problem has been resolved on the structure of the Chinese document structured.

Nine, the list of simple use of the simple use of this translation text is as follows:

CN EN

Document file Document [ation]

Document file file

Advanced Advanced

Character character character character

Command command Command

Remarks Comment

Crash machine crash

Cursor Cursor Cursor

Custom subscription Customize

Default Default

Exit exit EXIT hacker Hacker

Information Information Info [mation]

Message message Message

On-line online online

Operation operation Operat [e / ing]

Package kit package

Program program Program

Recurrent delivery back Recursive

Screen screen screen

Session phase session

Software Software Software

Window Window [S]

In addition, we also welcome readers to directly modify this quick guide, make their own version, with themselves

It is considered to be the most appropriate way to introduce Emacs. If you make this personal version,

For your reference, please send you , we will

The version is disclosed to the Chinese user download in the GNU / CTT web page.

Translation: Liu Zhaohong

Verification: Ma Xueping, Liu Songhe

* Copying

-----------------

This fast guide follows the Emacs fast guide with a long history, by stuart cracraft in order to

The version written by the original Emacs begins.

This version of the fast guide and GNU Emacs are copyright and allowed under certain conditions.

Distribute its copy:

CopyRight (C) 1985, 1996, 1998, 2001, 2002 Free Software Foundation

Chinese translation by chao-hong liu (2002, 2003)

Permission is granted to anyone to make or distribute verbatim

Copies of this Document As Received, in Any Medium, Provided That

The Copyright Notice and Permission Notice Are Preserved, And That

The Distributor Grants The Recipient Permission for Further

Redistribution as permitted by this notice.

This article allows you to publish in any form of media without changing the content of the document, but you need to keep the version

The right, the license, the dispeaker must also give the recipient as allowable,

One-step license. [This paragraph provides the reader as a reference to help understand, actually effective

Text is accurate. 】

Permission is granted to distribute modified version of this

Document, OR of Portions of It, Under The Above Conditions,

Provided Also That Thei Carry Prominent Notices Stating WHO LAST

Altered them.

This article allows for a modified version, or part of it,

But they must also have significant, indicating who is finally filling its statement. [COPYLEFT copyright

In addition to providing users free, it also maintains the original author, and the author's reputation rights

Credit. The translation of this paragraph provides the reader as a reference to help understand, and the actual effectiveness is in English.

quasi. 】

Copying Emacs itself is more complicated, but has the same spirit. Please read COPYING

Document, and really give your friends GNU Emacs copy. Please help eliminate software barriers (ownership) via "use, write, and sharing free software"!

转载请注明原文地址:https://www.9cbs.com/read-89799.html

New Post(0)