Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  Nikana Reklawyks Nov 26 '12 at 22:26

3 Answers 3

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.

share|improve this answer
    
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 '11 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.

share|improve this answer
    
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. –  Nikana Reklawyks Nov 26 '12 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
                (or
                 (mode . c-mode)
                 (mode . c++-mode)
                 (mode . perl-mode)
                 (mode . python-mode)
                 (mode . emacs-lisp-mode)))
               ("LaTeX"
                (mode . latex-mode))
               ("Directories"
                (mode . dired-mode))
               ))))

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.