unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 38785@debbugs.gnu.org
Subject: bug#38785: 26.3; `y-or-n-p' leaves prompt and response in echo area
Date: Sat, 28 Dec 2019 15:30:10 -0800 (PST)	[thread overview]
Message-ID: <5561aae8-fa46-4228-833a-912fc49d789e@default> (raw)
In-Reply-To: <787722a4-9679-4160-903d-d9de42801ddf@default>

> 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)))





  reply	other threads:[~2019-12-28 23:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-28 22:55 bug#38785: 26.3; `y-or-n-p' leaves prompt and response in echo area Drew Adams
2019-12-28 23:30 ` Drew Adams [this message]
2019-12-29  8:58   ` Andreas Schwab
2019-12-29 14:06     ` Eli Zaretskii
2019-12-29 14:08     ` Drew Adams
2019-12-29 14:29       ` Andreas Schwab
     [not found] <<787722a4-9679-4160-903d-d9de42801ddf@default>
     [not found] ` <<5561aae8-fa46-4228-833a-912fc49d789e@default>
     [not found]   ` <<87blrrwlsf.fsf@hase.home>
     [not found]     ` <<83blrrns4o.fsf@gnu.org>
2019-12-29 14:14       ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5561aae8-fa46-4228-833a-912fc49d789e@default \
    --to=drew.adams@oracle.com \
    --cc=38785@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).