Subject: Re: bug#27361: 24.4; eshell/echo silently ignores -n argument

From: Glenn Morris <[email-masked]>
Date: Mon, 19 Jun 2017 22:17:26 -0400

It seems easy to get the behaviour that you want, for the
eshell-plain-echo-behavior case, which is the only relevant one.
At the same time, we can fix eshell/printnl for that case,
to avoid the doubled newlines that it currently gives.

I don't know how to explain in --help what -n means though. :)

--- a/lisp/eshell/em-basic.el
+++ b/lisp/eshell/em-basic.el
@@ -88,7 +88,8 @@ eshell-echo
 It returns a formatted value that should be passed to `eshell-print'
 or `eshell-printn' for display."
   (if eshell-plain-echo-behavior
-      (concat (apply 'eshell-flatten-and-stringify args) "\n")
+      (concat (apply 'eshell-flatten-and-stringify args)
+	      (unless output-newline "\n"))
     (let ((value
 	   (cond
 	    ((= (length args) 0) "")
@@ -126,7 +127,8 @@ eshell/printnl
   "Print out each of the arguments, separated by newlines."
   (let ((elems (eshell-flatten-list args)))
     (while elems
-      (eshell-printn (eshell-echo (list (car elems))))
+      (eshell-printn (eshell-echo (list (car elems))
+				  eshell-plain-echo-behavior))
       (setq elems (cdr elems)))))
 
 (defun eshell/listify (&rest args)