Subject: RE: bug#38785: 26.3; `y-or-n-p' leaves prompt and response in echo area

From: Drew Adams <[email-masked]>
Date: Sat, 28 Dec 2019 15:30:10 -0800 (PST)

> Perhaps `y-or-n-p' should do what it does now, but then reset the echo
> area after a brief delay (e.g. 1 sec), where "reset" means to do what
> `map-y-or-n-p' does: restore any previous echo-area content.  IOW, it's
> not bad to echo your response to the `y-or-n-p' question.  But it is
> bad not to clean up afterward, leaving the echo area littered with the
> prompt.

Actually, that's no good either.  (Damn timers!)

A function such as `y-or-n-p' or `map-y-or-n-p' can't
clean up after a delay, because that will likely wipe
out a subsequent such prompt, by restoring what was
in the echo area before the first one.

E.g. `y-or-n-p' followed by `y-or-n-p' or `map-y-or-n-p'.
The second prompting function would have its prompt
wiped out by the first one restoring what was in the
echo area before the first one started.

I think `y-or-n-p' should probably just use `(sit-for 1)'
after it shows the prompt + answer, and then do what
`map-y-or-n-p' does: clean up after itself:

 (let ((ret  (eq answer 'act)))
   (unless noninteractive
     (message "%s%c" prompt (if ret ?y ?n))
     (sit-for 1)
     (let ((message-log-max  nil))
       (if msg  (message "%s" msg) (message ""))))
   ret)))