1

I have a dired workflow that I like. From a file-visiting buffer, I'll use dired-jump to pop up to the containing directory. Dired renders the directory in a new buffer with the cursor on the file-entry I came from. Another dired-jump puts me in the parent directory with the cursor on the subdirectory I was in. This makes it easy to drill back down with a series of Return keypresses.

The downside is that dired generates a lot of buffers in order to build such a "breadcrumb" trail. I mitigate this somewhat by reusing buffers on my way down, using dired-find-alternate-file. But I still end up with multiple dired buffers littering the buffer list, so I'd like to find an easy way to toggle hiding dired buffers in IBuffer.

As an example, with a file-tree like,

~        
├── A    
└── B    
    ├── x
    └── y

and starting from the file ~/B/y, running dired-jump results in (using | to represent the cursor position):

buffer contents  buffer list
---------------  -----------
~/B:             ~/B/
.                ~/B/y
..
x
y|

Another dired-jump:

buffer contents  buffer list
---------------  -----------
~:               ~/
.                ~/B/
..               ~/B/y
A
B|

Then find-alternate-file:

buffer contents  buffer list
---------------  -----------
~/B:             ~/B/
.                ~/B/y
..
x
y|

And another find-alternate-file puts me back into file y, with only ~/B/y in my buffer list.

  • 1
    The question is unclear to me. Please provide a recipe to repro the problem (e.g. how reusing Dired buffers interferes with whatever). Is this a question about improving some Dired behavior, or is it, as the title says, just a question about telling Ibuffer to hide some buffers? If the latter, what does it really have to do with Dired? – Drew Oct 15 '16 at 15:29
6

If all you want is to hide *dired* buffers from ibuffer, just add this to your .emacs :-

(add-to-list 'ibuffer-never-show-predicates "^\\*dired")

2

You could use a custom filter group, like so:

/ m dired-mode RET                      ;Filter by dired-mode
/ !                                     ;Negate filter
/ s non-dired RET                       ;Save filter as "non-dired"

(add-hook 'ibuffer-mode-hook
          (lambda nil (ibuffer-add-saved-filters "non-dired")))

Note, that you can negate the filter as desired, in case you need to view the dired buffers.

  • Oh cool! I'll try this, and take a further look at IBuffer filters. – ivan Oct 17 '16 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.