Function: eshell-echo

eshell-echo is a byte-compiled function defined in em-basic.el.gz.

Signature

(eshell-echo ARGS &optional OUTPUT-NEWLINE)

Documentation

Implementation code for a Lisp version of echo.

It returns a formatted value that should be passed to eshell-print or eshell-printn for display.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-basic.el.gz
;;; Functions:

(defun eshell-echo (args &optional output-newline)
  "Implementation code for a Lisp version of `echo'.
It returns a formatted value that should be passed to `eshell-print'
or `eshell-printn' for display."
  (if eshell-plain-echo-behavior
      (progn
        ;; If the output does not end in a newline, do not emit one.
        (setq eshell-ensure-newline-p nil)
        (concat (apply #'eshell-flatten-and-stringify args)
                (when output-newline "\n")))
    (let ((value
	   (cond
	    ((= (length args) 0) "")
	    ((= (length args) 1)
	     (car args))
	    (t
	     (mapcar
              (lambda (arg)
                (if (stringp arg)
                    (set-text-properties 0 (length arg) nil arg))
                arg)
	      args)))))
      (if output-newline
	  (cond
	   ((stringp value)
	    (concat value "\n"))
	   ((listp value)
	    (append value (list "\n")))
	   (t
	    (concat (eshell-stringify value) "\n")))
	value))))