Iswitchb ignore dired buffer

138 Views Asked by At

Is there any way to tell iswitchb to ignore buffers based on mode not string? I would like to exclude the buffers opened in dired mode which are very often the most numerous and it's hard to find opened files in minibuffer among them. Any help on this would be appreciated.

2

There are 2 best solutions below

0
On BEST ANSWER

You can add a custom function to iswitchb-buffer-ignore to do this. There is actually an example in iswitchb.el -- based on that, this will do the trick:

(defun iswitchb-ignore-dired-mode (name)
    "Ignore all dired mode buffers."
    (with-current-buffer name
        (derived-mode-p 'dired-mode)))

(setq iswitchb-buffer-ignore '("^ " iswitchb-ignore-dired-mode))

This preserves the default behavior of ignoring buffer names that begin with a space, and adds the filter for dired-mode buffers.

0
On

Based on a similar example in the iswitchb source code:

(defun iswitchb-ignore-dired-buffers (buffer)
  (with-current-buffer buffer
    (eq major-mode 'dired-mode)))

(add-to-list 'iswitchb-buffer-ignore 'iswitchb-ignore-dired-buffers)