Is it possible to create buffer groups in Emacs, to better organize large numbers of buffers?

For instance, say I'm working on multiple branches of a software project. I may have opened separate buffers for branched variants of the same file. I want to be able to group the buffers by branch and be able to see the buffers belonging just to the current branch.

Grouping (or tagging) buffers in an arbitrary way (not necessarily by source code branch) could also be useful.

  • As a sign of my disaprovement of the seemingly-common-in-the-parts-of-SU-I-frequent behaviour of only accepting answers once they fit perfectly into one's setup (like there's an "after-sales service" to provide with answers to be accepted), I'll wait till this interesting question has an accepted answer to upvote it. Nov 26, 2012 at 22:26

4 Answers 4


Exactly fitting your needs is the perspective mode (https://github.com/nex3/perspective-el). It fits exactly the case that your describing which is similar to the workspaces concept in GNOME and KDE. This mode works great with projectile-mode and helm-mode, which enhance your emacs to handle projects better and search through them better respectively.

If you do not want to go through the hassle of setting up these modes all by yourself, I suggest you install the prelude for emacs and simple setup perspective along with it. You can checkout my emacs configuration (https://github.com/ksinkar/prelude) to see how I have done it.


I think you might be looking for something like ibuffer (built into the most recent versions). Its basically like dired for buffers.

M-x ibuffer
% n *.py  # marks all buffers whose name ends with .py
t         # inverts the marked buffers. Those which had marks, are unmarked and vice versa.
k         # removed marked buffers from the list.

You should now have a buffer which lists all files which end in *.py.

For more information, you can C-h m (view mode help) when in the ibuffer mode.

  • Looking more into ibuffer, it appears that it supports named filter groups. If you add information on this to your answer, I'll accept it. Thanks!
    – Ray
    Apr 28, 2011 at 1:56

I would recommend trying elscreen: http://www.morishima.net/~naoto/software/elscreen/ Basically it allows you to create groups of buffers and switch between them as if they were tabs in a web browser. One of my favourite features of elscreen is that frame splits can be different between each group, which can be very useful when working on different tasks.

  • It's definitely a nice tool, but I wouldn't advice it for this question, as that won't do for many buffers, and any group is very easy to lose whenever anything does a C-x 1. Basically, it's all about display, there is no underlying stored state, afaik. Nov 26, 2012 at 22:19

Also using iBuffer you could add the following to your .emacs

(setq ibuffer-saved-filter-groups
      (quote (("default"
               ("Org" ;; all org-related buffers
                (mode . org-mode))
               ("Programming" ;; prog stuff not already in MyProjectX
                 (mode . c-mode)
                 (mode . c++-mode)
                 (mode . perl-mode)
                 (mode . python-mode)
                 (mode . emacs-lisp-mode)))
                (mode . latex-mode))
                (mode . dired-mode))

This example, will group buffers in org together. Buffers that have c-mode, c++-mode, pels-mode etc will be grouped.

You must log in to answer this question.

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