If you have to cope with large number of buffers, ibuffer is the only way to keep things manageable. It has support for filtering, sorting and, my favorite, grouping, which is indispensable when you are switching often between various projects and file groups like I do.
However, one thing I always missed is ability to collapse all groups at once - a handy functionality when you have 10-30 groups and you'd not like to be distracted with not important buffers at that point.
Is short, I want from this:
MR Name Size Mode Filename/Process
-- ---- ---- ---- ----------------
[ group 1]
file1 ... ... ...
file2 ... ... ...
[ group 2]
file1 ... ... ...
file2 ... ... ...
[ group 3]
file1 ... ... ...
file2 ... ... ...
to have this:
MR Name Size Mode Filename/Process
-- ---- ---- ---- ----------------
[ group 1 ...]
[ group 2 ...]
[ group 3 ...]
So, here is a small function that will do that:
(defun ibuffer-collapse-all-filter-groups ()
"Collapse all filter groups at once"
(interactive)
(setq ibuffer-hidden-filter-groups
(mapcar #'car (ibuffer-current-filter-groups-with-position)))
(ibuffer-update nil t))
and run it it like:
M-x ibuffer-collapse-all-filter-groups
This code is based on sample I found online but can't find it the link, so apology to the original author for not giving appropriate credits.