11

I am working on several projects right now. I want a single instance of Emacs to handle them all. What I want is a tmux-like behavior wherein every 'window' (in the Emacs sense) corresponds to a projects which contains buffers of the files related to that project. There are several windows, with each corresponding to a project and I should be able to switch between them (something similar to C-b w)

Is this functionality already present in some form? I guess it'll be cool to have as the other options are either:

  • Have several instances of Emacs open.
  • Have all files of all projects in a single instance which makes switching buffers a pain.
sudeepdino008
  • 213
  • 1
  • 6
  • 2
    For project management, have you tried [perspective](https://github.com/nex3/perspective-el)? – cutejumper Mar 01 '16 at 18:42
  • If you are willing to invest some initial setup time to define conditions for projects, you can allocate them to one frame each and use `frame-bufs`. See also **How to intercept a file before it opens and decide which frame** -- http://stackoverflow.com/questions/18346785/how-to-intercept-a-file-before-it-opens-and-decide-which-frame -- to display a buffer in a target frame, and you can use `frame-buffs--add-buffer` in conjunction to get the frame associated. You can marry `frame-bufs` with `tabbar` and associate/remove buffers dynamically: http://emacs.stackexchange.com/a/10112/2287 – lawlist Mar 02 '16 at 01:42
  • Here is the link to `frame-bufs` to associate buffers with a particular frame: https://github.com/alpaker/Frame-Bufs/blob/master/frame-bufs.el – lawlist Mar 02 '16 at 01:50
  • @cutejumper Perspective is perfect. You could write it as an answer so that I could tick it correct. – sudeepdino008 Mar 02 '16 at 14:17
  • Try this blog post on [Emacs as an advanced terminal multiplexer](https://iloveemacs.wordpress.com/2014/09/10/emacs-as-an-advanced-terminal-multiplexer/): you'll get Tmux-like behaviour. I just stumbled upon it, put it to work and it does what it advertises. On top you'll get `ace-jump-mode`, in itself a cool solution for quickly jumping around with your cursor in a buffer (if you don't already have it). –  Mar 02 '16 at 00:28
  • @sudeepdino008 Sure. See http://emacs.stackexchange.com/a/20709/5482. – cutejumper Mar 03 '16 at 04:05

4 Answers4

7

You can use perspective to manage projects. From its README:

perspective.el provides multiple workspaces (or "perspectives") for each Emacs frame. This makes it easy to work on many separate projects without getting lost in all the buffers.

Each perspective is composed of a window configuration and a set of buffers. Switching to a perspective activates its window configuration, and when in a perspective only its buffers are available by default.

There is also another version persp-mode, which is a little different from the original one. The perspectives are shared among frames and the states can be saved to the disk.

If you're using projectile, there is also a perspective integration.

cutejumper
  • 787
  • 5
  • 12
5

You can try eyebrowse mode, which manages multiple (perhaps complicated) window layouts. You can switch between window configurations with keystrokes such as C-c C-w 1 and C-c C-w 2.

Eric Brown
  • 3,212
  • 4
  • 16
  • 20
2

A "barebones" solution might to use C-x r w to record the current window state and C-x r j to get back to an earlier one.

Stefan
  • 26,154
  • 3
  • 46
  • 84
2

I use a combination of a couple different packages.

Most importantly, I use Projectile for working on a "project" and fuzzy-finding files. I use multiple frames, one for each project I'm currently working on. You really only need to know C-x 5 2 and C-x 5 0 to create/kill a frame. To manage switching between projects and for storing the state of window configuration/splits, I use Workgroups for windows (for emacs).

I like this setup because I can potentially swap out one package for another.