BRIEF XEMACS TUTORIAL --------------------- From the point of view of a lot of programmers, xemacs is the best editor available. We encourage you to use it during your academic life. 1. Moving the cursor -------------------- To move the cursor you may use the up/down/left/right arrows. Also you may use the and keys to move to the beginning and end of a line. To go to the next/previous page press or . 2. Xemacs command-line ---------------------- Xemacs has a command line in the very bottom of the screen. This command line allows you to run complicated commands in xemacs that may not be available with a key or GUI. To go to the command line type (The Alt key is located at the left of the spacebar). To quit from the command line, type . Remember to type ctrl-] every time this happens. 3. Splitting the screen ----------------------- To split the screen in two type <1> <2>. To return from the split type <1>. To travel from one window to the other type . You will see the cursor jumping from one window to the other. 4. Opening and saving a file ---------------------------- Besides the File pull-down menu, you may use the command line to open a file. With some experience, you will see that the using the command-line is faster than using the pull-donw menu. Exercise: --------- Type <1> and then <2> to divide the screen in two. Click with the mouse in the bottom screen and type . The cursor will go to the command-line mode and will ask you for a file to open in the current path. Type to see all the files you may open in that directory. Type and this will complete to "Hello.java". Then type . Go to the "Hello.java" window and modify "Hello world" by "Hello Everybody". To save a file click in the window that has the file you want to save and type . Now go to the xterm window and type: > javac Hello.java > java Hello If you want to save some of the files you are editing, type and xemacs will ask you if you want to save the modified files one by one. 5. Creating a new file ---------------------- To create a new file you may go to step 4 and type the name of an unexisting file. Xemacs will create the file if it does not exist. Also, you may use to save a file with a different name. 6. Selecting a file for display -------------------------------- One of the advantages of xemacs compared to other editors is that it is possible to edit multiple files simulatenously. The "Buffers" pull-down menu shows you the list of files that are currently loaded in Xemacs. You can select the one you want to display. Exercise: --------- Split the window in two by typing <1><2> Select the buttom window with the mouse. Using the "Buffers" pull-down select the "Hello.java" program. This will show this file on that window. Then select "xemacs-tutorial.txt" again using the "Buffers" pull-down menu. 7. Syntax highliting -------------------- Xemacs has some other features such as syntax highliting. This will help you find syntax errors in your program faster. Exercise: --------- Click in the "Hello.java" window. Then select the pull-down menu "Options"->"Syntax Highliting"->"Colors". Then select again: "Options"->"Syntax Highliting"->"Automatic". You will see that the different parts of the java program will get different colors. To have java syntax highligting from now on, click the pull-down menu "Options"->"Save Options" 8. Go to a specific line ------------------------ To go to a specific line use and type the line number. To have xemacs always print the line number of a file, type line-number-mode Exercise: --------- In the "Hello.java" window type: <3> . This will move the cursor to the 3rd lne. This option is very useful for fixing compilation errors. 9. Search for a word -------------------- To search for a word type , then type the word you want to search: Exercise: ---------- In the "Hello.java" window click in the first character of the first line. Then type to find the word "String". Type slowly . You will see that xemacs will jump to the word that matches the prefix as you are typing it. To find the next occurrence of the same word type Try finding the "hello" world and then type to find the second occurrence. 10. Replace all the occurences of a word ---------------------------------------- To replace all the occurrences of a word type: "replace-string". xemacs will prompt you for the string you want to replace and for what string. Exercise: ---------- Replace "Hello" by "Howdy" in "Hello.java" In the "Hello.java" window click in the first character of the first line. Then type "replace-string" (Do not type the quotations" "Hello" "Howdy" All the occurrences of Hello will be replaced by Howdy. 11. Help -------- For help, click the pull-down menu "Help" in the upper right corner of the xemacs window. Among other things, there is another "Xemacs Tutorial" that will be useful. Also, there is "List Key Bindings" option that gives a list of the keys that you can use with xemacs. We have covered in this tutorial less than 1% of the total functionality of xemacs. You will learn more about xemacs at the same time you use it. 12. Exit from xemacs -------------------- To exit from xemacs type select the pull-down menu "File"->"Exit Xemacs" or type . If there are modified files, xemacs will ask you if you want to save them. Notes: You don't need to open a new xemacs every time you open a file. You may keep xemacs open during the entire session and load several files in xemacs. Use the "Buffer" pull-down menu to switch from one file to the other. ------------------------------------------------------------------------------- This tutorial has been adapted from a similar tutorial on Gustavo Rodriguez-Rivera's page.