prepending a custom list of paths to counsel-locate results list #373

drorbemet opened this Issue Jan 31, 2016 · 3 comments


None yet

2 participants


I would like to prepend a list of special files to the results of counsel-locate each time just before it is called. So that they are up to date and included and filtered by the entered search pattern and appear at the top if they match.
How would a proper recipe for that look like?

I found something about virtual-buffers here but I am still not sure how to go about this in general.

@abo-abo abo-abo added a commit that closed this issue Feb 1, 2016
@abo-abo Allow to compose static collections with `counsel--async-command'
* ivy.el (ivy--sources-list): New defvar.
(ivy-set-sources): New defun that sets `ivy--sources-list'
(ivy--extra-candidates): New defvar.
(ivy-read): Use `ivy--sources-list' to set `ivy--extra-candidates' - a
list that composes itself with `ivy--all-candidates'.
(ivy--set-candidates): New defun.

Example - stack `recentf' on top of `counsel-locate':

    (defun small-test ()
      (cl-subseq recentf-list 0 10))


Here, (original-source) represents the async candidates of
`counsel-locate'. All extra sources are static - each function is called
once to generate a list of strings, which will be filtered later.

The order matters, so you can have e.g.:


Fixes #373
@abo-abo abo-abo closed this in 6817381 Feb 1, 2016
abo-abo commented Feb 1, 2016

Thanks, have a look at commit msg for description of use.


Great, this is what I had in mind. Thanks.

abo-abo commented Feb 2, 2016

Feel free to add a comment to the wiki if you have the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment