mclark1129
mclark1129

Reputation: 7592

Reading User Input in Emacs Inferior Lisp

I'm trying to learn Lisp by reading Practical Common Lisp and I've hit a small stumbling block early on when trying to read user input. I've defined prompt-read to prompt the user for input:

(defun prompt-read (prompt)
  (format *query-io* "~a: " prompt)
  (force-output *query-io*)
  (read-line *query-io*))

When I try to evaluate prompt-read, pressing [Enter] to run the statement seems to be accepted as the input so the resulting input is blank

>(prompt-read "Test")
Test: 
""
NIL

I followed the example exactly, so I'm assuming that this is somehow related to my environment. I am using Emacs Inferior Lisp in Windows, is there some adjustment I have to make to my code in order to get the behavior I expect?

Upvotes: 4

Views: 1221

Answers (1)

Emre Sevinç
Emre Sevinç

Reputation: 8521

There seems to be nothing wrong with your code, and it also correctly runs with e.g. SBCL on MS Windows. Instead of inferior lisp mode (that is really inferior) why don't you give a try at using SLIME to edit and run your CL code inside Emacs? You can install it quickly by following this guides:

Upvotes: 3

Related Questions