Function: eshell-rewrite-while-command

eshell-rewrite-while-command is a byte-compiled function defined in esh-cmd.el.gz.

Signature

(eshell-rewrite-while-command TERMS)

Documentation

Rewrite a while command into its equivalent Eshell command form.

Because the implementation of while relies upon conditional evaluation of its argument (i.e., use of a Lisp special form), it must be implemented via rewriting, rather than as a function.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defun eshell-rewrite-while-command (terms)
  "Rewrite a `while' command into its equivalent Eshell command form.
Because the implementation of `while' relies upon conditional
evaluation of its argument (i.e., use of a Lisp special form), it
must be implemented via rewriting, rather than as a function."
  (when (and (stringp (car terms))
             (member (car terms) '("while" "until")))
    (unless (cadr terms)
      (error "Missing test for `while' command"))
    (let ((condition (eshell-silence-test-command (cadr terms))))
      (unless (string= (car terms) "while")
        (setq condition `(not ,condition)))
      `(while ,condition
         ,(caddr terms)))))