讀譯Emacs Tutorial

Emacs tutorial. See end for copying conditions.

Emacs教程收奔。復制條件請參閱文末掌呜。

Emacs commands generally involve the CONTROL key (sometimes labeled
CTRL or CTL) or the META key (sometimes labeled EDIT or ALT). Rather than
write that in full each time, we'll use the following abbreviations:

Emacs命令通常包含Control鍵(有時候標注為CTRL或者CTL)或者META鍵(有時標注為EDIT或者ALT),每次我們使用以下簡寫代替全稱

C-<chr> means hold the CONTROL key while typing the character <chr>
Thus, C-f would be: hold the CONTROL key and type f.

C-<chr> 意味著按住CONTROL按鍵的同時敲擊<chr>字符鍵坪哄。因此C-f意味著按下CONTROL的時候敲擊 f

M-<chr> means hold the META or EDIT or ALT key down while typing <chr>.
If there is no META, EDIT or ALT key, instead press and release the
ESC key and then type <chr>. We write <ESC> for the ESC key.

M-<chr> 意味著按住META质蕉、EDIT或者ALT按鍵的同時敲擊字符鍵<chr>

Important note: to end the Emacs session, type C-x C-c. (Two characters.)
To quit a partially entered command, type C-g.
To stop the tutorial, type C-x k, then <Return> at the prompt.
The characters ">>" at the left margin indicate directions for you to
try using a command. For instance:

重要提示:想要結束Emacs會話势篡,按下C-x C-c(兩個字符)

[Middle of page left blank for didactic purposes. Text continues below]

出于教學目的,此頁中間部分留空模暗。內(nèi)容下面繼續(xù)禁悠。

Now type C-v (View next screen) to scroll down in the tutorial.
(go ahead, do it by holding down the CONTROL key while typing v).
From now on, please do this whenever you reach the end of the screen.

現(xiàn)在按下C-v (看下一個屏幕)在教程中來向下翻頁(試試吧,按住CONTROL鍵然后敲擊v鍵)兑宇。從此碍侦,你就可以在到達屏幕結束末尾時用這個快捷鍵翻頁了

Note that there is an overlap of two lines when you scroll a whole
screenful; this provides some continuity so you can continue reading
the text.

注意整屏翻頁時有兩行重疊,這保證了連續(xù)性隶糕,便于你繼續(xù)讀文章

This is a copy of the Emacs tutorial text, customized slightly for
you. Later on we will instruct you to try various commands to alter
this text. Don't worry if you change this text before we tell you to;
that is called "editing" and that's what Emacs is for.

這是為你稍微定制的Emacs教程的一份拷貝瓷产。待會我們會指導你嘗試不同命令來更改這篇文章。不要在我們讓你做之前擔心文本內(nèi)容會被改變若厚,這就是編輯拦英,也是Emacs存在的意義。

The first thing that you need to know is how to move around from place
to place in the text. You already know how to move forward one screen,
with C-v. To move backwards one screen, type M-v (hold down the META key
and type v, or type <ESC>v if you do not have a META, EDIT, or ALT key).

首先你需要知道如何在文本中移動你已經(jīng)知道向前移動一個屏幕,用的是C-v测秸。向后移動需要按M-v(按住META鍵疤估,再按v,或者按<ESC>v 當你沒有META霎冯、ALT或者EDIT鍵時)

Try typing M-v and then C-v, a few times.

嘗試按M-v然后C-v铃拇,多試幾次
2018-07-16 01:29:04

It is ok to scroll this text in other ways, if you know how.

如果你知道的話,還可以使用其他方法翻頁

* SUMMARY總結


The following commands are useful for viewing screenfuls:

下列命令在屏幕切換時十分有用

C-v Move forward one screenful
M-v Move backward one screenful
C-l Clear screen and redisplay all the text,
moving the text around the cursor
to the center of the screen.
(That's CONTROL-L, not CONTROL-1.)

C-v 向下移動一個屏幕
M-v 向上移動一個屏幕
C-l 清屏沈撞,重新顯示所有的文本慷荔,
圍繞光標移動文本至屏幕中間
(注意是CONTROL-L不是CONTROL-1)

Find the cursor, and note what text is near it. Then type C-l.
Find the cursor again and notice that the same text is still near
the cursor, but now it is in the center of the screen.
If you press C-l again, this piece of text will move to the top of
the screen. Press C-l again, and it moves to the bottom.

找到光標,注意附近的文本缠俺。按C-l显晶。
再次找到光標,注意同樣的文本依然在光標附近壹士,但是現(xiàn)在已經(jīng)到屏幕中間了磷雇。
如果你再次按C-l,這段文本將會到達屏幕頂部
再次按C-l躏救,它將會移動到屏幕底部

You can also use the PageUp and PageDn keys to move by screenfuls, if
your terminal has them, but you can edit more efficiently if you use
C-v and M-v.

如果你的設備有PageUp或者PageDn按鍵唯笙,你也可以使用它們進行屏幕間的移動,但是你可以使用C-v和M-v更加高效地編輯

* BASIC CURSOR CONTROL 基本的光標控制


Moving from screenful to screenful is useful, but how do you
move to a specific place within the text on the screen?

屏幕之間的移動十分有用盒使,但是怎么移動到屏幕上的文本內(nèi)部指定位置處呢崩掘?

There are several ways you can do this. You can use the arrow keys,
but it's more efficient to keep your hands in the standard position
and use the commands C-p, C-b, C-f, and C-n. These characters
are equivalent to the four arrow keys, like this:


                        Previous line, C-p
                                  :
                                  :
   Backward, C-b .... Current cursor position .... Forward, C-f
                                  :
                                  :
                            Next line, C-n

有幾種方法可以實現(xiàn)。你可以使用箭頭按鍵少办,但是把你的手保持在鍵盤的標準位置苞慢,使用命令C-p,C-b,C-f,C-n更高效。這些字符等價于四個方向鍵凡泣,像這樣

               C-p 上一行
                  :
                  :
   C-b 后退 ....當前位置 .... C-f 前進
                  :
                  :
                C-n 下一行

Move the cursor to the line in the middle of that diagram
using C-n or C-p. Then type C-l to see the whole diagram
centered in the screen.

使用C-n和C-p將光標移動到圖表的中間行枉疼。按C-l將會發(fā)現(xiàn)圖表已經(jīng)在屏幕中央

You'll find it easy to remember these letters by words they stand for:
P for previous, N for next, B for backward and F for forward. You
will be using these basic cursor positioning commands all the time.

你會發(fā)現(xiàn)通過字母所代表的單詞記住這些字母十分容易:p代表Previous皮假,N代表Next,B代表backward骂维,F(xiàn)代表Forward惹资。
你將會頻繁使用這些基本的光標移動命令

Do a few C-n's to bring the cursor down to this line.

按幾次C-n 來向下移動幾行

Move into the line with C-f's and then up with C-p's.
See what C-p does when the cursor is in the middle of the line.

在行中使用C-f使光標前進幾個位置,然后使用C-p后退幾個位置

Each line of text ends with a Newline character, which serves to
separate it from the following line. (Normally, the last line in
a file will have a Newline at the end, but Emacs does not require it.)

每一行文本均以一個用于與下一行分離的換行符結尾航闺。(通常來說褪测,文件的末尾應該有一個新行,但是emacs不需要)

Try to C-b at the beginning of a line. It should move to
the end of the previous line. This is because it moves back
across the Newline character.

在行首試試C-b潦刃,光標將會移動到上一行末尾侮措,這是因為它跨過了換行符。

C-f can move across a Newline just like C-b.

C-f可以像C-b一樣跨過一個新行

Do a few more C-b's, so you get a feel for where the cursor is.
Then do C-f's to return to the end of the line.
Then do one more C-f to move to the following line.

嘗試幾次C-b乖杠,你就能感受到光標的位置分扎。
然后使用C-f 到達到行尾,再按一次C-f就能移動到下一行了

When you move past the top or bottom of the screen, the text beyond
the edge shifts onto the screen. This is called "scrolling". It
enables Emacs to move the cursor to the specified place in the text
without moving it off the screen.

當你移動的光標經(jīng)過屏幕頂部和底部胧洒,邊緣外的將會移動到屏幕內(nèi)畏吓,這就是滾動。滾動機制使得Emacs可以移動光標到文本指定的位置而不離開屏幕卫漫。

Try to move the cursor off the bottom of the screen with C-n, and
see what happens.

嘗試使用C-n移動光標直至越過屏幕底部邊緣菲饼,看看會發(fā)生什么

If moving by characters is too slow, you can move by words. M-f
(META-f) moves forward a word and M-b moves back a word.

如果覺得逐字符移動太慢,你可以逐個單詞移動列赎。M-f向前移動一個單詞宏悦,M-b向后移動一個單詞
(中文里面是移動到下一個標點符號的位置)

Type a few M-f's and M-b's.

按幾次M-f和M-b

When you are in the middle of a word, M-f moves to the end of the word.
When you are in whitespace between words, M-f moves to the end of the
following word. M-b works likewise in the opposite direction.

如果你在一個詞語的中央

Type M-f and M-b a few times, interspersed with C-f's and C-b's
so that you can observe the action of M-f and M-b from various
places inside and between words.

按幾次M-f和M-b,穿插使用C-f和C-b你就會發(fā)現(xiàn)M-f和M-b從多個位置表現(xiàn)出來的不同行為包吝。

Notice the parallel between C-f and C-b on the one hand, and M-f and
M-b on the other hand. Very often Meta characters are used for
operations related to the units defined by language (words, sentences,
paragraphs), while Control characters operate on basic units that are
of what you are editing (characters, lines, etc).

注意C-f饼煞,C-b和M-f,M-b之間的對比關系诗越,可以發(fā)現(xiàn)派哲,Meta字符通常用于語言定義的單元操作(單詞,句子掺喻,段落),而Control字符用于你正在編輯的基本的單元操作(字符储矩,行感耙,等等)

This parallel applies between lines and sentences: C-a and C-e move to
the beginning or end of a line, and M-a and M-e move to the beginning
or end of a sentence.

這樣的類比關系應用與行和句子時:C-a和C-e分別可以將光標移動到行首和行尾,而M-a和M-e可以將光標移動到行句首和句尾持隧。

Try a couple of C-a's, and then a couple of C-e's.
Try a couple of M-a's, and then a couple of M-e's.

嘗試幾次C-a然后使用幾次C-e
嘗試幾次M-a然后使用幾次M-e

See how repeated C-a's do nothing, but repeated M-a's keep moving one
more sentence. Although these are not quite analogous, each one seems
natural.

看重復的C-a沒有起作用即硼,而重復的M-a卻可以使光標可以不斷向上逐句移動。盡管這些不是完全相似屡拨,但是十分自然只酥。(規(guī)律之中總是有例外)

The location of the cursor in the text is also called "point". To
paraphrase, the cursor shows on the screen where point is located in
the text.

文本中光標的位置叫做點褥实,也就是屏幕上的光標在文本中的位置

Here is a summary of simple cursor-moving operations, including the
word and sentence moving commands:
C-f Move forward a character
C-b Move backward a character
M-f Move forward a word
M-b Move backward a word
C-n Move to next line
C-p Move to previous line
C-a Move to beginning of line
C-e Move to end of line
M-a Move back to beginning of sentence
M-e Move forward to end of sentence

以下是一個簡單的光標移動操作的總結,包括了單詞和句子移動命令裂允。
C-f 向前移動一個字符
C-b向后移動一個字符
M-f向前移動一個單詞(注意中文的特別之處损离,是移動一個標點)
M-b向后移動一個單詞
C-n向下移動一行
C-p向上移動一行
C-a移動到行首
C-e移動到行尾
M-a移動到段落的行首
M-e移動到段落的行尾



Try all of these commands now a few times for practice.
These are the most often used commands.

嘗試練習所有的命令幾次,這些是最頻繁使用的命令绝编。

Two other important cursor motion commands are M-< (META Less-than),
which moves to the beginning of the whole text, and M-> (META
Greater-than), which moves to the end of the whole text.

另外兩個重要的光標移動命令是M-<(Meta 小于號)移動到整段文檔的開始僻澎;M->(Meta 大于號)移動到整個文章的結尾

On most terminals, the "<" is above the comma, so you must use the
shift key to type it. On these terminals you must use the shift key
to type M-< also; without the shift key, you would be typing M-comma.

多數(shù)中終端,< 在逗號上面十饥,所以你必須同時使用shift窟勃,不然你使用的就是M-,了。

Try M-< now, to move to the beginning of the tutorial.
Then use C-v repeatedly to move back here.

現(xiàn)在嘗試M-<移動到教程的開始地方逗堵,然后多次使用C-v移動回來秉氧。

Try M-> now, to move to the end of the tutorial.
Then use M-v repeatedly to move back here.

現(xiàn)在嘗試M->移動到教程的結束地方,然后多次使用M-v移動回來蜒秤。

You can also move the cursor with the arrow keys, if your terminal has
arrow keys. We recommend learning C-b, C-f, C-n and C-p for three
reasons. First, they work on all kinds of terminals. Second, once
you gain practice at using Emacs, you will find that typing these Control
characters is faster than typing the arrow keys (because you do not
have to move your hands away from touch-typing position). Third, once
you form the habit of using these Control character commands, you can
easily learn to use other advanced cursor motion commands as well.

如果你的終端有箭頭鍵汁咏,你也可以使用它們移動光標。我們推薦學習C-b垦藏,C-f梆暖,C-n,和C-p有一下三點理由掂骏。一轰驳,所有終端均適用。第二弟灼,如果你熟練使用emacs你會發(fā)現(xiàn)使用這些控制鍵比使用箭頭更快级解。(因為你你的手不需要從打字區(qū)域離開)第三,一旦你養(yǎng)成使用組合按鍵的習慣田绑,你也可以輕松學習使用其他高級的光標移動命令勤哗。

Most Emacs commands accept a numeric argument; for most commands, this
serves as a repeat-count. The way you give a command a repeat count
is by typing C-u and then the digits before you type the command. If
you have a META (or EDIT or ALT) key, there is another, alternative way
to enter a numeric argument: type the digits while holding down the
META key. We recommend learning the C-u method because it works on
any terminal. The numeric argument is also called a "prefix argument",

because you type the argument before the command it applies to.

大多數(shù)Emacs命令可以接受數(shù)字參數(shù);對于大多數(shù)命令,這代表重復次數(shù)掩驱。給出命令重復次數(shù)的方法是芒划,在你輸入命令之前,輸入一個C-u加上數(shù)字欧穴。如果你有Meta按鍵民逼,還有一個用于輸入數(shù)字參數(shù)的可選的方法:按住Meta按鍵然后輸入數(shù)字。我們推薦使用C-u方法因為任何終端均可用涮帘。數(shù)字參數(shù)也叫“前綴變量”拼苍,因為這個參數(shù)是在命令執(zhí)行之前輸入的。

For instance, C-u 8 C-f moves forward eight characters.

例如:C-u 8 C-f 向前移動8個字符

Try using C-n or C-p with a numeric argument, to move the cursor
to a line near this one with just one command.

嘗試僅僅使用結合數(shù)字參數(shù)的C-n或者C-p一個命令來移動光標到達該行附近的行调缨。

Most commands use the numeric argument as a repeat count, but some
commands use it in some other way. Several commands (but none of
those you have learned so far) use it as a flag--the presence of a
prefix argument, regardless of its value, makes the command do
something different.

多數(shù)命令使用數(shù)字參數(shù)作為重復的次數(shù)疮鲫,但是一些命令將數(shù)字用作其他方式吆你。一些命令(但不在你目前已經(jīng)學到的命令之列)使用前綴參數(shù)作為標志--只要給出前綴參數(shù),不管值是多少俊犯,它都會使命令做不同的事情妇多。

C-v and M-v are another kind of exception. When given an argument,
they scroll the text up or down by that many lines, rather than by a
screenful. For example, C-u 8 C-v scrolls by 8 lines.

C-v 和 M-v 是另外一種特例,當給出一個參數(shù)瘫析,他們會上下移動相應行數(shù)而不是移動多個屏幕砌梆。例如C-u 8 C-v 向下移動8行

Try typing C-u 8 C-v now.
現(xiàn)在嘗試,輸入C-u 8 C-v

This should have scrolled the text up by 8 lines. If you would like
to scroll it down again, you can give an argument to M-v.
這個命令將會使文字向上滾動8行贬循。如果希望再向下滾動咸包,你可以把參數(shù)傳遞給M-v。

If you are using a graphical display, such as X or MS-Windows, there
should be a tall rectangular area called a scroll bar on one side of
the Emacs window. You can scroll the text by clicking the mouse in
the scroll bar.

如果你正在使用圖形化相顯示杖虾,例如X 或者MS-Windows烂瘫,Emacs窗口 的邊緣應該有一個長方形區(qū)域叫做滾動條。你可以在滾動條點擊來滾動 文本奇适。

If your mouse has a wheel button, you can also use this to scroll.
如果你的鼠標有一個滾輪坟比,你也可以使用滾輪來滾動文本

* IF EMACS STOPS RESPONDING (如果Emacs無響應)


If Emacs stops responding to your commands, you can stop it safely by
typing C-g. You can use C-g to stop a command which is taking too
long to execute.

如果Emacs對你的按鍵無相應,你可以通過輸入C-g安全地停止嚷往。你可以使用C-g停止執(zhí)行太久的命令葛账。

You can also use C-g to discard a numeric argument or the beginning of
a command that you do not want to finish.

你也可以在你想放棄一個命令的時候,使用C-g來丟棄一個數(shù)字參數(shù)或者已經(jīng)輸入的部分命令

Type C-u 100 to make a numeric argument of 100, then type C-g.
Now type C-f. It should move just one character, because you
canceled the argument with C-g.
If you have typed an <ESC> by mistake, you can get rid of it with a C-g.

輸入C-u 100來添加一個數(shù)字參數(shù)皮仁,然后輸入C-g〖眨現(xiàn)在輸入C-f,光標只移動一個字符贷祈,因為你使用C-g取消了參數(shù)

*DISABLED COMMANDS(禁用命令)


Some Emacs commands are "disabled" so that beginning users cannot use
them by accident.

為了防止新手誤觸趋急,一些Emacs命令是禁用的

If you type one of the disabled commands, Emacs displays a message
saying what the command was, and asking you whether you want to go
ahead and execute the command.
If you really want to try the command, type <SPC> (the Space bar) in
answer to the question. Normally, if you do not want to execute the
disabled command, answer the question with "n".

如果你輸入一個禁用的命令,Emacs會告訴你命令的詳情势誊,并詢問你是否繼續(xù)執(zhí)行命令呜达。如果你真的想執(zhí)行命令輸入SPACE響應詢問。如果你不想執(zhí)行禁用命令粟耻,使用n回復詢問即可查近。

Type C-x C-l (which is a disabled command),
then type n to answer the question.
輸入C-x C-l (這是一條禁用命令),然后輸入n回答問題
編輯 2018-7-17 16:08:52

  • WINDOWS(窗格)

Emacs can have several "windows", each displaying its own text. We
will explain later on how to use multiple windows. Right now we want
to explain how to get rid of extra windows and go back to basic
one-window editing. It is simple:
C-x 1 One window (i.e., kill all other windows).

Emacs可以有多個窗格(參考 孫一江 sunyijiang@gmail.com的翻譯挤忙,frame將會被翻譯為窗口嗦嗡,frame可以有多個窗格),每個顯示自己的內(nèi)容饭玲。我們稍后解釋如何使用多個窗格】巳模現(xiàn)在我們打算解釋如何避免多余的窗格和返回基本的單個窗格的編輯狀態(tài)扣唱。這很簡單:
C-x 1 一個窗格单匣,關閉其余的窗格

That is CONTROL-x followed by the digit 1. C-x 1 expands the window
which contains the cursor, to occupy the full screen. It deletes all
other windows.

這個命令是Control-x 加上數(shù)字1稠茂,C-x 1將包含光標的窗格拓展至全屏。這將會刪除其他的窗格次哈。

Move the cursor to this line and type C-u 0 C-l.
Type C-h k C-f.
See how this window shrinks, while a new one appears
to display documentation on the C-f command.

移動光標到這一行輸入C-u 0 C-l (這里顯然是零不是字母o)
輸入C-h k C-f
看窗格收縮了胎署,C-f 命令之后出現(xiàn)一個顯示文檔內(nèi)容的新窗格

Type C-x 1 and see the documentation listing window disappear.

There is a whole series of commands that start with CONTROL-x; many of
them have to do with windows, files, buffers, and related things.
These commands are two, three or four characters long.

emacs有一系列的以Control-x開始的命令。許多都和窗格窑滞,文件琼牧,緩沖,以及相關的東西哀卫。這些命令往往有2,3,或者4個字符巨坊。

* INSERTING AND DELETING(插入和刪除)


If you want to insert text, just type the text. Ordinary characters,
like A, 7, *, etc., are inserted as you type them. To insert a
Newline character, type <Return> (this is the key on the keyboard
which is sometimes labeled "Enter").

如果你想插入文本,那輸入就行了此改。普通的字符如A,7趾撵,*等等,會原封不動地插入共啃。如果想輸入一個換行符占调,按一下<ENTER>即可

To delete the character immediately before the current cursor
position, type <DEL>. This is the key on the keyboard usually labeled
"Backspace"--the same one you normally use, outside Emacs, to delete
the last character typed.

如果要立即刪除光標前的字符,按<DEL>鍵移剪。這個鍵在鍵盤上通常標注為Backspace--這個鍵和你在Emacs外通常使用的用于刪除最后輸入的字符的按鍵是一樣的究珊。

There may also be another key on your keyboard labeled <Delete>, but
that's not the one we refer to as <DEL>.

鍵盤上可能有另外一個鍵標注為<Delete>,但是這個按鍵不是我們所說的<DEL>

Do this now--type a few characters, then delete them by
typing <DEL> a few times. Don't worry about this file
being changed; you will not alter the master tutorial.

This is your personal copy of it.

試試這個:
輸入一些字符,然后通過多次按<DEL>刪除它們纵苛。不要擔心文件內(nèi)容被改變剿涮;這個是一份你的個人拷貝。

When a line of text gets too big for one line on the screen, the line
of text is "continued" onto a second screen line. If you're using a
graphical display, little curved arrows appear in the narrow spaces on
each side of the text area (the left and right "fringes"), to indicate
where a line has been continued. If you're using a text terminal, the
continued line is indicated by a backslash ('') on the rightmost
screen column.

當一行文本過長超出屏幕上的一行時赶站,之后的文本將會被屏幕上的第二行“繼續(xù)”幔虏。如果你正在使用圖形化的顯示,一個表示一行被中繼的彎曲的小箭頭將會出現(xiàn)在文本區(qū)域的兩邊的狹窄區(qū)域(文本和屏幕邊界的空白區(qū)域)贝椿。如果你使用的是文本終端想括,中繼行將會在最末尾使用反斜杠("")標注。

Insert text until you reach the right margin, and keep on inserting.
You'll see a continuation line appear.

插入文本直到右邊的邊緣烙博,繼續(xù)插入你會看到一個中繼行的出現(xiàn)瑟蜈。

Use <DEL>s to delete the text until the line fits on one screen
line again. The continuation line goes away.

使用<Del>刪除文本直至行完全充滿屏幕中的一行,中繼行就消失了

You can delete a Newline character just like any other character.
Deleting the Newline character between two lines merges them into
one line. If the resulting combined line is too long to fit in the
screen width, it will be displayed with a continuation line.

你可以像刪除任意字符一樣刪除一個換行符渣窜。刪除兩行之間的換行符將會合并兩行铺根。如果合并導致行超過屏幕的最大行長度,將會以中繼行的形式顯示乔宿。

Move the cursor to the beginning of a line and type <DEL>. This
merges that line with the previous line.

將光標移動到行的開始然后輸入<Del>.這將合并該行和之前的行位迂。

Type <Return> to reinsert the Newline you deleted.

輸入<Return> 插入你刪除的新行

The <Return> key is special, in that pressing it may do more than
just insert a Newline character. Depending on the surrounding text,
it may insert whitespace after the Newline character, so that when
you start typing on the newly created line, the text lines up with
that on the previous line. We call this behavior (where pressing a
key does more than simply inserting the relevant character) "electric".

<Return>鍵比較特殊,按下將會不止插入一個換行符。取決于周圍的文本內(nèi)容掂林,它可能在換行符后插入空白內(nèi)容臣缀,這樣一來你輸入的時候行會自動與上一行對齊。我們把這種行為(按下一個鍵輸入的不只相關字符)叫做自動縮進泻帮。

Here is an example of <Return> being electric.
Type <Return> at the end of this line.

這是一個<Return>自動縮進的例子精置。嘗試行尾按下<Return>。

You should see that after inserting the Newline, Emacs inserts spaces
so that the cursor moves under the "T" of "Type".

你應該發(fā)現(xiàn)了锣杂,在插入新行之后脂倦,Emacs插入空格,所以光標移動到了‘TYPE’的‘T’下面元莫。

Remember that most Emacs commands can be given a repeat count;
this includes text characters. Repeating a text character inserts
it several times.

記住大多數(shù)的Emacs命令可以添加重復次數(shù)赖阻,這也包含文本字符。重復插入幾次文本字符

Try that now -- type C-u 8 * to insert ********.

嘗試輸入C-u 8 * 插入 ********

You've now learned the most basic way of typing something in
Emacs and correcting errors. You can delete by words or lines
as well. Here is a summary of the delete operations:

<DEL>        Delete the character just before the cursor
C-d          Delete the next character after the cursor

M-<DEL>      Kill the word immediately before the cursor
M-d      Kill the next word after the cursor

C-k      Kill from the cursor position to end of line
M-k      Kill to the end of the current sentence

你已經(jīng)學習了使用Emacs最基本的編輯方法以及檢錯方法柒竞。你可以按詞刪除也能按行刪除政供。下面是一些刪除的操作總結。
del 刪除光標前的一個字符
C-d移除光標后一個字符
M-del 移除光標前一個詞
M-d 移除光標后一個詞
C-k從光標處移除至行尾
M-k從光標處移除至當前句子尾

Notice that <DEL> and C-d vs M-<DEL> and M-d extend the parallel
started by C-f and M-f (well, <DEL> is not really a control character,
but let's not worry about that). C-k and M-k are like C-e and M-e,
sort of, in that lines are paired with sentences.

注意<Del>和C-d與M-<del>和M-d延續(xù)了C-f和M-f開啟的類比關系(雖然del不是一個真正的控制字符朽基,但是請忽略這點)C-k和M-k有點像C-e和M-e布隔,都是一個針對行操作,一個針對句子操作稼虎。

You can also kill a segment of text with one uniform method. Move to
one end of that part, and type C-<SPC>. (<SPC> is the Space bar.)
Next, move the cursor to the other end of the text you intend to kill.
As you do this, Emacs highlights the text between the cursor and the
position where you typed C-<SPC>. Finally, type C-w. This kills all
the text between the two positions.

你可以使用通用的方法殺掉一段文本(清除緩沖區(qū)中的內(nèi)容)衅檀。將光標移動到目標文本的一端,輸入C-SPACE霎俩。然后將光標移動到你想刪除的文本的另外一端哀军。之后,Emacs會著重標記你按C-SPACE的地方到當前光標位置之間的文本內(nèi)容打却。然后輸入C-W即可清空至你輸入C-SPACE位置的內(nèi)容杉适。

Move the cursor to the Y at the start of the previous paragraph.
移動光標到段落開始處的Y字母
Type C-<SPC>. Emacs should display a message "Mark set"
at the bottom of the screen.

輸入C-space emacs會在屏幕底部顯示一條"Mark Set"的信息。

Move the cursor to the n in "end", on the second line of the
paragraph.

移動光標到段落第二行的"end"中的"n"處

Type C-w. This will kill the text starting from the Y,
and ending just before the n.

然后輸入C-w柳击。這將會移除從Y開始直到n前面一個字符的文本猿推。

The difference between "killing" and "deleting" is that "killed" text
can be reinserted (at any position), whereas "deleted" things cannot
be reinserted in this way (you can, however, undo a deletion--see
below). Reinsertion of killed text is called "yanking". (Think of it
as yanking back, or pulling back, some text that was taken away.)
Generally, the commands that can remove a lot of text kill the text
(they are set up so that you can yank the text), while the commands
that remove just one character, or only remove blank lines and spaces,
do deletion (so you cannot yank that text). <DEL> and C-d do deletion
in the simplest case, with no argument. When given an argument, they
kill instead.

移除和刪除的區(qū)別在于移除的文本可以再次插入而刪除的文本無法插入,除非你撤銷刪除的操作捌肴。重新插入移除的文本叫做召回蹬叭。通常能夠清除大量文本的命令都只是移除文本,而清除單個字符或者空行状知、空格的命令是真正的刪除.<Del>和C-d沒有參數(shù)秽五,是最簡單的刪除方式。如果加上參數(shù)饥悴,他們將變成移除操作坦喘。

Move the cursor to the beginning of a line which is not empty.
Then type C-k to kill the text on that line.

將光標移動到一個非空行的開頭盲再,輸入C-k以清除該行的內(nèi)容。

Type C-k a second time. You'll see that it kills the Newline
which follows that line.

再輸入一次C-k瓣铣。你會發(fā)現(xiàn)它移除了上一行之后的一行內(nèi)容洲胖。

Note that a single C-k kills the contents of the line, and a second
C-k kills the line itself, and makes all the other lines move up. C-k
treats a numeric argument specially: it kills that many lines AND
their contents. This is not mere repetition. C-u 2 C-k kills two
lines and their Newlines; typing C-k twice would not do that.

注意單個C-k移除整行的內(nèi)容,第二個C-k清除換行符坯沪,下文的行均依次上移。C-k命令對待數(shù)字參數(shù)比較特殊:它移除很多行和他們的內(nèi)容擒滑。但是這不僅僅是重復操作腐晾。C-u 2 C-k移除兩行,但是輸入兩次C-k效果可不是這樣丐一。

You can yank the killed text either at the same place where it was
killed, or at some other place in the text you are editing, or even in
a different file. You can yank the same text several times; that
makes multiple copies of it. Some other editors call killing and
yanking "cutting" and "pasting" (see the Glossary in the Emacs
manual).

你可以在移除文本的地方或者在其他地方:如文本中的其他位置甚至其他文件里面藻糖,召回移除的文本。你可以召回同樣的文本多次库车;這將會將文本做多份拷貝巨柒。一些別的編輯器把移除和召回叫做剪切和粘貼。

The command for yanking is C-y. It reinserts the last killed text,
at the current cursor position.

召回的命令是C-y柠衍。這個命令會將移除的文本插入到當前光標所在位置洋满。

Try it; type C-y to yank the text back.

試試用C-y把文本召回。

If you do several C-k's in a row, all of the killed text is saved
together, so that one C-y will yank all of the lines at once.

如果你在一行中多次輸入C-k命令珍坊,所有的移除文本都保存在一起牺勾,所以C-y將會把這些行一次性全部召回。

Do this now, type C-k several times.

試試幾次C-k吧阵漏,
Now to retrieve that killed text:

Type C-y. Then move the cursor down a few lines and type C-y
again. You now see how to copy some text.

輸入C-y驻民。然后將光標下移幾行再次輸入C-y。你現(xiàn)在看到的就是如何復制文本履怯。

What do you do if you have some text you want to yank back, and then
you kill something else? C-y would yank the more recent kill. But
the previous text is not lost. You can get back to it using the M-y
command. After you have done C-y to get the most recent kill, typing
M-y replaces that yanked text with the previous kill. Typing M-y
again and again brings in earlier and earlier kills. When you have
reached the text you are looking for, you do not have to do anything to
keep it. Just go on with your editing, leaving the yanked text where
it is.

如果你有一些內(nèi)容想召回回还,然后移除一些別的內(nèi)容,你會怎么做叹洲?C-y將會召回更多近期的移除內(nèi)容柠硕。但是以前的文本沒有丟失。你可以使用M-y返回疹味。當你使用C-y召回最近的移除時仅叫,輸入M-y代替可以召回上一次移除的內(nèi)容。再次反復輸入M-y可以將此前一次次的移除召回糙捺。但你召回了你想要的文本時诫咱,你不需要做任何的保存操作,讓召回的文本在原處洪灯,繼續(xù)編輯即可坎缭。

If you M-y enough times, you come back to the starting point (the most
recent kill).

如果你M-y連續(xù)使用很多次竟痰,你可以回到最近移除的起點。(環(huán)形)

Kill a line, move around, kill another line.
Then do C-y to get back the second killed line.
Then do M-y and it will be replaced by the first killed line.
Do more M-y's and see what you get. Keep doing them until
the second kill line comes back, and then a few more.
If you like, you can try giving M-y positive and negative
arguments.

移除一行掏呼,移動光標坏快,移除另外一行。然后使用C-y召回第二次被移除的行憎夷,使用M-y將會替換成為第一次移除的行莽鸿。多試幾次看看你的效果。繼續(xù)操作直至第二次移除的文本回來拾给。如果你喜歡祥得,你可以給M-y一個正的或者負的參數(shù)。

  • UNDO(撤銷)

If you make a change to the text, and then decide that it was a
mistake, you can undo the change with the undo command, C-/.

如果你在對文本做了更改之后發(fā)現(xiàn)誤操作了蒋得,你可以使用撤銷命令 C-/

Normally, C-/ undoes the changes made by one command; if you repeat
C-/ several times in a row, each repetition undoes one more command.

C-/ 可以撤銷一個命令造成的改變级及。如果你在一行中多次使用C-/,以前的命令也會相繼撤銷额衙。

But there are two exceptions: commands that do not change the text
don't count (this includes cursor motion commands and scrolling
commands), and self-inserting characters are usually handled in groups
of up to 20. (This is to reduce the number of C-/'s you have to type
to undo insertion of text.)

但是有兩個例外:不改變文本的命令不算(包括光標移動和滾動命令)饮焦;鍵盤輸入的字符通常以組的形式存在--每組的命令為20個(減少你在撤銷插入操作時候 的輸入)

Kill this line with C-k, then type C-/ and it should reappear.

使用C-k移除行,然后輸入C-/窍侧,行將會恢復

C-_ is an alternative undo command; it works exactly the same as C-/.
On some text terminals, typing C-/ actually sends C-_ to Emacs.
Alternatively, C-x u also works exactly like C-/, but is a little less
convenient to type.

C-_ 是一個可選的撤銷命令县踢;它和C-/基本一致。在某些文本終端里疏之,輸入C-/通常會向Emacs發(fā)送C-_殿雪。此外,C-u x和C-/基本也一樣锋爪,但是不好按丙曙。

A numeric argument to C-/, C-_, or C-x u acts as a repeat count.

數(shù)字參數(shù)對于C-/,C-_或者C-x u意味著重復其骄。

You can undo deletion of text just as you can undo killing of text.
The distinction between killing something and deleting it affects
whether you can yank it with C-y; it makes no difference for undo.

你可以撤銷文本的刪除操作正如你撤銷移除文本的命令亏镰。移除和刪除影響你能否使用C-y召回;但是對于撤銷來說沒有區(qū)別拯爽。

  • FILES(文件)

In order to make the text you edit permanent, you must put it in a
file. Otherwise, it will go away when you exit Emacs. In order to
put your text in a file, you must "find" the file before you enter the
text. (This is also called "visiting" the file.)

為了創(chuàng)建你可以持續(xù)編輯的文本索抓,你必須把它放到一個文件里面。否則毯炮,你離開emacs之后文本將不會被保存逼肯。為了把文本放到文件里面,你必須在你輸入文本之前找到文件桃煎。(這個也叫訪問文件)

Finding a file means that you see the contents of the file within
Emacs. In many ways, it is as if you were editing the file itself.
However, the changes you make using Emacs do not become permanent
until you "save" the file. This is so you can avoid leaving a
half-changed file on the system when you do not want to. Even when
you save, Emacs leaves the original file under a changed name in case
you later decide that your changes were a mistake.

找到文件意味著你能在emacs里面看到文件的內(nèi)容篮幢。很多情況下好像你在編輯文本本身。然而你所做的改變在你保存之前都不會被輸出到文件为迈。這樣你就能避免在系統(tǒng)中留存一個你不想的臨時文件三椿。即便在你保存的時候缺菌,emacs會留下一個改變名稱的原始文件以防止你之后發(fā)現(xiàn)之前的修改是錯誤的,為你留下后悔藥搜锰。

If you look near the bottom of the screen you will see a line that
begins with dashes, and starts with " -:--- TUTORIAL" or something
like that. This part of the screen normally shows the name of the
file that you are visiting. Right now, you are visiting your personal
copy of the Emacs tutorial, which is called "TUTORIAL". When you find
a file with Emacs, that file's name will appear in that precise spot.

屏幕底部附近有一行以短橫開始的如以 “--:--- TUTORIAL” 或者 別的其他內(nèi)容伴郁。這部分屏幕內(nèi)容 顯示了你正在訪問的文件名稱 。現(xiàn)在你正在訪問叫做TUTORIAL的Emacs教程的一個 副本 蛋叼。當你發(fā)現(xiàn)使用Emacs訪問一個文件時焊傅,文件名稱將會出現(xiàn)在那個位置。

One special thing about the command for finding a file is that you
have to say what file name you want. We say the command "reads an
argument" (in this case, the argument is the name of the file). After
you type the command
關于訪問文件命令狈涮,你必須指明文件名稱租冠。我們將這個命令稱作讀取參數(shù)(此時參數(shù)是文件名)。在你輸入命令:
C-x C-f Find a file( C-x C-f訪問一個 文件)

Emacs asks you to type the file name. The file name you type appears
on the bottom line of the screen. The bottom line is called the
minibuffer when it is used for this sort of input. You can use
ordinary Emacs editing commands to edit the file name.

Emacs 將會讓你輸入文件名稱

While you are entering the file name (or any minibuffer input),
you can cancel the command with C-g.

當你輸入文件名(或者進行其他任何小緩沖區(qū)的輸入時)你可以使用C-g取消輸入

Type C-x C-f, then type C-g. This cancels the minibuffer,
and also cancels the C-x C-f command that was using the
minibuffer. So you do not find any file.

輸入C-x C-f薯嗤,然后輸入C-g。這將清空小緩沖區(qū)的內(nèi)容同時取消正在使用小緩沖區(qū)C-x C-f命令纤泵。所以你看不到任何文件

When you have finished entering the file name, type <Return> to
terminate it. The minibuffer disappears, and the C-x C-f command goes
to work to find the file you chose.

當你輸完文件名稱骆姐,按下回車鍵結束輸入。小緩沖區(qū)消失啦捏题,C-x C-f命令開始訪問你輸入的文件玻褪。

The file contents now appear on the screen, and you can edit the
contents. When you wish to make your changes permanent, type the
command
C-x C-s Save the file

屏幕上開始顯示文件的內(nèi)容,你可以編輯它公荧。如果想讓更改生效带射,輸入C-x C-s 命令

This copies the text within Emacs into the file. The first time you
do this, Emacs renames the original file to a new name so that it is
not lost. The new name is made by adding "~" to the end of the
original file's name. When saving is finished, Emacs displays the
name of the file written.

這將會把Emacs的內(nèi)容寫入文件中。你第一次這樣做的時候循狰,emacs將會把原文件更名為原名稱尾部加上~以確保文件內(nèi)容不會丟失窟社。當保存完成,emacs將會顯示寫入的文件名绪钥。

Type C-x C-s TUTORIAL <Return>.
This should save this tutorial to a file named TUTORIAL, and show
"Wrote ...TUTORIAL" at the bottom of the screen.

輸入C-x C-s TUTORIAL <Return>. 這個命令將會把這個教程保存到一個名為 TUTORIAL的文件中然后在屏幕底部顯示寫入...TUTORIAL灿里。

You can find an existing file, to view it or edit it. You can also
find a file which does not already exist. This is the way to create a
file with Emacs: find the file, which starts out empty, and then begin
inserting the text for the file. When you ask to "save" the file,
Emacs actually creates the file with the text that you have inserted.
From then on, you can consider yourself to be editing an already
existing file.

你可以訪問一個已經(jīng)存在的文件,查看或者編輯它程腹。你也能訪問一個不存在的文件匣吊。使用Emacs創(chuàng)建新文件的方法:訪問一個空文件,然后為其插入內(nèi)容寸潦。當你請求保存文件時色鸳,Emacs才用你插入的文本內(nèi)容創(chuàng)建文件。以后你就能考慮編輯一個已經(jīng)存在的文件了见转。

  • BUFFERS(緩沖)

If you find a second file with C-x C-f, the first file remains
inside Emacs. You can switch back to it by finding it again with
C-x C-f. This way you can get quite a number of files inside Emacs.

如果你想使用C-x C-f再打開一個文件,第一個文件將會保存在緩沖區(qū)里面命雀。你可以用C-x C-f再次訪問它。這種方法使你能夠在Emacs里面獲取很多文件

Emacs stores each file's text inside an object called a "buffer".
Finding a file makes a new buffer inside Emacs. To see a list of the
buffers that currently exist, type
C-x C-b List buffers

Emacs 將每個文件的文本存放在一個叫緩沖區(qū)的區(qū)域內(nèi)池户。訪問一個新的文件將會在Emacs中創(chuàng)建新的緩沖區(qū)咏雌。想要查看現(xiàn)存的緩沖區(qū)列表凡怎,輸入命令
C-x C-b 列出緩沖區(qū)

Try C-x C-b now.

現(xiàn)在就來試試C-x C-b吧

See how each buffer has a name, and it may also have a file name for
the file whose contents it holds. ANY text you see in an Emacs window
is always part of some buffer.

每個緩沖區(qū)都有自己的名字,還可能有一個對應內(nèi)容的目標文件名稱赊抖。你在Emacs里面看到的任何文本都是某個緩沖區(qū)的一部分统倒。

Type C-x 1 to get rid of the buffer list.

輸入C-x 1 來還原一個窗格的頁面

When you have several buffers, only one of them is "current" at any
time. That buffer is the one you edit. If you want to edit another
buffer, you need to "switch" to it. If you want to switch to a buffer
that corresponds to a file, you can do it by visiting the file again
with C-x C-f. But there is an easier way: use the C-x b command.
In that command, you have to type the buffer's name.

如果擁有幾個緩沖區(qū),同一時刻只能有一個是你當前正在被編輯的緩沖區(qū)氛雪。如果想編輯另外一個緩沖區(qū)房匆,你需要切換。如果想切換至對應某個文件的緩沖區(qū)报亩,你可以通過輸入C-x C-f訪問那個文件浴鸿。但是有一個更簡單的方法:使用C-x b命令,這一命令中你必須輸入緩沖區(qū)的名稱弦追。

Create a file named "foo" by typing C-x C-f foo <Return>.
Then type C-x b TUTORIAL <Return> to come back to this tutorial.

通過C-x C-f foo <Return>命令創(chuàng)建一個名為foo的文件岳链。然后輸入C-x b TUTORIAL <Return> 即可返回該教程。

Most of the time, the buffer's name is the same as the file name
(without the file directory part). However, this is not always true.
The buffer list you make with C-x C-b shows you both the buffer name
and the file name of every buffer.

通常緩沖區(qū)的名稱和文件名相同劲件,不包括文件的路徑部分掸哑。然而,也不總是這樣零远。使用C-x C-b列出的緩沖區(qū)表會顯示緩沖區(qū)的名字和文件名苗分。

Some buffers do not correspond to files. The buffer named
"Buffer List", which contains the buffer list that you made with
C-x C-b, does not have any file. This TUTORIAL buffer initially did
not have a file, but now it does, because in the previous section you
typed C-x C-s and saved it to a file.

某些緩沖區(qū)沒有文件與之對應。緩沖區(qū)叫做緩沖區(qū)表牵辣,包含使用C-x C-b創(chuàng)建的緩沖區(qū)摔癣,但是沒有任何文件。這個教程的緩沖區(qū)一開始沒有文件纬向,但是現(xiàn)在有了择浊,因為上一節(jié)里面你使用C-x C-s來存盤了。

The buffer named "Messages" also does not correspond to any file.
This buffer contains the messages that have appeared on the bottom
line during your Emacs session.

名為Messages的緩沖區(qū)也不對應任何文件逾条,在Emacs會話中近她,這個緩沖區(qū)的緩沖區(qū)將會在最后一行顯示信息。

Type C-x b Messages <Return> to look at the buffer of messages.
Then type C-x b TUTORIAL <Return> to come back to this tutorial.

輸入C-x b Messages <Return> 查看消息的緩沖區(qū)膳帕。然后輸入Then type C-x b TUTORIAL <Return>返回該教程粘捎。

If you make changes to the text of one file, then find another file,
this does not save the first file. Its changes remain inside Emacs,
in that file's buffer. The creation or editing of the second file's
buffer has no effect on the first file's buffer. This is very useful,
but it also means that you need a convenient way to save the first
file's buffer. Having to switch back to that buffer, in order to save
it with C-x C-s, would be a nuisance. So we have
C-x s Save some buffers

如果你對一個文件的文本做了改動,然后去訪問另外一個文件危彩,第一個文件將不會保存攒磨。文件內(nèi)容的變動依然在Emacs里面的那個文件的緩沖區(qū)里。第二個文件的創(chuàng)建和編輯對第一個文件緩沖區(qū)的內(nèi)容毫無影響汤徽。這種機制十分有用娩缰,但是也意味著你需要一個更加便捷的方法去保存第一個文件的緩沖區(qū)。切換到那個緩沖區(qū)之后谒府,用C-x C-s保存文件有些累贅拼坎,所以我們使用C-x s保存緩沖區(qū)浮毯。

C-x s asks you about each buffer which contains changes that you have
not saved. It asks you, for each such buffer, whether to save the
buffer.

C-x 將會詢問你哪些緩沖區(qū)保存,以及對應的緩沖區(qū)是否需要保存泰鸡。

Insert a line of text, then type C-x s.
It should ask you whether to save the buffer named TUTORIAL.
Answer yes to the question by typing "y".

插入一行然后輸入C-x s 债蓝。Emacs會詢問你是否需要把緩沖區(qū)保存到TUTORIAL。如果是請輸入一個y盛龄。

  • EXTENDING THE COMMAND SET (拓展命令集)

There are many, many more Emacs commands than could possibly be put
on all the control and meta characters. Emacs gets around this with
the X (eXtend) command. This comes in two flavors:
C-x Character eXtend. Followed by one character.
M-x Named command eXtend. Followed by a long name.

Emacs 有很多很多可以放在control和meta鍵上的命令饰迹。Emacs使用拓展命令解決這個問題。拓展命令有一下兩種形式:
C-x 字符拓展余舶,命令后緊跟一個字符
M-x 名稱拓展啊鸭,命令后緊跟一個長名字

These are commands that are generally useful but are used less than the commands you have already learned about. You have already seen a few of them: the file commands C-x C-f to Find and C-x C-s to Save, for
example. Another example is the command to end the Emacs
session--this is the command C-x C-c. (Do not worry about losing
changes you have made; C-x C-c offers to save each changed file before
it kills Emacs.)

有一些十分有用的命令,但是使用頻率低于你已經(jīng)學到的命令匿值。你已經(jīng)涉及到了一些赠制,比如:
文件查找命令 C-x C-f
文件保存命令C-x C-s
另外的例子如:結束Emacs會話的命令C-x C-c(不要擔心丟失你做出的更改,C-x C-c會在關閉之前詢問是否保存更改的文件)

If you are using a graphical display, you don't need any special
command to move from Emacs to another application. You can do this
with the mouse or with window manager commands. However, if you're
using a text terminal which can only show one application at a time,
you need to "suspend" Emacs to move to any other application.

如果你正在使用圖形化顯示挟憔,你不需要任何特別的命令從Emacs移動到另一個應用憎妙,你可以使用鼠標或者窗口管理命令∏可是如果你使用的是每次只能展示一個應用的文本終端,你需要掛起Emacs以便能夠切換到其他應用褥符。

C-z is the command to exit Emacs temporarily--so that you can go
back to the same Emacs session afterward. When Emacs is running on a
text terminal, C-z "suspends" Emacs; that is, it returns to the shell
but does not destroy the Emacs job. In the most common shells, you
can resume Emacs with the "fg" command or with "%emacs".

C-z 是臨時退出Emacs的命令龙誊,這樣之后你就能回到同一個Emacs會話。當Emacs運行于文本終端的時候C-z掛起Emacs

The time to use C-x C-c is when you are about to log out. It's also
the right thing to use to exit an Emacs invoked for a quick edit, such
as by a mail handling utility.

當你打算退出喷楣,正是時候使用C-x C-c了趟大。這也是退出為快速編輯如郵件處理應用而調(diào)用的Emacs正確的方法
There are many C-x commands. Here is a list of the ones you have learned:
C-x開始的命令有很多欣簇。下面是你已經(jīng)學到的命令的列表乡革。
C-x C-f Find file 訪問文件
C-x C-s Save file 保存文件
C-x s Save some buffers 保存緩沖區(qū)
C-x C-b List buffers 列出緩沖區(qū)
C-x b Switch buffer 切換緩沖區(qū)
C-x C-c Quit Emacs 退出Emacs
C-x 1 Delete all but one window 刪除其余窗格紧憾,只留一個
C-x u Undo 撤銷

Named eXtended commands are commands which are used even less
frequently, or commands which are used only in certain modes. An
example is the command replace-string, which replaces one string with
another in the buffer. When you type M-x, Emacs prompts you at the
bottom of the screen with M-x and you should type the name of the
command; in this case, "replace-string". Just type "repl s<TAB>" and
Emacs will complete the name. (<TAB> is the Tab key, usually found
above the CapsLock or Shift key near the left edge of the keyboard.)
Submit the command name with <Return>.

命名的拓展命令的使用通常不那么頻繁或者僅僅用于某些模式下雳锋。一個例子是替換字符串命令勋陪,就是在緩沖區(qū)里面將一個字符串替換成另一個谆棱。當你輸入M-x拟蜻,Emacs會在屏幕底部顯示M-x便瑟,提醒你應該輸入命令的名稱坟募。岛蚤;這時替換字符串,只需要輸入repl s<Tab>,Emacs 將會自動補全命令懈糯。使用<Return>使命令生效涤妒。

The replace-string command requires two arguments--the string to be
replaced, and the string to replace it with. You must end each
argument with <Return>.

替換字符串命令需要兩個參數(shù)--源字符串和目標字符串。你必須使用<Return>終結每個參數(shù)的輸入赚哗。

Move the cursor to the blank line two lines below this one.
Then type M-x repl s<Tab>changed<Return>altered<Return>.

移動光標到該行下兩行的空行她紫,依次輸入M-x repl s<Tab> changed<Return> altered <Return>

Notice how this line has changed: you've replaced the word
"changed" with "altered" wherever it occurred, after the
initial position of the cursor.

注意行怎么改變的:將文章中所有的在最初光標位置之后出現(xiàn)的單詞Changed 改成altered

  • AUTO SAVE(自動保存)

When you have made changes in a file, but you have not saved them yet,
they could be lost if your computer crashes. To protect you from
this, Emacs periodically writes an "auto save" file for each file that
you are editing. The auto save file name has a # at the beginning and
the end; for example, if your file is named "hello.c", its auto save
file's name is "#hello.c#". When you save the file in the normal way,
Emacs deletes its auto save file.

當你在文件中做了更改硅堆,但是還沒保存的時候,如果電腦崩潰贿讹,更改可能就丟失了渐逃。為了防止這種事情的發(fā)生,Emacs 周期性地將你正在編輯的文件寫入一個自動保存的文件围详。自動保存的文件名首尾均有一個#符號朴乖。例如你的"hello.c"文件,自動保存的文件名就是"#hello.c#"。如果使用常規(guī)保存助赞,臨時文件將會被刪除

If the computer crashes, you can recover your auto-saved editing by
finding the file normally (the file you were editing, not the auto
save file) and then typing M-x recover-this-file <Return>. When it
asks fo confirmation, type yes<Return> to go ahead and recover the
auto-save data.

如果計算機崩潰买羞,你可以通過正常查找文件恢復你自動保存的編輯(你過去編輯的文件不是自動保存的文件)然后輸入M-x recover-this-file <Return>.當詢問確認時,輸入yes<Return>繼續(xù)雹食,恢復自動保存的數(shù)據(jù)畜普。

  • ECHO AREA(回顯區(qū)域)

If Emacs sees that you are typing multicharacter commands slowly, it
shows them to you at the bottom of the screen in an area called the
"echo area". The echo area contains the bottom line of the screen.

如果Emcas發(fā)現(xiàn)你十分緩慢地編輯多字符的命令時,它將會在屏幕底部的回顯區(qū)域顯他們群叶〕蕴簦回顯區(qū)域包含屏幕底的一行。

  • MODE LINE(模式行)

The line immediately above the echo area is called the "mode line".
The mode line says something like this:

緊鄰回顯區(qū)域的上面一行叫做模式行街立。這一行顯示的信息大概如下:

-:**- TUTORIAL 63% L749 (Fundamental)

This line gives useful information about the status of Emacs and
the text you are editing.

這一行顯示了Emacs的狀態(tài)信息以及你正在編輯的文本的信息

You already know what the filename means--it is the file you have
found. NN% indicates your current position in the buffer text; it
means that NN percent of the buffer is above the top of the screen.
If the top of the buffer is on the screen, it will say "Top" instead
of " 0%". If the bottom of the buffer is on the screen, it will say
"Bot". If you are looking at a buffer so small that all of it fits on
the screen, the mode line says "All".

你已經(jīng)知道文件名意味著:這是你正在訪問的文件名舶衬。NN%表明了你當前光標在緩沖區(qū)中的位置。

The L and digits indicate position in another way: they give the
current line number of point.

L和數(shù)字表明以另外的方式顯示位置:他們給出當前的行號赎离。

The stars near the front mean that you have made changes to the text.

Right after you visit or save a file, that part of the mode line shows
no stars, just dashes.

模式行前面的星號表示你對文本已經(jīng)做出了更改逛犹。你訪問或者保存一個文件之后,這個星號就會消失梁剔,只顯示一個短橫線

The part of the mode line inside the parentheses is to tell you what
editing modes you are in. The default mode is Fundamental which is
what you are using now. It is an example of a "major mode".
模式行中的括號里面的內(nèi)容告訴你所處的模式虽画。默認的模式是你正在使用的Fundamental。這是一個Major 模式的例子
Emacs has many different major modes. Some of them are meant for
editing different languages and/or kinds of text, such as Lisp mode,
Text mode, etc. At any time one and only one major mode is active,
and its name can always be found in the mode line just where
"Fundamental" is now.

Emacs 有不同的Major模式荣病。一些用于編輯不同的語言或者不同的文本類型码撰,如Lisp模式,文本模式个盆,等等脖岛。但是任何時刻只能有一個major模式處于激活狀態(tài),模式的名稱將會出現(xiàn)在目前的Fundamental的位置颊亮。

Each major mode makes a few commands behave differently. For example,
there are commands for creating comments in a program, and since each
programming language has a different idea of what a comment should
look like, each major mode has to insert comments differently. Each
major mode is the name of an extended command, which is how you can
switch to that mode. For example, M-x fundamental-mode is a command to
switch to Fundamental mode.

每一個Major模式都有一些特別的不同命令.例如一些命令用于在程序中創(chuàng)建注釋鸡岗,而不同的編程語言的注釋方式形式不一樣,每一major模式不得不以不同的方式插入注釋编兄。每個major模式都是一個拓展命令的名字轩性,因此可以通過相應命令切換至某一模式。例如,M-x fundamental-mode 是切換至Fundamental模式的命令揣苏。

If you are going to be editing human-language text, such as this file, you
should probably use Text Mode.

如果你打算編輯像這樣一篇人可讀的文本那你應該使用Text模式

Type M-x text-mode <Return>.

輸入M-x text-mode <return>試試看吧

Don't worry, none of the Emacs commands you have learned changes in
any great way. But you can observe that M-f and M-b now treat
apostrophes as part of words. Previously, in Fundamental mode,
M-f and M-b treated apostrophes as word-separators.

不要擔心(你學的命令過時了)悯嗓,所有你知道的Emacs命令目前為止都沒有大的變化。但是可以注意到的是卸察,現(xiàn)在M-f(前移動一個詞)和M-b(后移動一個詞)將單引號視作一個詞的一部分脯厨。以前的Fundamental模式下M-f和M-b把單引號視作單詞分隔符。

Major modes usually make subtle changes like that one: most commands
do "the same job" in each major mode, but they work a little bit
differently.

Major 模式通常作出了像這樣的一些小變化:功能一致坑质,但是實現(xiàn)方式有所變化合武。

To view documentation on your current major mode, type C-h m.

如果想查看當前的major模式下的文檔,輸入C-h m

Move the cursor to the line following this line.

將光標移動至下面一行

Type C-l C-l to bring this line to the top of screen.

輸入C-l C-l使該行居屏幕中

Type C-h m, to see how Text mode differs from Fundamental mode.

輸入C-h m查看Text模式和Fundamental 模式的區(qū)別在哪里

Type C-x 1 to remove the documentation from the screen.

輸入C-x 1 將文檔窗格從屏幕中移除涡扼。

Major modes are called major because there are also minor modes.
Minor modes are not alternatives to the major modes, just minor
modifications of them. Each minor mode can be turned on or off by
itself, independent of all other minor modes, and independent of your
major mode. So you can use no minor modes, or one minor mode, or any
combination of several minor modes.

Major模式之所以叫做主要是因為有次要模式的存在稼跳。次要模式不是主要模式的替代,而是主要模式的次要修改吃沪。每一個次要模式可以獨立于其他的次要模式獨立于你的主要模式地自發(fā)關閉或者開啟汤善,所以你可以不使用次要模式或者使用一個次要模式或者任意幾個次要模式的組合。

One minor mode which is very useful, especially for editing
human-language text, is Auto Fill mode. When this mode is on, Emacs
breaks the line in between words automatically whenever you insert
text and make a line that is too wide.

有一種次要模式十分有用票彪,特別是對于編輯人類語言文本红淡,他是自動填充模式(Auto Fill)。當這種模式啟動的時候降铸,當你在插入的文本會導致正在編輯的行過長時在旱,Emacs將會從詞之間斷開。

You can turn Auto Fill mode on by doing M-x auto-fill-mode <Return>.
When the mode is on, you can turn it off again by doing
M-x auto-fill-mode <Return>. If the mode is off, this command turns
it on, and if the mode is on, this command turns it off. We say that
the command "toggles the mode".

你可以通過輸入 M-x auto-fill-mode <Return>啟用自動填充(Auto Fill)模式推掸。模式啟用以后桶蝎,你可以通過再次輸入M-x auto-fill-mode <Return>關閉模式。如果模式關閉终佛,該命令可以使之啟動,如果模式啟動雾家,命令可以關閉铃彰。這叫做切換模式。

Type M-x auto-fill-mode <Return> now. Then insert a line of "asdf "
over again until you see it divide into two lines. You must put in
spaces between them because Auto Fill breaks lines only at spaces.

輸入M-x auto-fill-mode <Return>.然后在一行中插入“asdf ”芯咧,直到該行被分成兩行牙捉。你必須在asdf之間使用空格,因為這種模式只根據(jù)空格斷行敬飒。

The margin is usually set at 70 characters, but you can change it
with the C-x f command. You should give the margin setting you want
as a numeric argument.
寬度通常為70字符邪铲。但是你可以用C-x f命令改變。你要想要設置的寬度應該是一個數(shù)字參數(shù)无拗。
Type C-x f with an argument of 20. (C-u 2 0 C-x f).
Then type in some text and see Emacs fill lines of 20
characters with it. Then set the margin back to 70 using
C-x f again.

輸入C-x f 带到,參數(shù)為20 (C-u 20 C-x f).然后輸入一些文本,你會看到Emacs的一行將會填充20個字符英染。然后使用C-x f把行寬度改回70

If you make changes in the middle of a paragraph, Auto Fill mode
does not re-fill it for you.
To re-fill the paragraph, type M-q (META-q) with the cursor inside
that paragraph.

如果你在段落的中間做了一些改變揽惹,自動填充模式將不會生效被饿。如果想在段落里重新填充,將光標移動到段落里面搪搏,然后輸入M-q狭握。

Move the cursor into the previous paragraph and type M-q.

移動光標至上一段然后輸入M-q

  • SEARCHING(搜索)

Emacs can do searches for strings (a "string" is a group of contiguous
characters) either forward through the text or backward through it.
Searching for a string is a cursor motion command; it moves the cursor
to the next place where that string appears.

Emacs可以向前向后搜索字符串。搜索字符串是一個光標移動命令疯溺,它會將光標移動到字符串出現(xiàn)的下一個位置论颅。

The Emacs search command is "incremental". This means that the
search happens while you type in the string to search for.

Emacs搜索命令是增量的。這意味著當你輸入要搜索的字符串的時候就會發(fā)生搜索囱嫩。

The command to initiate a search is C-s for forward search, and C-r
for reverse search. BUT WAIT! Don't try them now.

初始化一個前向搜索的命令是C-s恃疯。反向搜索使用C-r。但是注意挠说,先不要嘗試澡谭。

When you type C-s you'll notice that the string "I-search" appears as
a prompt in the echo area. This tells you that Emacs is in what is
called an incremental search waiting for you to type the thing that
you want to search for. <Return> terminates a search.

當你輸入C-s的時候,注意回顯區(qū)域會出現(xiàn)“I-search”的提示信息损俭。這就說明Emacs在增量搜索中等待你鍵入需要搜索的內(nèi)容蛙奖。<Return>終止搜索。

Now type C-s to start a search. SLOWLY, one letter at a time,
type the word "cursor", pausing after you type each
character to notice what happens to the cursor.
Now you have searched for "cursor", once.

現(xiàn)在輸入C-s開始一次搜索吧杆兵。慢慢地雁仲,每次輸入一個字母,輸入單詞Cursor琐脏,輸入每一個字母之后停下來看看查看光標發(fā)生了什么變化≡茏現(xiàn)在你已經(jīng)搜索到了cursor一次。

Type C-s again, to search for the next occurrence of "cursor".

再次輸入C-s,搜索下一個cursor出現(xiàn)的地方

Now type <DEL> four times and see how the cursor moves.

現(xiàn)在鍵入<Del>四次看看光標怎么移動

Type <Return> to terminate the search.

鍵入<Return>終止搜索

Did you see what happened? Emacs, in an incremental search, tries to
go to the occurrence of the string that you've typed out so far. To
go to the next occurrence of "cursor" just type C-s again. If no such
occurrence exists, Emacs beeps and tells you the search is currently
"failing". C-g would also terminate the search.

你看到效果了吧日裙?Emacs在一個增量搜索的搜索模式下吹艇,嘗試去查找目前你已經(jīng)輸入的字符串的位置。再次鍵入C-s去往下一個cursor出現(xiàn)的位置昂拂。如果已經(jīng)沒有下一個了受神,Emacs會蜂鳴告訴你搜索失敗。同時C-g也能終止搜索格侯。

If you are in the middle of an incremental search and type <DEL>, the
search "retreats" to an earlier location. If you type <DEL> just
after you had typed C-s to advance to the next occurrence of a search
string, the <DEL> moves the cursor back to an earlier occurrence. If
there are no earlier occurrences, the <DEL> erases the last character
in the search string. For instance, suppose you have typed "c", to
search for the first occurrence of "c". Now if you type "u", the
cursor will move to the first occurrence of "cu". Now type <DEL>.
This erases the "u" from the search string, and the cursor moves back
to the first occurrence of "c".

如果你在增量搜索中鍵入<Del>,搜索會返回到早先的位置鼻听。如果你在鍵入C-s以查找下一個出現(xiàn)位置然后又輸入<Del>,<Del>將會把光標移動到字符串上一次出現(xiàn)的位置联四。如果沒有字符串之前沒有出現(xiàn)過撑碴,<Del>會刪除當前搜索字符串最后一個字符。例如朝墩,假如為了找到字符c第一次出現(xiàn)的地方醉拓,你輸入了"c",現(xiàn)在如果你輸入了"u",光標將會移動到"cu"第一次出現(xiàn)的位置。現(xiàn)在鍵入<Del>廉嚼,命令將會刪除“u”字符玫镐,光標將會回到“c”第一次出現(xiàn)的位置

If you are in the middle of a search and type a control or meta
character (with a few exceptions--characters that are special in a
search, such as C-s and C-r), the search is terminated.

如果你正在搜索過程中,鍵入了一個Control或者Meta字符字符怠噪,搜索將會終止(除了特例C-r和C-s)

C-s starts a search that looks for any occurrence of the search string
AFTER the current cursor position. If you want to search for
something earlier in the text, type C-r instead. Everything that we
have said about C-s also applies to C-r, except that the direction of
the search is reversed.

C-s 開始前向搜索恐似,搜索下文的內(nèi)容。如果你想搜索前文的內(nèi)容傍念,使用C-r矫夷。C-s的規(guī)則同樣適用于C-r,除了搜索的方向是反的憋槐。

  • MULTIPLE WINDOWS(多窗口)

One of the nice features of Emacs is that you can display more than
one window on the screen at the same time. (Note that Emacs uses the
term "frames"--described in the next section--for what some other
applications call "windows". The Emacs manual contains a Glossary of
Emacs terms.)

Emacs 的一大特色就是你可以同時展示多個窗格双藕。(注意Emacs使用術語:窗口(frame)描述其他用戶的視窗(windows)概念,這個下文將會講到)

Move the cursor to this line and type C-l C-l.
移動光標到這一行然后鍵入C-l C-l

Now type C-x 2 which splits the screen into two windows.
Both windows display this tutorial. The editing cursor stays in

the top window.

現(xiàn)在鍵入C-x 2 將屏幕分為兩個窗格阳仔。兩個窗格顯示的均是該教程忧陪,編輯光標將位于窗格頂部。

Type C-M-v to scroll the bottom window.
(If you do not have a real META key, type <ESC> C-v.)

輸入C-M-v來滾動底部的窗格.(如果你沒有Meta鍵的話使用<ESC> C-v)

Type C-x o ("o" for "other") to move the cursor to the bottom window.

鍵入C-x o(o 意味著other) 移動光標到頂部的窗格里面

Use C-v and M-v in the bottom window to scroll it.
Keep reading these directions in the top window.

這樣就能在底部窗格里面使用C-v和M-v啦近范。繼續(xù)在頂部的窗格里面閱讀這些指南嘶摊。

Type C-x o again to move the cursor back to the top window.
The cursor in the top window is just where it was before.

再次鍵入C-x o將光標移動回到頂部的窗格里。光標會回到原先離開的地方评矩。

You can keep using C-x o to switch between the windows. The "selected
window", where most editing takes place, is the one with a prominent
cursor which blinks when you are not typing. The other windows have
their own cursor positions; if you are running Emacs in a graphical
display, those cursors are drawn as unblinking hollow boxes.

你可以繼續(xù)使用C-x o在窗格之間進行切換叶堆。在選中的占據(jù)大部分編輯區(qū)域的窗格里面,你沒有編輯的時候光標會閃爍斥杜。另一個窗格里有自己的光標位置,如果你在圖形化的顯示界面里面運行Emacs虱颗,這些光標將會是中空的不會閃爍的方格形態(tài)。

The command C-M-v is very useful when you are editing text in one
window and using the other window just for reference. Without leaving
the selected window, you can scroll the text in the other window with
C-M-v.

在你編輯一個窗格中的文本蔗喂,同時把另外一個窗格的文本當做參考時忘渔,命令C-M-v將會是一個十分有用的命令。不用離開當前窗格即可使用該命令對其他窗格進行翻頁操作缰儿。

C-M-v is an example of a CONTROL-META character. If you have a META
(or Alt) key, you can type C-M-v by holding down both CONTROL and META
while typing v. It does not matter whether CONTROL or META "comes
first," as both of these keys act by modifying the characters you
type.

C-M-v是一個Control-Meta字符畦粮。如果你有Meta鍵或者Alt鍵,你可以通過在同時按住CTRL和META和的同時輸入v來鍵入C-M-v返弹。至于Control和Meta誰先誰后無關緊要锈玉,因為這些鍵是通過修改你輸入的字符起作用的爪飘。

If you do not have a META key, and you use <ESC> instead, the order
does matter: you must type <ESC> followed by CONTROL-v, because
CONTROL-<ESC> v will not work. This is because <ESC> is a character
in its own right, not a modifier key.

如果你沒有Meta鍵义起,你可以使用<ESC>鍵,這時你必須注意按鍵的使用順序了师崎,你必須在Control-v按鍵之后輸入<ESC>因為Control-<ESC>并不能工作默终。這是因為<ESC>不是一個修飾鍵,而是有自己的職責。(這里很費解)


image.png

Type C-x 1 (in the top window) to get rid of the bottom window.

在頂部窗口鍵入C-x 1來關閉底部窗格齐蔽。

(If you had typed C-x 1 in the bottom window, that would get rid
of the top one. Think of this command as "Keep just one
window--the window I am already in.")

如果你在底部窗口輸入了C-x 1两疚,頂部窗格將會被關閉。你可以這樣記憶這個命令:僅僅保留當前光標所在的一個窗口含滴。

You do not have to display the same buffer in both windows. If you
use C-x C-f to find a file in one window, the other window does not
change. You can find a file in each window independently.

你不需要在兩個窗格里面顯示相同的緩沖區(qū)诱渤。如果你在一個窗格里面使用C-x C-f,別的窗格不會改變谈况。你可以在每個窗格里面單獨地訪問文件勺美。

Here is another way to use two windows to display two different things:

下面有另外一種方法在兩個窗格里面顯示不同的內(nèi)容。

Type C-x 4 C-f followed by the name of one of your files.
End with <Return>. See the specified file appear in the bottom
window. The cursor goes there, too.

輸入C-x 4 C-f碑韵,緊跟的是一個文件的名字赡茸,結束的時候輸入<Return>.特定的文件將會出現(xiàn)在底部窗格。光標也會相應地移動到那里祝闻。

Type C-x o to go back to the top window, and C-x 1 to delete
the bottom window.

輸入C-x o切換回頂部的窗格占卧,使用C-x 1刪除底部的窗格

  • MULTIPLE FRAMES(多個窗口)

Emacs can also create multiple "frames". A frame is what we call one
collection of windows, together with its menus, scroll bars, echo
area, etc. On graphical displays, what Emacs calls a "frame" is what
most other applications call a "window". Multiple graphical frames
can be shown on the screen at the same time. On a text terminal, only
one frame can be shown at a time.

Emacs 也可以創(chuàng)建多個窗口。窗口是我們所說的多個窗格的集合联喘,帶有菜單滾動條华蜒,回顯區(qū)域等等部件。圖形化的顯示終端里面耸袜,Emacs的窗口和其他應用的窗口類似友多。多個圖形化的窗口可以同時顯示在屏幕上。文本終端中堤框,同一時刻只能有一個顯示窗口域滥。

Type C-x 5 2.
See a new frame appear on your screen.

輸入 C-x 5 2 。你的屏幕上將出現(xiàn)一個新的窗口蜈抓。

You can do everything you did in the original frame in the new frame.
There is nothing special about the first frame.

你可以在新的窗口里面做任何你在以前的窗口里面做的事情启绰。第一個窗口沒有特別之處。

Type C-x 5 0.
This removes the selected frame.

鍵入C-x 5 0 沟使。這將移除選中的窗口

You can also remove a frame by using the normal method provided by the
graphical system (often clicking a button with an "X" at a top corner
of the frame). If you remove the Emacs job's last frame this way,
that exits Emacs.

你也可以通過圖形化的顯示系統(tǒng)提供的正常方法移除窗口(通過點擊頂部窗口角落的?關閉窗口)如果你用這種方法關閉Emacs的最后一個窗口委可,Emacs將會被關閉。

  • RECURSIVE EDITING LEVELS(遞歸編輯級別)

Sometimes you will get into what is called a "recursive editing
level". This is indicated by square brackets in the mode line,
surrounding the parentheses around the major mode name. For
example, you might see [(Fundamental)] instead of (Fundamental).

有時候你會進入遞歸編輯級別腊嗡,此時狀態(tài)行中出現(xiàn)的方括號中的圓括號包裹的主要模式名字的形式會表明這一狀態(tài)着倾。例如你可能看見[(Fundamental)]而不是(Fundamental)

To get out of the recursive editing level, type <ESC> <ESC> <ESC>.
That is an all-purpose "get out" command. You can also use it for
eliminating extra windows, and getting out of the minibuffer.

如果想要離開遞歸編輯級別,輸入<ESC><ESC><ESC> 燕少。這是一個多用途的退出命令卡者。你可以使用它消除多余的窗格和退出微型緩沖區(qū)。

Type M-x to get into a minibuffer; then type <ESC> <ESC> <ESC> to
get out.

輸入M-x 進入一個微型緩沖區(qū)客们,然后輸入三次<ESC>退出崇决。

You cannot use C-g to get out of a recursive editing level. This is
because C-g is used for canceling commands and arguments WITHIN the
recursive editing level.

你不能使用C-g退出遞歸編輯級別材诽。這是因為C-g用于取消遞歸編輯級別中的命令和參數(shù)。

  • GETTING MORE HELP(獲取更多的幫助)

In this tutorial we have tried to supply just enough information to
get you started using Emacs. There is so much available in Emacs that
it would be impossible to explain it all here. However, you may want
to learn more about Emacs since it has many other useful features.
Emacs provides commands for reading documentation about Emacs
commands. These "help" commands all start with the character
CONTROL-h, which is called "the Help character".

這個教程里面我們盡可能提供足夠的信息使你能夠入門Emacs恒傻。Emacs包含的內(nèi)容太多了脸侥,不可能一一具言。但是可能你想了解關于Emacs其他有用的特色盈厘,Emacs提供的關于讀取文檔的命令以幫助字符C-h開始睁枕。

To use the Help features, type the C-h character, and then a
character saying what kind of help you want. If you are REALLY lost,
type C-h ? and Emacs will tell you what kinds of help it can give.
If you have typed C-h and decide you do not want any help, just
type C-g to cancel it.

使用幫助的特色,首先輸入C-h然后輸入一個表明你想查閱的幫助類別的字符沸手。如果你真的不知道譬重,輸入C-h ?罐氨,Emacs會給出它可以提供的幫助類型臀规。如果你鍵入C-h之后發(fā)現(xiàn)你不需要任何的幫助,你可以使用 C-g取消命令栅隐。
(If C-h does not display a message about help at the bottom of the
screen, try typing the F1 key or M-x help <Return> instead.)

如果C-h命令沒有在屏幕底部顯示關于幫助的信息你可以使用F1鍵或者M-x help <Return>代替塔嬉。

The most basic HELP feature is C-h c. Type C-h, the character c, and
a command character or sequence; then Emacs displays a very brief
description of the command.

最基本的幫助特色就是C-h c。輸入C-h租悄,然后是字符c谨究,緊接著一個命令字符或者序列,然后Emacs將會顯示一個簡短的命令的描述

Type C-h c C-p.

鍵入C-h c C-p,提示信息將會顯示:C-p運行命令:上一行
The message should be something like this:
C-p runs the command previous-line

This tells you the "name of the function". Since function names
are chosen to indicate what the command does, they can serve as
very brief documentation--sufficient to remind you of commands you
have already learned.

關于功能的名稱泣棋。由于功能名稱的選擇是為了展現(xiàn)命令的用處的胶哲,所以功能的名稱可以視作簡潔的文檔--這對于使你回想起已經(jīng)學過的命令足矣。

Multi-character commands such as C-x C-s and <ESC>v (instead of M-v,
if you have no META or EDIT or ALT key) are also allowed after C-h c.

多個字符命令例如C-x C-s和<Esc> v(用于替代M-v潭辈,如果你沒有Meta鍵)鸯屿,也允許出現(xiàn)在C-h c后面。

To get more information about a command, use C-h k instead of C-h c.

獲取更多關于一個命令的信息把敢,請不要再用C-h c而是C-h k寄摆。

Type C-h k C-p.

鍵入C-h k C-p

This displays the documentation of the function, as well as its name,
in an Emacs window. When you are finished reading the output, type
C-x 1 to get rid of that window. You do not have to do this right
away. You can do some editing while referring to the help text, and
then type C-x 1.

這將會在一個Emacs窗格里面顯示功能的文檔,包括名字修赞。當你看完輸出婶恼,輸入C-x 1關閉文檔的窗格。你不用立刻嘗試柏副。你可以在編輯的時候引用一些幫助文檔勾邦,然后鍵入C-x 1,

Here are some other useful C-h options:
C-h f Describe a function. You type in the name of the
function.

下面是一些有趣的C-h選項:C-h f 描述一個功能割择。你需要在命令后面輸入功能的名稱眷篇。(到底是功能還是函數(shù)呢?锨推?铅歼?)

Try typing C-h f previous-line <Return>.
This displays all the information Emacs has about the
function which implements the C-p command.

嘗試鍵入C-h previous-line <Return>.這將會顯示所有的實現(xiàn)C-p功能的Emacs命令。

A similar command C-h v displays the documentation of variables,
including those whose values you can set to customize Emacs behavior.
You need to type in the name of the variable when Emacs prompts for it.

一個相似的命令C-h v顯示變量的文檔换可,包括那些你可以通過設置數(shù)值來自定義Emacs行為的變量椎椰。

C-h a Command Apropos. Type in a keyword and Emacs will list
all the commands whose names contain that keyword.
These commands can all be invoked with META-x.
For some commands, Command Apropos will also list a
sequence of one or more characters which runs the same
command.

C-h a 命令關于。輸入關鍵字沾鳄,Emacs將會列出包含關鍵字的命令慨飘。這些命令可以使用M-x調(diào)用。對于一些命令译荞,命令關于 會列出一系列的一個或多個字符的相同命令瓤的。

Type C-h a file <Return>.

鍵入C-h a file <Return>

This displays in another window a list of all M-x commands with "file"
in their names. You will see character-commands listed beside the
corresponding command names (such as C-x C-f beside find-file).

這個會在另外一個窗格里面顯示名稱里帶有"file"的M-x命令列表。你會看到字符命令被列出吞歼,旁邊就是相應的命令名稱圈膏。(例如 C-x C-f beside find-file)

Type C-M-v to scroll the help window. Do this a few times.

鍵入C-M-v滾動幫助窗格。重復幾次篙骡。

Type C-x 1 to delete the help window.

鍵入C-x 1 刪除幫助窗格

C-h i Read included Manuals (a.k.a. Info). This command puts
you into a special buffer called "info" where you
can read manuals for the packages installed on your system.
Type m emacs <Return> to read the Emacs manual.
If you have never before used Info, type h and Emacs
will take you on a guided tour of Info mode facilities.
Once you are through with this tutorial, you should
consult the Emacs Info manual as your primary documentation.

C-h i 閱讀相關手冊稽坤。這個命令會把你帶入一個叫info的特別緩沖區(qū)中,這里 你可以閱讀系統(tǒng)安裝的包的相關手冊糯俗。鍵入m emacs <Return> 讀取emacs的手冊尿褪。如果你之前從未使用過Info,鍵入h和Emacs會引導你參觀info模式的設施得湘。(這里怎么翻譯杖玲,有些別扭)一旦你看完這個教程,你應該將Info手冊作為你的基本文檔淘正。

  • MORE FEATURES(更多的特色)

You can learn more about Emacs by reading its manual, either as a
printed book, or inside Emacs (use the Help menu or type C-h r).
Two features that you may like especially are completion, which saves
typing, and dired, which simplifies file handling.

Emacs手冊可以使你加深對Emacs的了解摆马。兩個可能你特別喜歡的特色是補全和dired。

Completion is a way to avoid unnecessary typing. For instance, if you
want to switch to the Messages buffer, you can type C-x b *M<Tab>
and Emacs will fill in the rest of the buffer name as far as it can
determine from what you have already typed. Completion also works for
command names and file names. Completion is described in the Emacs
manual in the node called "Completion".

補全是避免不必要輸入的一種方法鸿吆。例如今膊,如果你可以切換到Messages緩沖區(qū),鍵入C-x b *M <Tab>伞剑,如果能夠從已經(jīng)輸入的內(nèi)容推斷出來斑唬,Emacs就會決定緩沖區(qū)名稱剩余部分。補全也試用于命令名稱和文件名稱黎泣。Emacs手冊中的結點Completion具體描述了補全的內(nèi)容恕刘。

Dired enables you to list files in a directory (and optionally its
subdirectories), move around that list, visit, rename, delete and
otherwise operate on the files. Dired is described in the Emacs
manual in the node called "Dired".

Dired 使你能夠在某一目錄或者子路徑下列出文件,移動文件抒倚、重命名褐着、刪除以及進行其他操作。Emacs手冊中的結點Dired具體描述了Dired的內(nèi)容托呕。

The manual also describes many other Emacs features.

Emacs的手冊也描述了許多Emacs的其他特色含蓉。

  • CONCLUSION(總結)

To exit Emacs use C-x C-c.

退出Emacs 频敛, C-x C-c

This tutorial is meant to be understandable to all new users, so if
you found something unclear, don't sit and blame yourself - complain!

這個教程編寫的初衷是所有的用戶都可以理解,所以如果你發(fā)現(xiàn)有哪些地方說得不清楚馅扣,不要坐嘆平生自怨自艾--請向我們瘋狂吐槽U遄!差油!

  • COPYING(復制)

This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see https://www.gnu.org/licenses/.

這個文件是GNU Emacs的一部分拗军。
GNU Emacs是自由軟件:你可以在自由軟件基金會的GPL3或者更新的版本協(xié)議下分發(fā)或者修改。GNU Emacs懷著讓軟件強大的初衷分發(fā)蓄喇,但是沒有任何保修服務发侵。甚至沒有售后服務和特定目的適用性服務。具體細節(jié)你可以參閱GNU 通用公開協(xié)議(GPL)妆偏,GPL協(xié)議跟隨GNU Emacs 分發(fā)刃鳄,如果沒有請點擊查看GPL 協(xié)議

最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市钱骂,隨后出現(xiàn)的幾起案子铲汪,更是在濱河造成了極大的恐慌,老刑警劉巖罐柳,帶你破解...
    沈念sama閱讀 222,807評論 6 518
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件掌腰,死亡現(xiàn)場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,284評論 3 399
  • 文/潘曉璐 我一進店門泞坦,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人勺择,你說我怎么就攤上這事÷字遥” “怎么了省核?”我有些...
    開封第一講書人閱讀 169,589評論 0 363
  • 文/不壞的土叔 我叫張陵,是天一觀的道長昆码。 經(jīng)常有香客問我气忠,道長,這世上最難降的妖魔是什么赋咽? 我笑而不...
    開封第一講書人閱讀 60,188評論 1 300
  • 正文 為了忘掉前任旧噪,我火速辦了婚禮,結果婚禮上脓匿,老公的妹妹穿的比我還像新娘淘钟。我一直安慰自己,他們只是感情好陪毡,可當我...
    茶點故事閱讀 69,185評論 6 398
  • 文/花漫 我一把揭開白布米母。 她就那樣靜靜地躺著勾扭,像睡著了一般。 火紅的嫁衣襯著肌膚如雪铁瞒。 梳的紋絲不亂的頭發(fā)上妙色,一...
    開封第一講書人閱讀 52,785評論 1 314
  • 那天,我揣著相機與錄音精拟,去河邊找鬼。 笑死虱歪,一個胖子當著我的面吹牛蜂绎,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播笋鄙,決...
    沈念sama閱讀 41,220評論 3 423
  • 文/蒼蘭香墨 我猛地睜開眼师枣,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了萧落?” 一聲冷哼從身側響起践美,我...
    開封第一講書人閱讀 40,167評論 0 277
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎找岖,沒想到半個月后陨倡,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 46,698評論 1 320
  • 正文 獨居荒郊野嶺守林人離奇死亡许布,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,767評論 3 343
  • 正文 我和宋清朗相戀三年兴革,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片蜜唾。...
    茶點故事閱讀 40,912評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡杂曲,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出袁余,到底是詐尸還是另有隱情擎勘,我是刑警寧澤,帶...
    沈念sama閱讀 36,572評論 5 351
  • 正文 年R本政府宣布颖榜,位于F島的核電站棚饵,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏掩完。R本人自食惡果不足惜蟹地,卻給世界環(huán)境...
    茶點故事閱讀 42,254評論 3 336
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望藤为。 院中可真熱鬧怪与,春花似錦、人聲如沸缅疟。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,746評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至耘斩,卻和暖如春沼填,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背括授。 一陣腳步聲響...
    開封第一講書人閱讀 33,859評論 1 274
  • 我被黑心中介騙來泰國打工坞笙, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人荚虚。 一個月前我還...
    沈念sama閱讀 49,359評論 3 379
  • 正文 我出身青樓薛夜,卻偏偏與公主長得像,于是被迫代替她去往敵國和親版述。 傳聞我的和親對象是個殘疾皇子梯澜,可洞房花燭夜當晚...
    茶點故事閱讀 45,922評論 2 361

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,350評論 0 10
  • 今天,是趁早APP想寫活動的最后一天渴析,命題內(nèi)容為《我與趁早二三事》晚伙。 初識趁早 認識趁早,是從一本書開始俭茧。這本書的...
    王美淇閱讀 649評論 0 2
  • “我來到母债,你的城市走過你來時的路我們相隔三個月第一次漫步長安街那一夜我們聊了很久但久久說不出心的告白……” 千里姻...
    RazLi閱讀 502評論 0 2
  • 親愛的民傻,你最近好嗎?想起我們曾經(jīng)那么多年的時光场斑,真的不敢相信我們就這樣突然之間不聯(lián)系漓踢。
    張愛嘉閱讀 641評論 0 0
  • 為人父母喧半,應該更加心細,因為自己不僅僅為自己的人生謀劃青责,還要考慮孩子面對的人生挺据。明智的父母都知道,孩子的人生屬于他...
    好彩妹閱讀 2,027評論 0 0