Function: consult--async-pipeline
consult--async-pipeline is a byte-compiled function defined in
consult.el.
Signature
(consult--async-pipeline &rest ASYNC)
Documentation
Compose ASYNC pipeline.
An async function must accept a single SINK argument and return a function accepting a single ACTION argument. In functional programming terminology, an async function is curried.
(lambda (sink)
(lambda (action)
...))
Async functions are composed with consult--async-pipeline as in the
following example. The data flows downwards starting with the input
from the user.
(consult--async-pipeline
(consult--async-min-input)
(consult--async-throttle)
(consult--async-process #'consult--man-builder)
(consult--async-transform #'consult--man-format)
(consult--async-highlight #'consult--man-builder))
Nil functions are ignored to ease building conditional pipelines.
(consult--async-pipeline
(consult--async-min-input min-input)
(consult--async-throttle throttle debounce)
(consult--async-dynamic fun)
transform
(and highlight (consult--async-highlight highlight)))
Async functions or pipelines can be passed as completion function to
consult--read or used as :async field of consult--multi sources as
shown in these examples:
(consult--read (consult--async-pipeline ...))
(consult--read (consult--dynamic-collection (lambda (input) ...)))
(consult--read (consult--process-collection #'consult--man-builder))
(defvar async-source
(list :async (consult--async-pipeline ...)))
(defvar dynamic-source
(list :async (consult--dynamic-collection (lambda (input) ...))))
(defvar command-source
(list :async (consult--process-collection #'consult--man-builder)))
Incoming candidates and the action argument should be passed to the sink. The action can take the following forms:
'setup Setup the internal closure state. Return nil.
'destroy Destroy the internal closure state. Return nil.
'flush Flush the list of candidates. Return nil.
'refresh Request UI refresh. Return nil.
'cancel Cancel any running process. Return nil.
nil Return the list of candidates.
list Append to the existing candidates list and return the whole list.
string Update with the current user input string. Return nil.
For the 'setup action it is guaranteed that the call originates from the minibuffer. For the other actions no assumption about the context can be made.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
;;;; Asynchronous pipeline
(defun consult--async-pipeline (&rest async)
"Compose ASYNC pipeline.
An async function must accept a single SINK argument and return a
function accepting a single ACTION argument. In functional programming
terminology, an async function is curried.
(lambda (sink)
(lambda (action)
...))
Async functions are composed with `consult--async-pipeline' as in the
following example. The data flows downwards starting with the input
from the user.
(consult--async-pipeline
(consult--async-min-input)
(consult--async-throttle)
(consult--async-process #\\='consult--man-builder)
(consult--async-transform #\\='consult--man-format)
(consult--async-highlight #\\='consult--man-builder))
Nil functions are ignored to ease building conditional pipelines.
(consult--async-pipeline
(consult--async-min-input min-input)
(consult--async-throttle throttle debounce)
(consult--async-dynamic fun)
transform
(and highlight (consult--async-highlight highlight)))
Async functions or pipelines can be passed as completion function to
`consult--read' or used as `:async' field of `consult--multi' sources as
shown in these examples:
(consult--read (consult--async-pipeline ...))
(consult--read (consult--dynamic-collection (lambda (input) ...)))
(consult--read (consult--process-collection #\\='consult--man-builder))
(defvar async-source
(list :async (consult--async-pipeline ...)))
(defvar dynamic-source
(list :async (consult--dynamic-collection (lambda (input) ...))))
(defvar command-source
(list :async (consult--process-collection #\\='consult--man-builder)))
Incoming candidates and the action argument should be passed to the
sink. The action can take the following forms:
\\='setup Setup the internal closure state. Return nil.
\\='destroy Destroy the internal closure state. Return nil.
\\='flush Flush the list of candidates. Return nil.
\\='refresh Request UI refresh. Return nil.
\\='cancel Cancel any running process. Return nil.
nil Return the list of candidates.
list Append to the existing candidates list and return the whole list.
string Update with the current user input string. Return nil.
For the \\='setup action it is guaranteed that the call originates from
the minibuffer. For the other actions no assumption about the context
can be made."
(lambda (sink)
(seq-reduce (lambda (s f) (funcall f s)) (delq nil (reverse async)) sink)))