0

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\\"
            "__init__.py"
            "\\*.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.

2

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.

4
  • how can I apply / > 0 ? – alper Dec 1 '20 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 '20 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 '20 at 11:50
  • article updated – Muihlinn Dec 1 '20 at 13:57

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.