I need to read a char at a time to interactively build a filter string while I show the results in a regular buffer. And what I've written works, except when a cursor key is pressed - then bang, I get a "non-character input event message" and my code exits.
Here's an example. If I run the following command, and hit one of the arrow keys, I get an error.
(defun foobar ()
(interactive)
(setq r (read-char)))
I've tried read-char
, read-event
and read-char-exclusive
with and without ignore-errors
. I've tried read-char-choice
and logic that looks for the vector result a cursor key would give. Nothing works (although I can handle return and backspace perfectly.)
What do I need to do? I don't need the cursor keys to do anything; I just need to make it safe to press them.