Can I define sorting order when narrowing down buffers list? #1492
The current sorting is done in
(defun helm-buffers-sort-transformer (candidates _source) (if (string= helm-pattern "") candidates (sort candidates (lambda (s1 s2) (< (string-width s1) (string-width s2))))))
so you can advice this function to do your own sorting. Something like
(defun helm-buffers-sort-transformer@donot-sort (_ candidates _) candidates) (advice-add 'helm-buffers-sort-transformer :around 'helm-buffers-sort-transformer@donot-sort)
then helm will preserve the initial sorting order made by
So glad I found this! The default behavior is very confusing for me: When I see a sorted list in front of me, and I start typing to narrow it down, the order changes. Very often I want the first result that matches a pattern, so I start typing that pattern and expect to be able to hit enter on the first result. But that doesn't happen, because the results are re-sorted.
Is there a reason one would want the sort order to be different before and after they start entering a query?
I would think a lot of users would want the behavior from your provided example by default, and it would be nice if that behavior were explicitly supported or documented.