Function: eshell-do-pipelines

eshell-do-pipelines is a macro defined in esh-cmd.el.gz.

Signature

(eshell-do-pipelines PIPELINE &optional NOTFIRST)

Documentation

Execute the commands in PIPELINE, connecting each to one another.

This macro calls itself recursively, with NOTFIRST non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defmacro eshell-do-pipelines (pipeline &optional notfirst)
  "Execute the commands in PIPELINE, connecting each to one another.
This macro calls itself recursively, with NOTFIRST non-nil."
  (when (setq pipeline (cadr pipeline))
    `(eshell-copy-handles
      (progn
	,(when (cdr pipeline)
	   `(let ((nextproc
		   (eshell-do-pipelines (quote ,(cdr pipeline)) t)))
              (eshell-set-output-handle ,eshell-output-handle
                                        'append nextproc)))
	,(let ((head (car pipeline)))
	   (if (memq (car head) '(let progn))
	       (setq head (car (last head))))
	   (when (memq (car head) eshell-deferrable-commands)
	     (ignore
	      (setcar head
		      (intern-soft
		       (concat (symbol-name (car head)) "*"))))))
	;; First and last elements in a pipeline may need special treatment.
	;; (Currently only eshell-ls-files uses 'last.)
	;; Affects process-connection-type in eshell-gather-process-output.
	(let ((eshell-in-pipeline-p
	       ,(cond ((not notfirst) (quote 'first))
		      ((cdr pipeline) t)
		      (t (quote 'last)))))
          (let ((proc ,(car pipeline)))
            (set headproc (or proc (symbol-value headproc)))
            (set tailproc (or (symbol-value tailproc) proc))
            proc))))))