counsel-projectile, cp-switch-to-buffer: fix default sorting

When the collection is a function, it is this function that must be
added to `ivy-sort-functions-alist`. Adding the caller instead has no
effect.

Note that at the moment, sorting may not work correctly if the default
is changed, due to an issue in ivy with sorting with collection
functions. See abo-abo/swiper/pull/1592.
This commit is contained in:
Eric Danan 2018-05-27 22:28:12 +02:00
parent a95ef966ae
commit 8f85a392d8

View file

@ -511,8 +511,8 @@ This simply applies the same transformer as in `ivy-switch-buffer', which is `iv
:keymap counsel-projectile-switch-to-buffer-map
:caller 'counsel-projectile-switch-to-buffer))
(unless (assq #'counsel-projectile-switch-to-buffer ivy-sort-functions-alist)
(push (list #'counsel-projectile-switch-to-buffer) ivy-sort-functions-alist))
(unless (assq #'counsel-projectile--project-buffers ivy-sort-functions-alist)
(push (list #'counsel-projectile--project-buffers) ivy-sort-functions-alist))
(ivy-set-display-transformer
'counsel-projectile-switch-to-buffer
@ -1242,8 +1242,8 @@ If not inside a project, call `counsel-projectile-switch-project'."
:keymap counsel-projectile-map
:caller 'counsel-projectile)))
(unless (assq #'counsel-projectile ivy-sort-functions-alist)
(push (list #'counsel-projectile) ivy-sort-functions-alist))
(unless (assq #'counsel-projectile--project-buffers-and-files ivy-sort-functions-alist)
(push (list #'counsel-projectile--project-buffers-and-files) ivy-sort-functions-alist))
(ivy-set-display-transformer
'counsel-projectile