File: esh-worker.el.html

Workers are an Emacs Lisp-based analogue to external processes, allowing for piping command output into them to perform some action. For example, to uppercase the output of some other command:

  echo hi | #'upcase

;_* accumulate worker

Eshell provides several ways to pipe output into a Lisp function. The simplest is the "accumulate" worker, which is the default behavior when piping directly to a Lisp function as above. You can also express this explicitly, as in:

  echo hi | accumulate #'upcase

;_* map-lines worker

You can also map each line of output to a function, similar to how mapcar works. For example, you could "quote" some output for pasting into an email like this:

  cat some-file.txt | map-lines (lambda (i) (format "> %s" i))

This also shows how you use lambda functions as pipe targets in Eshell.

;_* apply-lines worker

Finally, you can apply each line of output as successive arguments to a function. For example, to sum up a list of numbers written one per line:

  cat numbers.txt | apply-lines #'+

Defined variables (0)

Defined functions (75)

copy-eshell-accumulate-worker(ARG)
copy-eshell-apply-lines-worker(ARG)
copy-eshell-map-lines-worker(ARG)
eshell--apply-print(FUNCTION ARGS)
eshell-accumulate-worker--make-buffer(WORKER)
eshell-accumulate-worker-buffer-or-value(eshell-accumulate-worker-buffer-or-value X)
eshell-accumulate-worker-buffer-or-value--inliner(INLINE--FORM X)
eshell-accumulate-worker-create
eshell-accumulate-worker-create--cmacro
eshell-accumulate-worker-ensure-newline-p(eshell-accumulate-worker-ensure-newline-p X)
eshell-accumulate-worker-ensure-newline-p--inliner(INLINE--FORM X)
eshell-accumulate-worker-eshell-buffer(eshell-accumulate-worker-eshell-buffer X)
eshell-accumulate-worker-eshell-buffer--inliner(INLINE--FORM X)
eshell-accumulate-worker-function(eshell-accumulate-worker-function X)
eshell-accumulate-worker-function--inliner(INLINE--FORM X)
eshell-accumulate-worker-output-handles(eshell-accumulate-worker-output-handles X)
eshell-accumulate-worker-output-handles--inliner(INLINE--FORM X)
eshell-accumulate-worker-p(X)
eshell-accumulate-worker-p--inliner(INLINE--FORM X)
eshell-accumulate-worker-status(eshell-accumulate-worker-status X)
eshell-accumulate-worker-status--inliner(INLINE--FORM X)
eshell-apply-lines-worker-args(eshell-apply-lines-worker-args X)
eshell-apply-lines-worker-args--inliner(INLINE--FORM X)
eshell-apply-lines-worker-create
eshell-apply-lines-worker-create--cmacro
eshell-apply-lines-worker-current-line(eshell-apply-lines-worker-current-line X)
eshell-apply-lines-worker-current-line--inliner(INLINE--FORM X)
eshell-apply-lines-worker-ensure-newline-p(eshell-apply-lines-worker-ensure-newline-p X)
eshell-apply-lines-worker-ensure-newline-p--inliner(INLINE--FORM X)
eshell-apply-lines-worker-eshell-buffer(eshell-apply-lines-worker-eshell-buffer X)
eshell-apply-lines-worker-eshell-buffer--inliner(INLINE--FORM X)
eshell-apply-lines-worker-function(eshell-apply-lines-worker-function X)
eshell-apply-lines-worker-function--inliner(INLINE--FORM X)
eshell-apply-lines-worker-output-handles(eshell-apply-lines-worker-output-handles X)
eshell-apply-lines-worker-output-handles--inliner(INLINE--FORM X)
eshell-apply-lines-worker-p(X)
eshell-apply-lines-worker-p--inliner(INLINE--FORM X)
eshell-apply-lines-worker-status(eshell-apply-lines-worker-status X)
eshell-apply-lines-worker-status--inliner(INLINE--FORM X)
eshell-get-pipe(OBJECT)
eshell-map-lines-worker--apply(LINE TARGET)
eshell-map-lines-worker-create
eshell-map-lines-worker-create--cmacro
eshell-map-lines-worker-current-line(eshell-map-lines-worker-current-line X)
eshell-map-lines-worker-current-line--inliner(INLINE--FORM X)
eshell-map-lines-worker-ensure-newline-p(eshell-map-lines-worker-ensure-newline-p X)
eshell-map-lines-worker-ensure-newline-p--inliner(INLINE--FORM X)
eshell-map-lines-worker-eshell-buffer(eshell-map-lines-worker-eshell-buffer X)
eshell-map-lines-worker-eshell-buffer--inliner(INLINE--FORM X)
eshell-map-lines-worker-function(eshell-map-lines-worker-function X)
eshell-map-lines-worker-function--inliner(INLINE--FORM X)
eshell-map-lines-worker-output-handles(eshell-map-lines-worker-output-handles X)
eshell-map-lines-worker-output-handles--inliner(INLINE--FORM X)
eshell-map-lines-worker-p(X)
eshell-map-lines-worker-p--inliner(INLINE--FORM X)
eshell-map-lines-worker-status(eshell-map-lines-worker-status X)
eshell-map-lines-worker-status--inliner(INLINE--FORM X)
eshell-worker--error(WORKER ERROR)
eshell-worker-create
eshell-worker-create--cmacro
eshell-worker-ensure-newline-p(eshell-worker-ensure-newline-p X)
eshell-worker-ensure-newline-p--inliner(INLINE--FORM X)
eshell-worker-eshell-buffer(eshell-worker-eshell-buffer X)
eshell-worker-eshell-buffer--inliner(INLINE--FORM X)
eshell-worker-initialize()
eshell-worker-name(WORKER)
eshell-worker-output-handles(eshell-worker-output-handles X)
eshell-worker-output-handles--inliner(INLINE--FORM X)
eshell-worker-p(X)
eshell-worker-p--inliner(INLINE--FORM X)
eshell-worker-status(eshell-worker-status X)
eshell-worker-status--inliner(INLINE--FORM X)
eshell/accumulate(FUNCTION)
eshell/apply-lines(FUNCTION)
eshell/map-lines(FUNCTION)

Defined faces (0)