On my IBuffer I always see a *.py file that is actually empty.

Is it possible to prevent this file to be hidden in the Ibuffer or basically remove it.

[ Default ]
    *.py                       0 Python           ~/*.py

On my configuration, I have folliwng line (find-file "*.py" t), which actually help to speed up the opening time of any Python file on my end (honestly not sure why).

I wasn't able to exclude it as well:

(setq recentf-exclude '("__init__.py\\"

More general question should be as: how can I prevent empty files show up on the Ibuffer list that will cover *.py as well since its empty.

1 Answer 1


You're looking for ibuffer's filters. Probably this one / > 0 which filters for buffers bigger than 0.

If you want to make it "default" from the init file, something like this will do it.

(add-hook 'ibuffer-hook (lambda ()(ibuffer-filter-by-size-gt 0)))

Although, note two things:

  • there are a bunch of ibuffer-filter functions, and also a ton of customizable options, in some cases custom defaults may clash with your init file content.
  • There are plenty of options and customizations to filter, also for saving, stacking, grouping filters, etc. Probably it'll be a good idea to dig into them.

Type C-h m while in ibuffer for more info about usage.

  • how can I apply / > 0 ?
    – alper
    Dec 1, 2020 at 11:36
  • just type / > in your ibuffer buffer, you'll be asked for the size in the minibuffer, type 0 then enter
    – Muihlinn
    Dec 1, 2020 at 11:41
  • Can I set this by default in the emacs init file; or like when I call ibuffer it will set files size greater than: 0
    – alper
    Dec 1, 2020 at 11:50
  • article updated
    – Muihlinn
    Dec 1, 2020 at 13:57
  • I am not sure is it related to your answer but when I run ibuffer, each time files size greater than: 0 shows up at the top of the file and appends to the buffer and increases file size. Would it be possible to prevent that to huse [size greater than: 0] message
    – alper
    Jul 12, 2021 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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