Function: eshell-eval-command

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

Signature

(eshell-eval-command COMMAND &optional INPUT)

Documentation

Evaluate the given COMMAND iteratively.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defun eshell-eval-command (command &optional input)
  "Evaluate the given COMMAND iteratively."
  (if eshell-current-command
      ;; We can just stick the new command at the end of the current
      ;; one, and everything will happen as it should.
      (setcdr (last (cdr eshell-current-command))
              (list `(let ((here (and (eobp) (point))))
                       ,(and input
                             `(insert-and-inherit ,(concat input "\n")))
                       (if here
                           (eshell-update-markers here))
                       (eshell-do-eval ',command))))
    (and eshell-debug-command
         (with-current-buffer (get-buffer-create "*eshell last cmd*")
           (erase-buffer)
           (insert "command: \"" input "\"\n")))
    (setq eshell-current-command command)
    (let* ((delim (catch 'eshell-incomplete
                    (eshell-resume-eval)))
           (val (car-safe delim))
           (val-is-process (or (eshell-processp val)
                               (eshell-process-pair-p val))))
      ;; If the return value of `eshell-resume-eval' is wrapped in a
      ;; list, it indicates that the command was run asynchronously.
      ;; In that case, unwrap the value before checking the delimiter
      ;; value.
      (if (and val
               (not val-is-process)
               (not (eq val t)))
          (error "Unmatched delimiter: %S" val)
        ;; Eshell-command expect a list like (<process>) to know if the
        ;; command should be async or not.
        (or (and val-is-process delim) val)))))