I don't use counselcounsel
or ivyivy
, but you can execute arbitrary elisp as part of a link. If I wanted to store search results from, say, M-x occur
, I would use something like: [[elisp:(occur "phrase")][Search for phrase in this buffer]]
That approach has the downside of prompting you to "Execute ... as elisp (y or n)"Execute ... as elisp (y or n)
, which could be annoying. If you make this sort of link often, you might consider adding a custom link type with (org-add-link-type "occur" (lambda (key) (occur key)))
And then you can type occur:blahoccur:blah
, and it will be highlighted as a link without a prompt. You'll have to change it to work with ivy-occur
of course.