summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-03-14 22:42:31 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2011-03-14 22:42:31 -0400
commit49c5410a593ad8b162e5c4608e2210f839539f7f (patch)
tree1a347fa329806f904433469546a033557c354235
parent047b2bb9a27dc4f20a9e346782235efceedb7b9c (diff)
downloademacs-49c5410a593ad8b162e5c4608e2210f839539f7f.tar.gz
* lisp/subr.el (read-char-choice): Only show the cursor after the prompt,
not after the answer.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/subr.el36
2 files changed, 23 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6d80ed0f5bd..4bcb1117b1c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-15 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * subr.el (read-char-choice): Only show the cursor after the prompt,
+ not after the answer.
+
2011-03-15 Kevin Ryde <user42@zip.com.au>
* help-fns.el (variable-at-point): Skip leading quotes, if any
diff --git a/lisp/subr.el b/lisp/subr.el
index 3330fa20379..6f39a41709e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2003,24 +2003,24 @@ If optional argument INHIBIT-KEYBOARD-QUIT is non-nil, ignore
keyboard-quit events while waiting for a valid input."
(unless (consp chars)
(error "Called `read-char-choice' without valid char choices"))
- (let ((cursor-in-echo-area t)
- (executing-kbd-macro executing-kbd-macro)
- char done)
- (while (not done)
- (unless (get-text-property 0 'face prompt)
- (setq prompt (propertize prompt 'face 'minibuffer-prompt)))
- (setq char (let ((inhibit-quit inhibit-keyboard-quit))
- (read-key prompt)))
- (cond
- ((not (numberp char)))
- ((memq char chars)
- (setq done t))
- ((and executing-kbd-macro (= char -1))
- ;; read-event returns -1 if we are in a kbd macro and
- ;; there are no more events in the macro. Attempt to
- ;; get an event interactively.
- (setq executing-kbd-macro nil))))
- ;; Display the question with the answer.
+ (let (char done)
+ (let ((cursor-in-echo-area t)
+ (executing-kbd-macro executing-kbd-macro))
+ (while (not done)
+ (unless (get-text-property 0 'face prompt)
+ (setq prompt (propertize prompt 'face 'minibuffer-prompt)))
+ (setq char (let ((inhibit-quit inhibit-keyboard-quit))
+ (read-key prompt)))
+ (cond
+ ((not (numberp char)))
+ ((memq char chars)
+ (setq done t))
+ ((and executing-kbd-macro (= char -1))
+ ;; read-event returns -1 if we are in a kbd macro and
+ ;; there are no more events in the macro. Attempt to
+ ;; get an event interactively.
+ (setq executing-kbd-macro nil)))))
+ ;; Display the question with the answer. But without cursor-in-echo-area.
(message "%s%s" prompt (char-to-string char))
char))