The function eshell-print has some weird behavior, as it only seems to work when called as a part of an eshell process. All other times it throws the error

wrong type arguments: arrayp, nil

Try to execute this function inside the scratch buffer:

(defun test ()
  (eshell-print "Hello world"))


This doesn't run, even without an init file. If you try this, however, it works:

   (insert "test")

Does anyone know why it exhibits this behavior?

1 Answer 1


Looking at the eshell code, I think that particular error is a bug.

That said, eshell-print, needs is a place to send its output, and eshell-commands is what gives a location to send output.

So change the code to:

(defun test ()
  (eshell-commands (eshell-print "Hello world")))


And this will print "Hello world" inside the eshell buffer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.