Next: , Previous: , Up: Files   [Contents][Index]

7.2 Visiting Files

To edit a file in Emacs you need to visit it. Visiting a file means copying its contents (or reading them) into the current buffer. Emacs will create a new buffer for each file that you visit. The buffer will be named after the file that you open. If you open a file /usr/workspace/myfile.texinfo, the buffer will be called "myfile.texinfo". If a buffer with this name already exists, a unique name will be constructed by appending ‘<2>’, ‘<3>’, etc. If this is the second buffer with the same name, a "<2>" will be appended, "<3>" for a third buffer and so on. The name of the buffer which is being displayed in the window will be shown both at the top and bottom of the frame. Once you are in SXEmacs, you can use the following commands:

C-x C-f

This command will visit a file (find-file). It will prompt you for a file name to visit. The Open... option from the File menu does the same thing:

Find file: /usr/workspace/

Type in a filename and press RET. You will see a new buffer on the screen with its name in the mode-line. If the filename you specify already exists in Emacs, the buffer containing that file will be selected. You will get an error message if the filename does not exist. If you still press RET, a new buffer with the given filename will be displayed on the screen.

C-x C-v

This command (find-alternate-file), will visit a different file instead of the one visited last. It is similar to C-c C-f except that it kills the current buffer (after offering to save it).

C-x 5 C-f

This command will visit a file in another frame (find-file-other-frame) without changing the current window or frame. The Open in New Frame... from the File menu will do the same thing. It will prompt you for a file name in the echo area. After you type the file name and press RET, the specified file will be read into a new buffer and displayed on a new frame.

Next: , Previous: , Up: Files   [Contents][Index]