Editing a Document in XEmacs


At this point, you should have the contents of the file ~/Testdir/sample in your XEmacs window. We will learn some of the common commands used to change the contents of files.

Deleting a Line

The last line in the sample file is actually a copyright notice that should be at the start of the file. We will delete the last line in the file and paste it at the start. We can move to the end of the file by using the command Esc > i.e. press the Esc key and then press >.
 
  • Type Esc > to move the cursor to the end of the file. Use the arrow keys or the mouse to make sure that the cursor is on the line that carries the copyright notice. 
  • The command to delete a line is C-k i.e. hold the Ctrl key down and press k. If the cursor is not at the beginning of the line, you can move it to the beginning by pressing the Home key or by using the equivalent command C-a.
  • Type C-a to move the cursor to the beginning of the line. Type C-k to delete the line. XEmacs stores the deleted line in a kill ring. Items in the kill ring can be retrieved later on if we want.
  • Now type the command Esc < to move to the beginning of the file, and then enter the command C-y. The C-y command copies the most recently deleted text from the kill ring into the current cursor position. 
  • More Editing

    The second line of the file reads You are looking for the Linux reference.
     
  • Using the mouse or the arrow keys, move the cursor to the end of the word for and delete it one character at a time using the Backspace key. 
  • Now type the word at

  •  

     

    The new word should be inserted in place of for. XEmacs is usually in insert mode; that is, text is inserted rather than typed over (overwritten). However, you can change to overwrite mode by pressing the Insert key located to the right of the Backspace key, grouped with the Page Up and the Page Down keys. 

  • Press the Insert key. If you look at the bottom of your screen on the black bar right above the XEmacs command line, you will see that the mode has changed to (Ovwrt) mode. Now type over the word Linux with the word XEmacs. Now press the Insert key once again to place XEmacs back into insert mode, which is the mode you almost certainly will prefer. (The main reason for telling you about overwrite mode is that it is easy to hit the Insert key accidentally, and it's nice to know what symptoms you'll see, and how to recover!)

  •  

     

    We used the Backspace key to delete the character to the left of the cursor. The command C-d deletes the character to the right of the cursor. 

  • Move the cursor to the beginning of the word reference and delete it one character at a time using the C-d command. Replace this word with the word tutorial


  • Previous Table of Contents Continue


    Last modified: Tue Jan 6 14:55:18 EST 1998