We have the following commands related to files. They are used to visit, save and insert files.
In Emacs, you can edit a file by visiting it. If you wish to visit a file in the current window, you can just type v. Emacs maintains the default directory which is specific to each buffer. Suppose, for instance, that the default directory of the current buffer is /usr/masahiko/lisp/. Then you will get the following prompt in the minibuffer.
visit file: /usr/masahiko/lisp/
If you wish to visit, say, vip.el in this directory, then you can just type ‘vip.el’ followed by <RET>. If the file vip.el already exists in the directory, Emacs will visit that file, and if not, the file will be created. Emacs will use the file name (vip.el, in this case) as the name of the buffer visiting the file. In order to make the buffer name unique, Emacs may add a suffix (see Uniquify). As file name completion is provided here, you can sometimes save typing. For instance, suppose there is only one file in the default directory whose name starts with ‘v’, that is ‘vip.el’. Then if you just type v <TAB> then it will be completed to ‘vip.el’. Thus, in this case, you just have to type v v <TAB> <RET> to visit /usr/masahiko/lisp/vip.el. Continuing the example, let us now suppose that you wished to visit the file /usr/masahiko/man/vip.texinfo. Then to the same prompt which you get after you typed v, you can enter ‘/usr/masahiko/man/vip.texinfo’ or ‘../man/vip.texinfo’ followed by <RET>.
Use V instead of v, if you wish to visit a file in another window.
You can verify which file you are editing by typing g. (You can also type X B to get information on other buffers too.) If you type g you will get an information like below in the echo area:
"/usr/masahiko/man/vip.texinfo" line 921 of 1949
After you edited the buffer (‘vip.texinfo’, in our example) for a while, you may wish to save it in a file. If you wish to save it in the file associated with the buffer (/usr/masahiko/man/vip.texinfo, in this case), you can just say X S. If you wish to save it in another file, you can type X W. You will then get a similar prompt as you get for v, to which you can enter the file name.