In a nutshell, the problem I'm having is that evaluating the expression
(read-char "some prompt")
sometimes fails to show the specified prompt (but works as expected otherwise).
Unfortunately, from my perspective, the problem shows up completely randomly. I'm sure it is not really random; it just looks this way to me, because I have no idea of what's going on.
As a result of this complete unpredictability, I can't guarantee that the silly example below will reproduce the problem. I show it only to describe the setting.
(defun foo (arg)
(interactive "P")
(let ((read-1-char (lambda () (string (read-char "Type one char" t)))))
(let ((bar
(cond ((equal arg '(4)) (funcall read-1-char))
(t (error "foo: the C-u prefix is required")))))
(message ">%s<" (prin1-to-string bar)))))
(global-set-key (kbd "C-c M") 'foo)
The intended behavior of this code is that, if one types C-u C-c M
, the message Type one char
will appear in the minibuffer; if one then types, say, x
, the message >"x"<
will be displayed.
In some cases, however, after typing C-u C-c M
, instead of Type one char
, the "message" in the minibuffer is just C-u C-c M-
. (The subsequent behavior remains the same; e.g., if the user then types x
, the message >"x"<
does get displayed.)