emacs view open buffers as a tree
Asked Answered
P

3

5

Is there any emacs mode that will give me a list of my open buffers as a tree? By tree, I mean a directory tree, where buffers are grouped together if they are visiting files that reside in the same directory.

In vanilla emacs, or even icicles mode, the views I have seen of the buffer list have all been flat. A tree view would help me more quickly make sense of which buffers are open and the relation between them.

Pounds answered 22/3, 2011 at 4:13 Comment(0)
E
2

Possibly a bit heavyweight for what you want, but have you looked at Project Buffer Mode?

Expiate answered 22/3, 2011 at 8:26 Comment(0)
S
6

Although it doesn't exactly provide a tree view, I think you'd be happy with the grouping features in ibuffer-mode which is an alternative to the default buffer list mode. It's built into Emacs >= 22.

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

There's an Emacswiki page, but the best overview of the grouping features is probably this blog article.

Edit: I just hacked together some code to group my own ibuffer list by the vc parent directory of each buffer. It also allows ibuffer to display the version control status of each listed file. Perhaps you'll find that helpful.

Scrawl answered 22/3, 2011 at 9:35 Comment(3)
ibuffer's default grouping doesn't seem to be based on the directory location. I actually don't see any rhyme or reason to the grouping. perhaps I'm missing a view. I will look at your code thought, it looks promising.Pounds
I think the default view is by 'recency', ie. when the buffers were last modified. But even in the vanilla configuration you can already run M-x ibuffer-do-sort-by-filename/process, which is helpful.Scrawl
Michael Gummelt: the defaults are just defaults -- for example, you can filter by filepath (e.g. the root of your project), create a named group out of that filter, and save your filter groups for future use. Or use the nifty ibuffer-vc which sanityinc wrote and linked to :)Mutant
E
2

Possibly a bit heavyweight for what you want, but have you looked at Project Buffer Mode?

Expiate answered 22/3, 2011 at 8:26 Comment(0)
A
0

http://www.emacswiki.org/emacs/BufferMenuPlus. Sort by dir+file name.

Albur answered 28/4, 2011 at 19:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.