CPS 125 Alexander Ferworn LAB 2 Purpose: This lab is designed to introduce you to the Emacs editor. You are free to use any editor you wish in the course, however, this editor will have been formally presented in the course classes for editing programs and data. Before starting, copy .emacs and .kshrc from the course directory to your home directory; log out and in again. Type set -o emacs or edit that line into your .profile file when you can to do so safely; gives emacs capability to your command line - try cntl-p. 1. With Emacs, edit /usr/local/lib/emacs/19.28/etc/TUTORIAL This file is the Emacs tutorial. Read through the file, performing the various actions specified. As you work, fill in the worksheet of Emacs commands. This sheet will be a useful reference in getting to know the program. 2. From /home/t4a/cps125aa/lab2 copy the files sample.1 and sample.2 to your cps125 subdirectory. The sample.1 listing is given below. Use Emacs to modify sample.2 to restore it to the same contents as sample.1. 3. Use an appropriate UNIX command to test for equality of the two files. Make additional changes to sample.2, if necessary, until the files compare equal. Careful: spaces at the ends of lines may not always be readily visible. 4. Use Emacs to create the file myproverb.c containing the program from page 4 of the course text; this is the same program that was copied from the course directory in Lab 1 as the file proverb.c. Note : specifying the file name with a ".c" extension invokes automatic C formatting in Emacs. 5. Ensure that myproverb.c compiles with no errors, and run it to confirm this. sample.1 This is a sample file that contains several lines of text, which will be used to practice editing with Emacs. You will be given a version of this file which is mangled: extra characters inserted; spelling errors introduced; lines moved around; and other nasties. You are to use Emacs to restore the original file with as few commands as possible. Emacs Summary -------------------- How do you... end Emacs session get help view next screen view previous screen adjust screen to centre cursor move cursor to previous line move cursor to next line move cursor backward move cursor forward move forward one word move backward one word move to beginning of line move to end of line move to beginning of sentence move to end of sentence move to beginning of file move to end of file repeat a command n times kill all other windows delete character after cursor kill word after cursor kill rest of the line yank yank pop find a file save a file list buffers