2

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)
  (eshell-print "Hello world"))

(test)

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

(progn
   (eshell)
   (eshell-return-to-prompt)
   (insert "test")
   (eshell-send-input))

Does anyone know why it exhibits this behavior?

0

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)
  (eshell-commands (eshell-print "Hello world")))

(test)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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