I'd like to write a simple loop that catches and prints the incoming event while the script is running. I've tried this:
(let ((key 0))
(while (= key 0)
(setq event (read-char nil nil 0))
(if event (print event))))
The script runs but no event data is printed. After C-g
all characters pressed were printed in the buffer. What's wrong?