Learning GNU Emacs, 3rd Edition
by Debra Cameron, James Elliott, Marc Loy, Eric S. Raymond, Bill Rosenblatt
Opening a File
You can open a file by specifying the filename when you start Emacs from the command line or by typing C-x C-f (the long command name is find-file).
The paper icon on the toolbar also runs this command. In some applications, a similar icon simply creates a new, unnamed file (e.g., Document1 in Word). Emacs expects you to provide a filename, as we'll see in a moment.
|
Press: C-x C-f |
|
![]()
|
|
Emacs prompts you for a filename. |
To press C-x C-f, hold down Ctrl, press x and then press f. Now release Ctrl.
After you press C-x C-f, Emacs uses the minibuffer to ask you for the filename. Whenever Emacs wants input from you, it puts the cursor in the minibuffer. When you're done typing in the minibuffer, press Enter.
|
Type: |
|
![]()
|
|
Emacs starts another buffer with the new file in it. |
What if you try to read the same file twice? Instead of creating a new buffer, Emacs just moves you to the buffer the file is in.
You can also open a file in Emacs by dragging and dropping it on an Emacs window or on the Emacs icon.
Now is a good time to try typing if you haven't already done so. You may find yourself wanting to learn more about cursor movement and editing; that's fine. Feel free to skim the rest of this chapter and go on to Chapter 2. We recommend that you read the sections on ...

