Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At the moment I use C-xC-f to open a new file, but it gets quite tedious.

share|improve this question
What's your goal? Opening a bunch of files at once? Or managing lots of already opened files? – Török Gábor Feb 19 '10 at 11:02
Or do you just want to see multiple files at once? Because Emacs does keep all these files "open" (in a sense, they are loaded, but aren't "open" in a "file descriptor is open" sense). – Jürgen A. Erhard Feb 19 '10 at 11:16
I want to edit several source files of a program – Zubair Feb 19 '10 at 11:17
up vote 14 down vote accepted

When you load a file in Emacs with find-file (bound to ctrl-x ctrl-f by default), it gets put into a "buffer". As long as you don't kill the buffer, it stays in memory, you don't have to reload it.

You access already loaded files (buffers) with switch-to-buffer (bound to ctrl-x b). Press the keys, then type the buffer name you want to switch to (by default that's the basename for any loaded file).

You can also press ctrl-x ctrl-b to get a list of currently existing buffers. And click any buffer there with the mouse to switch to it (IIRC, rarely use the mouse with Emacs ;-))

You can also split the screen in two (or more) parts to see different files (buffers) with ctrl-x 2. Initially, this shows the same buffer twice. Switch to another buffer in one of the windows to see another file.

share|improve this answer
C-x 3 can also be used to split screen in two, C-x 0 to show only one buffer at once. – Rémi Oct 22 '12 at 21:03

C-x b and C-x C-b are what you want. Also consider trying iswitchb or ido. Since I started using those I wish every program I used could switch tabs / windows / documents as quickly and conveniently as emacs. Often I have 50 files or more open in emacs, you can find the one you want very quickly with iswitchb or ido.

share|improve this answer

Also, if you are using a graphical version of emacs, you can do ctrl-x 5 b to open an existing buffer in a new window (called a frame in emacs-speak), or ctrl-x 5 f to load a new file in a new window.

share|improve this answer
c-x 5 b also works in a tty, but switching frames is annoying in tty mode :) – Justin Smith Feb 19 '10 at 15:41
@Justin Thanks. I've never played with frames in a tty. Is there any benefit over just using multiple buffers. – KeithB Feb 19 '10 at 20:21
You can use frames vs windows the way you would use workspaces vs. windows in a Linux window manager - ie. for working on elisp code frame 1 has two windows, one with the info file for elisp, the other with ielm for interactively trying code, frame 2 has only one window, with whichever file you are editing (so you can get as many lines visible as possible it is unsplit). With a decent keybinding for other-frame it could be a very productive arrangement if you for some reason did not want to be running X. – Justin Smith Feb 19 '10 at 20:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .