emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Q on read-char and read-char-exclusive - when do they prompt?


From: Drew Adams
Subject: Q on read-char and read-char-exclusive - when do they prompt?
Date: Sat, 25 Jun 2005 14:39:54 -0700

Under what circumstances do or should `read-char' and `read-char-exclusive'
display a prompt, if they are provided with a prompt argument? The doc
strings suggest that the prompt (if non-nil) should always be displayed.

I've used these functions in interactive specs, and the prompt seems to
always be displayed then. When I've used them outside interactive specs,
however, I see no prompt. I've tried binding `echo-keystrokes' to 0, in
order to not have keystroke echoing interfere, but I still see no prompt.

A grep of the standard lisp libraries shows that calls to these functions
seem always to be preceded by a call to `message', which does the actual
prompting. So perhaps I'm not alone in not getting the prompt argument to
work? If `message' must be called to prompt before calling `read-char*',
then what is the purpose of their prompt argument, and when is it taken into
account? Does it only work in interactive specs? Does it always work in
interactive specs?

Is there another, better function for reading a character input by the user
(and ignoring other input events)?


BTW, I noticed this seemingly inappropriate comment in isearch.el (in
function isearch-edit-string):

 (unwind-protect
     (let* (;; Why does following read-char echo?
            ;;(echo-keystrokes 0) ;; not needed with above message
            (e (let ((cursor-in-echo-area t))
                 (read-event)))

Presumably, `read-event' is meant here, not `read-char' (which is not called
at all). The comments suggest that the behavior here is not well understood.
I notice too that this code has not changed since Emacs 20, at least.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]