Function: eshell-strip-redirections

eshell-strip-redirections is a byte-compiled function defined in esh-io.el.gz.

Signature

(eshell-strip-redirections TERMS)

Documentation

Rewrite any output redirections in TERMS.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-io.el.gz
(defun eshell-strip-redirections (terms)
  "Rewrite any output redirections in TERMS."
  (setq eshell-current-redirections (list t))
  (let ((tl terms)
        (tt (cdr terms)))
    (while tt
      (cond
       ;; Strip `eshell-copy-output-handle'.
       ((and (consp (car tt))
             (eq (caar tt) 'eshell-copy-output-handle))
        (nconc eshell-current-redirections
               (list (car tt)))
        (setcdr tl (cddr tt))
        (setq tt (cdr tt)))
       ;; Strip `eshell-set-output-handle' or
       ;; `eshell-set-all-output-handles' and the term immediately
       ;; after (the redirection target).
       ((and (consp (car tt))
             (memq (caar tt) '(eshell-set-output-handle
                               eshell-set-all-output-handles)))
        (unless (cdr tt)
          (error "Missing redirection target"))
        (nconc eshell-current-redirections
               (list (list 'ignore
                           (append (car tt) (list (cadr tt))))))
        (setcdr tl (cddr tt))
        (setq tt (cddr tt)))
       (t
        (setq tt (cdr tt)
              tl (cdr tl)))))
    (setq eshell-current-redirections
          (cdr eshell-current-redirections))))