16

I am always working on multiple code bases at the same time. Usually an internal library, a web app and some service.

Is there a way with Emacs to have multiple buffers open for each code base but have those buffers grouped? Like a tab for each code base or groups I can easily switch between.

I've checked out tabbar-mode which isn't what I'm looking for. I'm looking for an easy way to quickly switch from working on one code base to another. Like saving a set of windows for each project and quickly switching between them.

Any ideas?

jpoz
  • 2,257
  • 1
  • 23
  • 29
  • 1
    [check this out](http://scottfrazersblog.blogspot.com/2009/12/emacs-named-desktop-sessions.html) – Tom Apr 02 '12 at 09:49
  • 1
    You need to clarify what exactly you're looking for. Is it a graphical widget like a tab you click on? What happens after you click it? – event_jr Apr 02 '12 at 10:02
  • Here is a link to what has become what I consider to be the authoritative thread on tabbar style buffer grouping: https://emacs.stackexchange.com/questions/10081/browser-style-tabs-for-emacs – lawlist Aug 17 '17 at 20:34

5 Answers5

8

A few suggestions:

  1. ibuffer is an advanced replacement for list-buffers which you can bind to C-xC-b in its place. This lets you filter the buffer list by various criteria, combine filters into groups, and arrange the groups however you wish; you can also save your filters and groups to restore later. Use C-hm from the ibuffer buffer to see all the options. See also: Emacs: help me understand file/buffer management

  2. Try one of the various screen-like libraries for Emacs, such as Elscreen or Escreen. I've never gotten around to trying them out myself, but I gather that you can have separate buffer lists per screen, which seems like it would suit your purposes.

  3. If you want even greater separation, such that when one project is 'active' the buffer from the other(s) are unavailable, then I don't know of a way of doing that in a single instance of Emacs, but in that situation I would simply start multiple instances of Emacs; one for each project. Emacs is sufficiently lightweight on modern hardware that this is an entirely reasonable approach.

Community
  • 1
  • 1
phils
  • 71,335
  • 11
  • 153
  • 198
6

Have a look at projectile - a simple and unobtrusive project management lib for Emacs. One of its features is exactly switching to buffers from a specific project (C-c p b).

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
5

I use ibuffer for this purpose, together with my ibuffer-vc extension (available via Marmalade); this extension groups buffers according to the version-control project to which they belong, which is IMO an ideal programmer-oriented way of grouping buffers.

sanityinc
  • 15,002
  • 2
  • 49
  • 43
0

I'll give projectile another vote too. And there is an excellent tutorial (part of a series of, in fact) on how to use projectile and helm effectively provided here:

Exploring large projects with Projectile and Helm Projectile

helm is so great that I can't live without it! So another suggestion is to read this tutorial:

A Package in a league of its own: Helm

victl
  • 161
  • 1
  • 6
0

@Phils answer is the right one: ibuffer is the standard way to go, funny BTW that the official doc doesn't even mention it.

I personally remap the old (list-buffers) to it:

(global-set-key (kbd "C-x C-b") 'ibuffer) 

As for the "grouping" part of your question, you can use this:

(defvar ibuffer-saved-filter-groups
  '(("home"
     ("emacs-config" (or (filename . ".emacs.d")
                         (filename . ".emacs")))         
     ("Org" (or (mode . org-mode)
                (filename . "OrgMode")))
     ("Faust" (or (mode . faust-mode)
                  (filename . "\\.dsp\\'")))
     ("Help" (or (name . "\*Help\*")
                 (name . "\*Apropos\*")
                 (name . "\*info\*"))))))
yPhil
  • 8,049
  • 4
  • 57
  • 83