emacs-studynode

QUIT EMACS

To quit Emacs, press: . (Be sure to use ,
not .)

在item2中设置meta键

开启

emacs

开启-不显示splash screen

emacs -Q

开启特定的文件

emacs XXX
emacs -Q XXX

Stopping Emacs

C-x C-c

save files

press y to save and n to not save.To save all of the files at once and then quit, press ! (exclamation mark). To quit
immediately, without saving anything more, press q . To save the current file only, but
quit without saving anything else, press . (period).

C-x 0 (the number zero). This tells Emacs to kill (get rid of) the selected window
C-v to scroll down one screenful
M-v to scroll up one screenful
M-x 输入命令
C-d 消除右边得一个字符
C-o open the new line

C-k 删除后面的所有字符
Here are the details for using C-o . If you are at the beginning of a line, C-o
creates a new, empty line above the current line. If you are at the end of a line, C-o
creates a new, empty line below the current line. If you are within a line, C-o breaks it
into two separate lines

To insert one of these characters into your text, first press C-q . This tells Emacs
that the next character is to be taken literally. (Think of the q as meaning “quote”; that
is, to take the next key you type literally.) Thus, to insert a character, type
C-q C-c . To insert a , type C-q C-q . To insert a tab, use C-q TAB

C-x BS delete from the current position, backwards, to the beginning of the sentence.(从当前点删到尾)

buffer

C-x b When you press C-x b , Emacs will wait for you to enter the name of the buffer with
which you want to work. If this buffer already exists, Emacs will just move it into the
window. Otherwise, Emacs will create a brand new empty buffer in the window using
the name you specified. Thus, C-x b is the command to use when you want to create a
new buffer.
C-x 4 b tells Emacs to display whichever buffer you specify in a different window
C-x 4 C-o command. This is similar to the C-x 4 b command, except that the selected window does not change
C-x k kill a buffer

operating the region

C-w kill all the characters
C-x C-l Convert the characters to lower
C-x C-u Convert the characters to lower
M-= count
M-| Run the shell command use the characters as data example:M -| sort -u

delete

delete不会保存

ESC number
M-:
删除空格

12345678

To continue, the M-\ (<Meta-Backslash>) command erases any space or tabcharacters that happen to be on either side of point. This command provides a quickway to clean up a section of whitespace. For example, say that you have typed thefollowing text and the cursor is under one of the spaces between tea and ch :Everything we tea ch you is true.If you press M-\ , Emacs will erase all the surrounding spaces. The line nowlooks like:Everything we teach you is true.

M-SPC： 删除空格 保留一个空格

123456

The M-SPC (<Meta-Space>) command is similar, except that it leaves exactlyone space. Here is an example. You have just typed the line:The sentence above is only partially correct.You would like to erase the extra spaces. Move the cursor to one of the spacesbetween is and only and press M-SPC . The line is changed to the following:The sentence above is only partially correct.

C-x C-o:
删除紧临的空行

1

The C-x C-o command performs the analogous operation for blank lines

M-^
合并到一行，注意curson要放在第二行

123456789101112

Finally, the M-^ command joins two lines into one long one. This commandjoins the current line to the one immediately above it, while leaving a single spacebetween the two groups of text. Any extra spaces (at the end of the first line or atthe beginning of the second line) are removed. For example, say that you have thefollowing lines of text:This is the first sentence.This is the second sentence.You want to join these two lines. Move the cursor to the second line and press M-^ .You will now have one long line:This is the first sentence. This is the second sentence.The cursor will be at the place where the lines were joined, in this case, at the spacebetween the two sentences.

replace

• SPC () to make a replacement and continue.
• BS () to skip a replacement and continue.
• ! (exclamation mark) to make all the rest of the replacements automatically with
no more questions.
• RET () to quit immediately
M-x replace-string makes all the replacements automatically without
asking you any questions.

M-x replace-regexp makes all the replacements automatically, while
allowing you to use a regular expression for the search pattern.

Recursive Editing

C-r when you searing and want interrupt to do other things
M-C-c This will stop recursive editing and return you to the search and replace operation, exactly where you left off.