Function: eshell-set-output-handle

eshell-set-output-handle is a byte-compiled function defined in esh-io.el.gz.

Signature

(eshell-set-output-handle INDEX MODE &optional TARGET HANDLES)

Documentation

Set handle INDEX for the current HANDLES to point to TARGET using MODE.

If HANDLES is nil, use eshell-current-handles.

If the handle is currently set to its default value (see eshell-create-handles), this will overwrite the targets with the new target. Otherwise, it will append the new target to the current list of targets.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-io.el.gz
(defun eshell-set-output-handle (index mode &optional target handles)
  "Set handle INDEX for the current HANDLES to point to TARGET using MODE.
If HANDLES is nil, use `eshell-current-handles'.

If the handle is currently set to its default value (see
`eshell-create-handles'), this will overwrite the targets with
the new target.  Otherwise, it will append the new target to the
current list of targets."
  (when target
    (let* ((handles (or handles eshell-current-handles))
           (handle (or (aref handles index)
                       (aset handles index (list (cons nil 1) nil))))
           (defaultp (cadr handle)))
      (when defaultp
        (decf (cdar handle))
        (setcar handle (cons nil 1)))
      (let ((current (caar handle))
            (where (eshell-get-target target mode)))
        (when (and where (not (member where current)))
          (setcar (car handle) (append current (list where)))))
      (setcar (cdr handle) nil))))