*** SCAME *** (the SCreen-oriented Anti-Misery Editor) Welcome to part two of the SCAME tutorial. EXTENDING THE COMMAND SET ------------------------- There are many, many more SCAME commands than could possibly be put on all the control and meta characters. SCAME gets around this with the X (eXtend) command. This comes in two flavors: C-X Character eXtend. Followed by one character. M-X Named command eXtend. Followed by a long name. These are commands that are generally useful but used less than the commands you have already learned about. You have already seen two of them: the file commands C-X C-V to Visit and C-X C-S to Save. Another example is the command to tell SCAME that you'd like to stop editing. The command to do this is C-X C-Z. Think of it as Z for zapping yourself. There are many C-X commands. The ones you need immediately are: C-X C-V Visit file. C-X C-S Save file. C-X C-Z Quit SCAME. This does NOT save your file. The standard way to save and exit is C-X C-S C-X C-Z. Named eXtend commands are commands which are used even less frequently, or commands which are used only in certain modes. These commands are usually called "functions". An example the function Replace String which globally replaces one string with another. When you type M-X, SCAME prompts you at the bottom of the screen with M-X and you should type the name of the function you wish to call; in this case, "Replace String". Just type "Replace String". Then you type the string that you want to replace, a return, the string you want to replace it with, and a return. >> Move the cursor to the blank line two lines below this one. Then type M-X replace stringchangedaltered. Notice how this line has changed: you've replaced the word c-h-a-n-g-e-d with "altered" wherever it occurs after the cursor. MODE LINE --------- If SCAME sees that you are typing commands slowly it shows them to you at the bottom of the screen in an area called the echo area. The echo area contains the bottom line of the screen. The line immediately above it is called the MODE LINE. The mode line says something like SCAME (Fundamental) Main: filename --nn%-- * This is a very useful "information" line. You already know what the filename means - it is the file you have visited. What the --nn%-- means is that nn percent of the file is above the top of the screen. If the top of the file is on the screen, it will say --TOP-- instead of --00%--. If the bottom of the file is on the screen, it will say --BOT--. If you are looking at a file so small it all fits on the screen, the --nn%-- will simply not be there. The star means that you have made changes to the text. Right after you visit or save a file, there is no star. The part of the mode line inside the parentheses is to tell you what modes you are in. The default mode is Fundamental which is what you are in now. It is an example of a "major mode". There are several major modes in SCAME for editing different languages and text, such as Pascal Mode, Swedish Mode, etc. At any time one and only one major mode is active, and its name can always be found in the mode line just where "Fundamental" is now. Each major mode makes a few commands behave differently. For example, there are commands for creating comments in a program, and since each programming language has a different idea of what a comment should look like, each major mode has to insert comments differently. Each major mode is the name of an extended command, which is how you get into the mode. For example, M-X Fundamental Mode is how to get into Fundamental mode. If you are going to be editing Swedish text, you should probably use Swedish Mode. >> Type M-X Swedish Mode. Don't worry, none of the commands you have learned changes in any great way. But you can now observe that the special swedish characters }{| and ][\ are now part of words when you do M-F or M-B! Major modes are usually like that: commands don't change into completely unrelated things, but they work a little bit differently. Major modes are called major because there are also minor modes. They are called minor because they aren't alternatives to the major modes, just minor modifications of them. Each minor mode can be turned on or off by itself, regardless of what major mode you are in, and regardless of the other minor modes. So you can use no minor modes, or one minor mode, or any combination of several minor modes. (At this moment there are no minor modes implemented in SCAME). SEARCHING --------- SCAME can do searches for strings (these are groups of contiguous characters or words) either forward through the file or backward through it. To search for the string means that you are trying to locate it somewhere in the file and have SCAME show you where the occurrences of the string exist. This type of search is somewhat different from what you may be familiar with. It is a search that is performed as you type in the thing to search for. The command to initiate a search is C-S for forward search, and C-R for reverse search. BUT WAIT! Don't do them now. When you type C-S you'll notice that the string "I-search" appears as a prompt in the echo area. This tells you that SCAME is in what is called an incremental search waiting for you to type the thing that you want to search for. A search is terminated by C-@ (Control-Space on some terminals). >> Now type C-S to start a search. SLOWLY, one letter at a time, type the word 'cursor', pausing after you type each character to notice what happens to the cursor. >> Type C-S to find the next occurrence of "cursor". >> Now type four times and see how the cursor moves. >> Type C-@ (or C-Space) to terminate the search. Did you see what happened? SCAME, in an incremental search, tries to go to the occurrence of the string that you've typed out so far. To go to the next occurrence of 'cursor' just type C-S again. If no such occurrence exists SCAME beeps and tells you that it is a failing search. C-G would also terminate the search. If you are in the middle of an incremental search and type , you'll notice that the last character in the search string is erased and the search backs up to the last place of the search. For instance, suppose you currently have typed 'cu' and you see that your cursor is at the first occurrence of 'cu'. If you now type , the 'u' on the search line is erased and you'll be repositioned in the text to the occurrence of 'c' where the search took you before you typed the 'u'. This provides a useful means for backing up while you are searching. If you are in the middle of a search and happen to type a control character (other than a C-S or C-R, which tell SCAME to search for the next occurrence of the string), the search is terminated. The C-S starts a search that looks for any occurrence of the search string AFTER the current cursor position. But what if you want to search for something earlier in the text? To do this one should type C-R for Reverse search. Everything that applies to C-S applies to C-R except that the direction of the search is reversed. GETTING MORE HELP ----------------- In this tutorial we have tried to supply just enough information to get you started using SCAME. There is so much available in SCAME that it would be impossible to explain it all here. However, you may want to learn more about SCAME since it has numerous desirable features that you don't know about yet. SCAME has a great deal of internal documentation. All of these commands can be accessed through the HELP character. If there is no key labelled "HELP" on your keyboard, you can type the character as C-_ (Control-Underscore). Be warned: many terminals are faulty and do not allow you to type the character C-_ in the logical way (hold down Control and type an underscore). For example, on a VT-100 it works to hold down Control and type "/" or "?". To use the HELP features, type the character, and then a character saying what kind of help you want. If you are REALLY lost, type ? and SCAME will tell you what kinds of help it can give. If you have typed the character and decide you don't want any help, just type C-G to abort. The most basic HELP feature is B. Type , a B, and SCAME prints a short summary of its most important commands. >> Type B. When the summary has been printed, SCAME will wait for you to to type a space. When you have done that, the text in the text buffer (this text) will be restored on the screen. Another simple HELP feature is S. Type , an S, and SCAME will print a summary of all commands available. >> Type S. It should print the command summary. When it says "--MORE--" at the bottom of the screen, type a Space to see the next screenful of the list. CONCLUSION ---------- This tutorial is meant to be understandable to all new users, so if you found something unclear, don't sit and blame yourself - complain! This tutorial was adapted from TEACH-EMACS.TUTORIAL, a tutorial file for EMACS, an advanced real-time screen editor of which SCAME is but a faint shadow. If you have access to a DEC-20 or MULTICS computer, you could benefit from all the wonders of EMACS, but otherwise you will have to be satisfied with this! He, who useth SCAME, or any other EMACS-inspired editor, should acknowledge the work of Richard M. Stallman of the M.I.T. Artificial Intelligence laboratory, who conceived and implemented EMACS.