Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs view open buffers as a tree

Tags:

emacs

icicles

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.

like image 936
Michael Gummelt Avatar asked Mar 22 '11 04:03

Michael Gummelt


People also ask

How many buffers can be open in Emacs at a time?

The number of buffers you can have really has no limit. Most of the time, only one or two buffers are displayed, but even if you can't see them, all the buffers you create in an Emacs session are still active. You can think of them as a stack of pages, with the one being displayed as the top page.

How do I use buffers in Emacs?

Most buffers are created by visiting files, or by Emacs commands that want to display some text, but you can also create a buffer explicitly by typing C-x b bufname RET . This makes a new, empty buffer that is not visiting any file, and selects it for editing. Such buffers are used for making notes to yourself.

How do I change a buffer from read only in Emacs?

To change the read-only status of a buffer, use C-x C-q (toggle read-only-mode ).

What does buffer mean in EMAC?

Buffers in Emacs editing are objects that have distinct names and hold text that can be edited. Buffers appear to Lisp programs as a special data type. You can think of the contents of a buffer as a string that you can extend; insertions and deletions may occur in any part of the buffer.


2 Answers

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.

like image 62
sanityinc Avatar answered Oct 20 '22 15:10

sanityinc


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

like image 2
paulcam Avatar answered Oct 20 '22 16:10

paulcam