all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Q on read-char and read-char-exclusive - when do they prompt?
@ 2005-06-25 21:39 Drew Adams
  0 siblings, 0 replies; only message in thread
From: Drew Adams @ 2005-06-25 21:39 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-06-25 21:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-25 21:39 Q on read-char and read-char-exclusive - when do they prompt? Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.