/[emacs]/emacs/etc/TUTORIAL
ViewVC logotype

Diff of /emacs/etc/TUTORIAL

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.50 by rms, Sun May 19 16:05:46 2002 UTC revision 1.50.2.1 by miles, Fri Apr 4 06:19:50 2003 UTC
# Line 1  Line 1 
1  Copyright (c) 1985 Free Software Foundation, Inc;  See end for conditions.  You are looking at the Emacs tutorial.  See end for copying conditions.
2  You are looking at the Emacs tutorial.  Copyright (c) 1985, 1996, 1998, 2001, 2002 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
# Line 50  The following commands are useful for vi Line 50  The following commands are useful for vi
50     Find the cursor again and notice that the same text     Find the cursor again and notice that the same text
51     is near the cursor now.     is near the cursor now.
52    
53  You can also use the PageUp and PageDn keys to do scrolling, if your  You can also use the PageUp and PageDn keys to move by screenfuls, if
54  terminal has them, but you can edit more efficiently if you use C-v  your terminal has them, but you can edit more efficiently if you use
55  and M-v.  C-v and M-v.
56    
57    
58  * BASIC CURSOR CONTROL  * BASIC CURSOR CONTROL
# Line 65  There are several ways you can do this. Line 65  There are several ways you can do this.
65  but it's more efficient to keep your hands in the standard position  but it's more efficient to keep your hands in the standard position
66  and use the commands C-p, C-b, C-f, and C-n.  These characters  and use the commands C-p, C-b, C-f, and C-n.  These characters
67  are equivalent to the four arrow keys, like this:  are equivalent to the four arrow keys, like this:
68    
69                            Previous line, C-p                            Previous line, C-p
70                                    :                                    :
71                                    :                                    :
# Line 198  any terminal.  The numeric argument is a Line 198  any terminal.  The numeric argument is a
198  because you type the argument before the command it applies to.  because you type the argument before the command it applies to.
199    
200  For instance, C-u 8 C-f moves forward eight characters.  For instance, C-u 8 C-f moves forward eight characters.
201            
202  >> Try using C-n or C-p with a numeric argument, to move the cursor  >> Try using C-n or C-p with a numeric argument, to move the cursor
203     to a line near this one with just one command.     to a line near this one with just one command.
204    
# Line 303  can see, such as A, 7, *, etc. are taken Line 303  can see, such as A, 7, *, etc. are taken
303  immediately.  Type <Return> (the carriage-return key) to insert a  immediately.  Type <Return> (the carriage-return key) to insert a
304  Newline character.  Newline character.
305    
306  You can delete the last character you typed by typing <Delete>.  You can delete the last character you typed by typing <Delback>.
307  <Delete> is a key on the keyboard, which may be labeled "Del".  In  <Delback> is a key on the keyboard--the same one you normally use,
308  some cases, the "Backspace" key serves as <Delete>, but not always!  outside Emacs, for deleting the last character you typed.  It is
309    normally a large key a couple of lines up from the <Return> key, and
310    it is usually labeled "Delete", "Del" or "Backspace".
311    
312    If the large key there is labeled "Backspace", then that's the one you
313    use for <Delback>.  There may also be another key labeled "Delete"
314    somewhere else, but that's not <Delback>.
315    
316  More generally, <Delete> deletes the character immediately before the  More generally, <Delback> deletes the character immediately before the
317  current cursor position.  current cursor position.
318    
319  >> Do this now--type a few characters, then delete them  >> Do this now--type a few characters, then delete them
320     by typing <Delete> a few times.  Don't worry about this file     by typing <Delback> a few times.  Don't worry about this file
321     being changed; you will not alter the master tutorial.  This is     being changed; you will not alter the master tutorial.  This is
322     your personal copy of it.     your personal copy of it.
323    
# Line 323  right margin indicates a line which has Line 329  right margin indicates a line which has
329  >> Insert text until you reach the right margin, and keep on inserting.  >> Insert text until you reach the right margin, and keep on inserting.
330     You'll see a continuation line appear.     You'll see a continuation line appear.
331    
332  >> Use <Delete>s to delete the text until the line fits on one screen  >> Use <Delback>s to delete the text until the line fits on one screen
333     line again.  The continuation line goes away.     line again.  The continuation line goes away.
334    
335  You can delete a Newline character just like any other character.  You can delete a Newline character just like any other character.
# Line 331  Deleting the Newline character between t Line 337  Deleting the Newline character between t
337  one line.  If the resulting combined line is too long to fit in the  one line.  If the resulting combined line is too long to fit in the
338  screen width, it will be displayed with a continuation line.  screen width, it will be displayed with a continuation line.
339    
340  >> Move the cursor to the beginning of a line and type <Delete>.  This  >> Move the cursor to the beginning of a line and type <Delback>.  This
341     merges that line with the previous line.     merges that line with the previous line.
342    
343  >> Type <Return> to reinsert the Newline you deleted.  >> Type <Return> to reinsert the Newline you deleted.
# Line 346  You've now learned the most basic way of Line 352  You've now learned the most basic way of
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          <Delete>     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-<Delete>   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 <Delete> and C-d vs M-<Delete> 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, <Delete> 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    
# Line 378  can be reinserted, whereas "deleted" thi Line 384  can be reinserted, whereas "deleted" thi
384  Reinsertion of killed text is called "yanking".  Generally, the  Reinsertion of killed text is called "yanking".  Generally, the
385  commands that can remove a lot of text kill the text (they set up so  commands that can remove a lot of text kill the text (they set up so
386  that you can yank the text), while the commands that remove just one  that you can yank the text), while the commands that remove just one
387  character, or just blank lines and spaces, do deletion (so you cannot  character, or only remove blank lines and spaces, do deletion (so you
388  yank that text).  cannot yank that text).
389    
390  >> Move the cursor to the  beginning of a line which is not empty.  >> Move the cursor to the  beginning of a line which is not empty.
391     Then type C-k to kill the text on that line.     Then type C-k to kill the text on that line.
# Line 396  Bringing back killed text is called "yan Line 402  Bringing back killed text is called "yan
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 buffer, or even in a different file.
405  You can yank the text several times, which makes multiple copies of  You can yank the same text several times; that makes multiple copies
406  it.  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.
# Line 575  is always part of some buffer. Line 581  is always part of some buffer.
581    
582  >> Type C-x 1 to get rid of the buffer list.  >> Type C-x 1 to get rid of the buffer list.
583    
584  When you have several buffers, only of of them is "current" at any  When you have several buffers, only one of them is "current" at any
585  time.  That buffer is the one you edit.  If you want to edit another  time.  That buffer is the one you edit.  If you want to edit another
586  buffer, you need to "switch" to it.  If you want to switch to a buffer  buffer, you need to "switch" to it.  If you want to switch to a buffer
587  that corresponds to a file, you can do it by visiting the file again  that corresponds to a file, you can do it by visiting the file again
# Line 600  messages that have appeared on the botto Line 606  messages that have appeared on the botto
606  session.  session.
607    
608  >> Type C-x b *Messages* <Return> to look at the buffer of messages.  >> Type C-x b *Messages* <Return> to look at the buffer of messages.
609     Then type C-b TUTORIAL <Return> to come back to this tutorial.     Then type C-x b TUTORIAL <Return> to come back to this tutorial.
610    
611  If you make changes to the text of one file, then find another file,  If you make changes to the text of one file, then find another file,
612  this does not save the first file.  Its changes remain inside Emacs,  this does not save the first file.  Its changes remain inside Emacs,
# Line 743  no stars, just dashes. Line 749  no stars, just dashes.
749    
750  The part of the mode line inside the parentheses is to tell you what  The part of the mode line inside the parentheses is to tell you what
751  editing modes you are in.  The default mode is Fundamental which is  editing modes you are in.  The default mode is Fundamental which is
752  what you are using now.  It is an example of a "major mode".    what you are using now.  It is an example of a "major mode".
753    
754  Emacs has many different major modes.  Some of them are meant for  Emacs has many different major modes.  Some of them are meant for
755  editing different languages and/or kinds of text, such as Lisp mode,  editing different languages and/or kinds of text, such as Lisp mode,
# Line 759  major mode is the name of an extended co Line 765  major mode is the name of an extended co
765  switch to that mode.  For example, M-x fundamental-mode is a command to  switch to that mode.  For example, M-x fundamental-mode is a command to
766  switch to Fundamental mode.  switch to Fundamental mode.
767    
768  If you are going to be editing English text, such as this file, you  If you are going to be editing human-language text, such as this file, you
769  should probably use Text Mode.  should probably use Text Mode.
770  >> Type M-x text mode<Return>.  >> Type M-x text mode<Return>.
771    
# Line 785  itself, independent of all other minor m Line 791  itself, independent of all other minor m
791  major mode.  So you can use no minor modes, or one minor mode, or any  major mode.  So you can use no minor modes, or one minor mode, or any
792  combination of several minor modes.  combination of several minor modes.
793    
794  One minor mode which is very useful, especially for editing English  One minor mode which is very useful, especially for editing
795  text, is Auto Fill mode.  When this mode is on, Emacs breaks the line  human-language text, is Auto Fill mode.  When this mode is on, Emacs
796  in between words automatically whenever you insert text and make a  breaks the line in between words automatically whenever you insert
797  line that is too wide.  text and make a line that is too wide.
798    
799  You can turn Auto Fill mode on by doing M-x auto fill mode<Return>.  You can turn Auto Fill mode on by doing M-x auto fill mode<Return>.
800  When the mode is on, you can turn it off again by doing M-x  When the mode is on, you can turn it off again by doing M-x
# Line 842  you want to search for.  <Return> termin Line 848  you want to search for.  <Return> termin
848     character to notice what happens to the cursor.     character to notice what happens to the cursor.
849     Now you have searched for "cursor", once.     Now you have searched for "cursor", once.
850  >> Type C-s again, to search for the next occurrence of "cursor".  >> Type C-s again, to search for the next occurrence of "cursor".
851  >> Now type <Delete> four times and see how the cursor moves.  >> Now type <Delback> four times and see how the cursor moves.
852  >> Type <Return> to terminate the search.  >> Type <Return> to terminate the search.
853    
854  Did you see what happened?  Emacs, in an incremental search, tries to  Did you see what happened?  Emacs, in an incremental search, tries to
# Line 858  letting it get through to Emacs.  To unf Line 864  letting it get through to Emacs.  To unf
864  Then see the section "Spontaneous Entry to Incremental Search" in the  Then see the section "Spontaneous Entry to Incremental Search" in the
865  Emacs manual for advice on dealing with this "feature".  Emacs manual for advice on dealing with this "feature".
866    
867  If you are in the middle of an incremental search and type <Delete>,  If you are in the middle of an incremental search and type <Delback>,
868  you'll notice that the last character in the search string is erased  you'll notice that the last character in the search string is erased
869  and the search backs up to the last place of the search.  For  and the search backs up to the last place of the search.  For
870  instance, suppose you have typed "c", to search for the first  instance, suppose you have typed "c", to search for the first
871  occurrence of "c".  Now if you type "u", the cursor will move  occurrence of "c".  Now if you type "u", the cursor will move
872  to the first occurrence of "cu".  Now type <Delete>.  This erases  to the first occurrence of "cu".  Now type <Delback>.  This erases
873  the "u" from the search string, and the cursor moves back to  the "u" from the search string, and the cursor moves back to
874  the first occurrence of "c".  the first occurrence of "c".
875    
# Line 988  a command character or sequence; then Em Line 994  a command character or sequence; then Em
994  description of the command.  description of the command.
995    
996  >> Type C-h c C-p.  >> Type C-h c C-p.
997    The message should be something like  
998    The message should be something like this:
999    
1000          C-p runs the command previous-line          C-p runs the command previous-line
1001    
# Line 1092  starting with the one written by Stuart Line 1099  starting with the one written by Stuart
1099  This version of the tutorial, like GNU Emacs, is copyrighted, and  This version of the tutorial, like GNU Emacs, is copyrighted, and
1100  comes with permission to distribute copies on certain conditions:  comes with permission to distribute copies on certain conditions:
1101    
1102  Copyright (c) 1985, 1996 Free Software Foundation  Copyright (c) 1985, 1996, 1998, 2001, 2002 Free Software Foundation
1103    
1104     Permission is granted to anyone to make or distribute verbatim copies     Permission is granted to anyone to make or distribute verbatim copies
1105     of this document as received, in any medium, provided that the     of this document as received, in any medium, provided that the

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.50.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26