Opening a File in XEmacs


Opening a File Directly

You can open a file for editing in XEmacs using the "File" menu. For this tutorial, we will create a copy of the file /class/sce/reference/xemacs/sample and edit it in XEmacs. Let us create a copy of this file.
 
These next two commands should be entered in your xterm window and NOT in the emacs window!
  • Make sure you are in your home directory. Now create a directory Testdir in your home directory.
  • Copy the file /class/sce/reference/xemacs/sample into the directory Testdir.
  • Now switch over to your XEmacs window. Move the mouse pointer so that it is located on the "File" menu, and hold down the left mouse button. While holding down the button, drag the mouse down the screen until the first menu item "Open..." is highlighted. Now release the mouse button. 
  • Alternatively, you can also open a file simply by clicking on the Open icon that appears in the icon row just below the "File" menu.

    Notice again that next to the item in the "File" menu was the key combination C-x C-f for performing the same function from the XEmacs command line. As a review, the letter C is short for the Control (Ctrl) key. C-x means hold the Ctrl key down and press x. In other words, to achieve the same effect as choosing the "Open..." menu item, you could hold the Ctrl key down and press x and then hold the Ctrl key down and press f. In some cases, you will see a command like Esc %. This means you should press the Esc key (release it), and then press the % key.

    If you open a file using the key combination C-x C-f, the command line at the bottom of the XEmacs window should now display the prompt:  Find file: ~/

    If you open a file using either of the mouse-based options, a window will pop up instead, which displays the contents of the current directory followed by the same prompt as above. The window will often be too small to display every file in the directory, but you can click and drag along the scroll bar to bring the other files into the viewing window.

    Recall now that ~ is an abbreviation for the name of your home directory. We are interested in opening the file ~/Testdir/sample. We could type the rest of the filename (Testdir/sample) at this point and XEmacs would open the file.

    Opening a File From a Directory Listing

    Instead, we'll use another way that most people find far easier to use than the Open command or icon, and which we therefore recommend that you use when you want to open a file in a buffer.  The directory edit feature (dired) lets you view directories and select files within the directories. This is usually a more convenient way to open a file than typing in its (possibly long) path name.
     
  • Hit Enter after getting the prompt:   Find file: ~/.  XEmacs will display the complete and long listing (ls -la) of the directory contents. Note that the mouse pointer does not need to be located in the command line area when you hit Enter; it can be anywhere in the XEmacs window. 
  • Using the Arrow keys or clicking with the left button of the mouse, move the cursor to select the subdirectory called Testdir which contains the file you want edit. Now press Enter or 'f' (for find), and the XEmacs window will open a buffer to display the contents of the directory Testdir. (Alternatively, you can simply click on the name of the directory you want to see with the middle mouse button.)
  • Select the line containing the file sample and press Enter or 'f' again as above, and the file will be loaded into a new XEmacs buffer.  (Alternatively, you can simply click on the name of the file you want to edit with the middle mouse button.)
  • Stop for a moment and scan over the menus to get an idea of the different key stroke shortcuts. You'll find them very useful!



     
    Previous Table of Contents Continue


    Last modified: Thu Jan 8 17:27:12 EST 1998