]> code.delx.au - gnu-emacs-elpa/commit
Allow to compose static collections with `counsel--async-command'
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 1 Feb 2016 19:21:19 +0000 (20:21 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 1 Feb 2016 19:21:19 +0000 (20:21 +0100)
commit681738104cf709ffb1eb3209135713eea900552b
treeadc325f777e74a932ec2166171689645d3104d91
parentcf2c7bccd9ecc6e9288c65337525587371f15e82
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))

    (ivy-set-sources
     'counsel-locate
     '((small-test)
       (original-source)))

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.:

    (ivy-set-sources
     'counsel-locate
     '((original-source)
       (small-test)))

Fixes #373
counsel.el
ivy.el