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

I've been using emacs for quite a few years and (like many people), I haven't quite perfected the art of using it yet. One stumbling block I noticed is that when I have several buffers I'm working on, I waste time recalling one buffer name or another as I switch around.

I also use a laptop for much of my work, so this is probably more of an issue than it would be if I had a larger screen with more windows.

I've tried ECB and it's kindof comforting to have a list of files and a directory tree visible, but ultmately, by the time I scroll move my hand to the touchpad and scroll around for the file, I've spent about the same amount time as I would've if I typed in the buffer name in. It ends up just taking up valuable screen real estate.

Does anyone have a good system/tricks for cutting down on time-wasted switching around emacs buffers like this?

share|improve this question
Besides using iswithb or a similar package I also recommend assigning buffer switching to a single key. Buffer switching is a very freuqent operation, so it makes no sense to press 3 keys (C-x b) to activate it. Assign it some otherwise useless key like the INSERT key which is rarely used otherwise (who needs to switch to overwrite mode? and if sometime you do then you can use M-X overwrite-mode instead of wasting a good key for that). Other possible candidates are CapsLock, Right Control, etc, though you may need some help from your OS to bind those in emacs) – Tom Aug 28 '11 at 18:51

Try iswitchb-mode. It's part of emacs and adds more advanced search features to C-x b.

share|improve this answer
thanks, it is indeed a vast improvement over c-x b – qb4 Aug 29 '11 at 17:35

Check out the different buffer switching methods on EmacsWiki.

I recommend iswitchb. You can type any part of the buffer name, so you can get to any buffer by typing a few characters only. Combine this with uniquify for even better results.

share|improve this answer

iswitchb is a great replacement for C-x b. Personally, even thinking of buffer-names is distracting to my workflow. I find it a lot quicker to manage the buffer-list as an MRU (most recently used) stack. Look at buffer-stack and buffer-stack-suppl here emacswiki. This is what alt-tab in Windows does. f10 is the equivalent of bubbling within the same major-mode. S-f10 bubbles amongst all buffers.

share|improve this answer
If you have lots of buffers open (and you should, because closing and opening files is time consuming) then walking the buffer list sequentially is very inefficient. Iswitchb does it much better. – Tom Aug 29 '11 at 9:52
Workflows are subjective. The magic here is that it's not just any sequential order. The buffer list is always in MRU order, which is especially useful because I have a lot of files open. – event_jr Aug 31 '11 at 5:14

C-x C-b.

These old text editors have surprisingly good documentation.

share|improve this answer
i'm aware of C-x C-b. – qb4 Aug 28 '11 at 17:46

Try David Ponce's swbuff.el. It's not in part of emacs, but first hit in google seems to work. Bind it to key strokes with e.g.

(global-set-key [(meta left)]   'swbuff-switch-to-next-buffer)
(global-set-key [(meta right)]   'swbuff-switch-to-previous-buffer)
share|improve this answer

Try speedbar. It's part of emacs. (It probably use as much screen real estate as ECB, and thus not a valid answer to you.)

share|improve this answer
maybe there's some advanced functionality to make it useful, but I wasn't a huge fan. The floating frame is also kindof a pain to arrange on the screen (using osx atm). Is there something about speedbar that makes it worthwhile, or is it basically just a file browser? – qb4 Aug 30 '11 at 2:38

You might want to try tabbar-mode. tabbar-mode puts a series of tabs (like in a browser, not like tab-stops) along the top of your emacs editing window. You can select which buffer you want by clicking on the appropriate tab. (This actually simulates the default behavior of XEmacs.)

I have only played a little bit with tabbar-mode as its tab display gets written over by StickyFunc-mode.

share|improve this answer

You must log in to answer this question.

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