Lab 8

Emacs

Objectives

  1. Learn an advanced text editor so that you are not still using pico when you are a Senior (people will call you a loser).
  2. Learn how to create and save a file using emacs.
  3. Learn how to use find and replace.
  4. Learn other useful functions that are lacking in simple text editors.

Before Starting


What is emacs?

Emacs is best known as an extremely powerful text editing program that is installed on most UNIX computers. You can use it to do just about anything. You can write, compile, and debug your programs without ever exiting emacs. You can also use emacs for your mail program, web browser, newsreader, UNIX shell, and much more! Sure beats notepad or pico! Since emacs is so powerful, we will only give you a brief tutorial of the text editing portion today. There is plenty of documentation included with emacs for you to figure out the rest.

  

Using emacs

When you first type "emacs" at the acme prompt, you will get a screen that looks something like this:

 

hit enter and the screen will clear, leaving you only with some instructions about the "scratch buffer." The screens that hold text are called buffers in emacs. You can work with multiple buffers at a time for maximum efficiency, but we'll work with just one for now. We'll talk about multiple buffers later.

 

 

 

 

 

 

 

  1. Set the mark (where you want the selection to start) by typing "C-@". The mark won't show up, so you have to remember where it is.
  2. Move the cursor to then end of the selection. The mark will be deactivated if you edit the buffer before you finish these steps, so if you accidentally edit something, type "C-x C-x" to reactivate the region.
  3. To cut the region, use "C-w". To copy the region, use "M-w".



 

 

 

 

 


Your Assignment: Editing a text file with emacs

 You will do some basic text editing with emacs. Download the files from here and here.


Hint: Many of these tasks require you to go from the top of the file to the very bottom and then back. Look up the commands to jump to the beginning and end of your file to make your life easier.



Procedure:

  1. FTP the files to acme.
  2. Open "lab8emacs1.txt" in emacs.
  3. Move the cursor to the end of the last line of text. Press "Enter" twice and insert "lab8emacs2.txt" here.
  4. Delete the first paragraph of instructions, including the dotted line. ("History of Programming Languages" should be the first line now).
  5. Format all the paragraphs so that the lines are wrapped correctly.
  6. Center the title "History of Programming Languages"
  7. Capitalize all the words in the title.
  8. Center the first paragraph only.
  9. Move the ASCII art from the end of the file to just before the Homework heading.
  10. Search & replace all occurrences of _ with * that are in the paragraphs (leave the ASCII art alone).
  11. Turn in.