1 |
You are looking at the Emacs tutorial. See end for copying conditions. |
You are looking at the Emacs tutorial. See end for copying conditions. |
2 |
Copyright (c) 1985, 1996, 1998, 2001, 2002 Free Software Foundation. |
Copyright (c) 1985, 1996, 1998, 2001, 2002, 2005 Free Software Foundation. |
3 |
|
|
4 |
Emacs commands generally involve the CONTROL key (sometimes labeled |
Emacs commands generally involve the CONTROL key (sometimes labeled |
5 |
CTRL or CTL) or the META key (sometimes labeled EDIT or ALT). Rather than |
CTRL or CTL) or the META key (sometimes labeled EDIT or ALT). Rather than |
259 |
saying what the command was, and asking you whether you want to go |
saying what the command was, and asking you whether you want to go |
260 |
ahead and execute the command. |
ahead and execute the command. |
261 |
|
|
262 |
If you really want to try the command, type Space in answer to the |
If you really want to try the command, type <SPC> (the Space bar) in |
263 |
question. Normally, if you do not want to execute the disabled |
answer to the question. Normally, if you do not want to execute the |
264 |
command, answer the question with "n". |
disabled command, answer the question with "n". |
265 |
|
|
266 |
>> Type C-x C-l (which is a disabled command), |
>> Type C-x C-l (which is a disabled command), |
267 |
then type n to answer the question. |
then type n to answer the question. |
352 |
Emacs and correcting errors. You can delete by words or lines |
Emacs and correcting errors. You can delete by words or lines |
353 |
as well. Here is a summary of the delete operations: |
as well. Here is a summary of the delete operations: |
354 |
|
|
355 |
<Delback> delete the character just before the cursor |
<Delback> Delete the character just before the cursor |
356 |
C-d delete the next character after the cursor |
C-d Delete the next character after the cursor |
357 |
|
|
358 |
M-<Delback> kill the word immediately before the cursor |
M-<Delback> Kill the word immediately before the cursor |
359 |
M-d kill the next word after the cursor |
M-d Kill the next word after the cursor |
360 |
|
|
361 |
C-k kill from the cursor position to end of line |
C-k Kill from the cursor position to end of line |
362 |
M-k kill to the end of the current sentence |
M-k Kill to the end of the current sentence |
363 |
|
|
364 |
Notice that <Delback> and C-d vs M-<Delback> and M-d extend the parallel |
Notice that <Delback> and C-d vs M-<Delback> and M-d extend the parallel |
365 |
started by C-f and M-f (well, <Delback> is not really a control |
started by C-f and M-f (well, <Delback> is not really a control |
366 |
character, but let's not worry about that). C-k and M-k are like C-e |
character, but let's not worry about that). C-k and M-k are like C-e |
367 |
and M-e, sort of, in that lines are opposite sentences. |
and M-e, sort of, in that lines are opposite sentences. |
368 |
|
|
369 |
You can also kill any part of the buffer with one uniform method. |
You can also kill any part of the text with one uniform method. Move |
370 |
Move to one end of that part, and type C-@ or C-SPC (either one). |
to one end of that part, and type C-@ or C-<SPC> (either one). (<SPC> |
371 |
(SPC is the Space bar.) Move to the other end of that part, and type |
is the Space bar.) Move to the other end of that part, and type C-w. |
372 |
C-w. That kills all the text between the two positions. |
That kills all the text between the two positions. |
373 |
|
|
374 |
>> Move the cursor to the Y at the start of the previous paragraph. |
>> Move the cursor to the Y at the start of the previous paragraph. |
375 |
>> Type C-SPC. Emacs should display a message "Mark set" |
>> Type C-<SPC>. Emacs should display a message "Mark set" |
376 |
at the bottom of the screen. |
at the bottom of the screen. |
377 |
>> Move the cursor to the n in "end", on the second line of the |
>> Move the cursor to the n in "end", on the second line of the |
378 |
paragraph. |
paragraph. |
401 |
Bringing back killed text is called "yanking". (Think of it as |
Bringing back killed text is called "yanking". (Think of it as |
402 |
yanking back, or pulling back, some text that was taken away.) You |
yanking back, or pulling back, some text that was taken away.) You |
403 |
can yank the killed text either at the same place where it was killed, |
can yank the killed text either at the same place where it was killed, |
404 |
or at some other place in the buffer, or even in a different file. |
or at some other place in the text you are editing, or even in a |
405 |
You can yank the same text several times; that makes multiple copies |
different file. You can yank the same text several times; that makes |
406 |
of it. |
multiple copies of it. |
407 |
|
|
408 |
The command for yanking is C-y. It reinserts the last killed text, |
The command for yanking is C-y. It reinserts the last killed text, |
409 |
at the current cursor position. |
at the current cursor position. |
638 |
M-x Named command eXtend. Followed by a long name. |
M-x Named command eXtend. Followed by a long name. |
639 |
|
|
640 |
These are commands that are generally useful but used less than the |
These are commands that are generally useful but used less than the |
641 |
commands you have already learned about. You have already seen two of |
commands you have already learned about. You have already seen a few |
642 |
them: the file commands C-x C-f to Find and C-x C-s to Save. Another |
of them: the file commands C-x C-f to Find and C-x C-s to Save, for |
643 |
example is the command to end the Emacs session--this is the command |
example. Another example is the command to end the Emacs |
644 |
C-x C-c. (Do not worry about losing changes you have made; C-x C-c |
session--this is the command C-x C-c. (Do not worry about losing |
645 |
offers to save each changed file before it kills the Emacs.) |
changes you have made; C-x C-c offers to save each changed file before |
646 |
|
it kills the Emacs.) |
647 |
|
|
648 |
C-z is the command to exit Emacs *temporarily*--so that you can go |
C-z is the command to exit Emacs *temporarily*--so that you can go |
649 |
back to the same Emacs session afterward. |
back to the same Emacs session afterward. |
667 |
|
|
668 |
There are many C-x commands. Here is a list of the ones you have learned: |
There are many C-x commands. Here is a list of the ones you have learned: |
669 |
|
|
670 |
C-x C-f Find file. |
C-x C-f Find file |
671 |
C-x C-s Save file. |
C-x C-s Save file |
672 |
C-x C-b List buffers. |
C-x s Save some buffers |
673 |
C-x C-c Quit Emacs. |
C-x C-b List buffers |
674 |
C-x 1 Delete all but one window. |
C-x b Switch buffer |
675 |
C-x u Undo. |
C-x C-c Quit Emacs |
676 |
|
C-x 1 Delete all but one window |
677 |
|
C-x u Undo |
678 |
|
|
679 |
Named eXtended commands are commands which are used even less |
Named eXtended commands are commands which are used even less |
680 |
frequently, or commands which are used only in certain modes. An |
frequently, or commands which are used only in certain modes. An |
730 |
The line immediately above the echo area is called the "mode line". |
The line immediately above the echo area is called the "mode line". |
731 |
The mode line says something like this: |
The mode line says something like this: |
732 |
|
|
733 |
--:** TUTORIAL (Fundamental)--L670--58%---------------- |
--:** TUTORIAL 63% L749 (Fundamental)----------------------- |
734 |
|
|
735 |
This line gives useful information about the status of Emacs and |
This line gives useful information about the status of Emacs and |
736 |
the text you are editing. |
the text you are editing. |
737 |
|
|
738 |
You already know what the filename means--it is the file you have |
You already know what the filename means--it is the file you have |
739 |
found. -NN%-- indicates your current position in the text; it means |
found. NN% indicates your current position in the text; it means that |
740 |
that NN percent of the text is above the top of the screen. If the |
NN percent of the text is above the top of the screen. If the top of |
741 |
top of the file is on the screen, it will say --Top-- instead of |
the file is on the screen, it will say "Top" instead of " 0%". If the |
742 |
--00%--. If the bottom of the text is on the screen, it will say |
bottom of the text is on the screen, it will say "Bot". If you are |
743 |
--Bot--. If you are looking at text so small that all of it fits on |
looking at text so small that all of it fits on the screen, the mode |
744 |
the screen, the mode line says --All--. |
line says "All". |
745 |
|
|
746 |
The L and digits indicate position in another way: they give the |
The L and digits indicate position in another way: they give the |
747 |
current line number of point. |
current line number of point. |
770 |
|
|
771 |
If you are going to be editing human-language text, such as this file, you |
If you are going to be editing human-language text, such as this file, you |
772 |
should probably use Text Mode. |
should probably use Text Mode. |
773 |
|
|
774 |
>> Type M-x text mode<Return>. |
>> Type M-x text mode<Return>. |
775 |
|
|
776 |
Don't worry, none of the Emacs commands you have learned changes in |
Don't worry, none of the Emacs commands you have learned changes in |
901 |
Both windows display this tutorial. The cursor stays in the top window. |
Both windows display this tutorial. The cursor stays in the top window. |
902 |
|
|
903 |
>> Type C-M-v to scroll the bottom window. |
>> Type C-M-v to scroll the bottom window. |
904 |
(If you do not have a real META key, type ESC C-v.) |
(If you do not have a real META key, type <ESC> C-v.) |
905 |
|
|
906 |
>> Type C-x o ("o" for "other") to move the cursor to the bottom window. |
>> Type C-x o ("o" for "other") to move the cursor to the bottom window. |
907 |
>> Use C-v and M-v in the bottom window to scroll it. |
>> Use C-v and M-v in the bottom window to scroll it. |
925 |
typing v. It does not matter whether CONTROL or META "comes first," |
typing v. It does not matter whether CONTROL or META "comes first," |
926 |
because both of these keys act by modifying the characters you type. |
because both of these keys act by modifying the characters you type. |
927 |
|
|
928 |
If you do not have a real META key, and you use ESC instead, the order |
If you do not have a real META key, and you use <ESC> instead, the |
929 |
does matter: you must type ESC followed by CONTROL-v, because |
order does matter: you must type <ESC> followed by CONTROL-v, because |
930 |
CONTROL-ESC v will not work. This is because ESC is a character in |
CONTROL-<ESC> v will not work. This is because <ESC> is a character |
931 |
its own right, not a modifier key. |
in its own right, not a modifier key. |
932 |
|
|
933 |
>> Type C-x 1 (in the top window) to get rid of the bottom window. |
>> Type C-x 1 (in the top window) to get rid of the bottom window. |
934 |
|
|
959 |
surrounding the parentheses around the major mode name. For |
surrounding the parentheses around the major mode name. For |
960 |
example, you might see [(Fundamental)] instead of (Fundamental). |
example, you might see [(Fundamental)] instead of (Fundamental). |
961 |
|
|
962 |
To get out of the recursive editing level, type ESC ESC ESC. That is |
To get out of the recursive editing level, type <ESC> <ESC> <ESC>. |
963 |
an all-purpose "get out" command. You can also use it for eliminating |
That is an all-purpose "get out" command. You can also use it for |
964 |
extra windows, and getting out of the minibuffer. |
eliminating extra windows, and getting out of the minibuffer. |
965 |
|
|
966 |
>> Type M-x to get into a minibuffer; then type ESC ESC ESC to get out. |
>> Type M-x to get into a minibuffer; then type <ESC> <ESC> <ESC> to |
967 |
|
get out. |
968 |
|
|
969 |
You cannot use C-g to get out of a recursive editing level. This is |
You cannot use C-g to get out of a recursive editing level. This is |
970 |
because C-g is used for canceling commands and arguments WITHIN the |
because C-g is used for canceling commands and arguments WITHIN the |
1104 |
This version of the tutorial, like GNU Emacs, is copyrighted, and |
This version of the tutorial, like GNU Emacs, is copyrighted, and |
1105 |
comes with permission to distribute copies on certain conditions: |
comes with permission to distribute copies on certain conditions: |
1106 |
|
|
1107 |
Copyright (c) 1985, 1996, 1998, 2001, 2002 Free Software Foundation |
Copyright (c) 1985, 1996, 1998, 2001, 2002, 2005 Free Software Foundation |
1108 |
|
|
1109 |
Permission is granted to anyone to make or distribute verbatim copies |
Permission is granted to anyone to make or distribute verbatim copies |
1110 |
of this document as received, in any medium, provided that the |
of this document as received, in any medium, provided that the |