4

When I run M-x helm-buffers-list it shows list of buffers in the order of their last visit.

enter image description here

Since I open quite a few dired buffers, when helm-buffers-list is invoked, dired buffers are occupying lots of visible space.

How can i move all dired buffers to bottom and have other files at top?

1
  • 1
    I guess you can advice helm-buffers-sort-transformer. BTW, you can use *!dired to filter out all Dired buffers. Commented Oct 6, 2015 at 15:03

1 Answer 1

6

helm-buffers-sort-transformer is used to sort buffers.

(defun sort-dired-buffers (buffers) "Sort BUFFERS by moving all Dired buffers to the end." (let (dired-buffers other-buffers) (dolist (buf buffers) (if (with-current-buffer buf (eq major-mode 'dired-mode)) (push buf dired-buffers) (push buf other-buffers))) (nreverse (append dired-buffers other-buffers)))) (defun helm-buffers-sort-dired-buffers (orig-fun &rest args) (sort-dired-buffers (apply orig-fun args))) (advice-add 'helm-buffers-sort-transformer :around #'helm-buffers-sort-dired-buffers) 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.