unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Alan Mackenzie <acm@muc.de>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: Strange use of (run-with-timer 0 nil #'foo args) in do-after-load-evaluation
Date: Wed, 30 Oct 2019 01:45:58 +0200	[thread overview]
Message-ID: <87pnifcdzd.fsf@mail.linkov.net> (raw)
In-Reply-To: <87k18n233r.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 29 Oct 2019 12:38:48 +0100")

>> An asynchronous message doesn't hide the minibuffer.  It's displayed
>> at the end of the minibuffer text.
>
> The original bug report was about:
>
> (progn
>   (run-at-time 2 nil (lambda () (message "foo")))
>   (y-or-n-p "Yes? "))
>
> But this seems to have the same problem?
>
> (progn
>   (run-at-time 2 nil (lambda () (message "foo")))
>   (read-from-minibuffer "Yes? "))
>
> When I eval that, "foo" completely hides the prompt -- it's not appended
> or reasserted.

'message' can be easily replaced with 'minibuffer-message',
then it doesn't obscure the minibuffer:

(progn
  (run-at-time 2 nil (lambda () (minibuffer-message "foo")))
  (read-from-minibuffer "Yes? "))

Whereas it obscures the prompt in y-or-n-p:

(progn
  (run-at-time 2 nil (lambda () (minibuffer-message "foo")))
  (y-or-n-p "Yes? "))

>>> I think having a history for y-or-n-p doesn't sound very useful?
>>> Hitting `M-p' doesn't to get to the previous answer just sounds
>>> confusing to me.
>>
>> Please try the example I sent earlier.  It feels quite naturally
>> typing 'M-p RET' to repeat a previous y/n answer.
>
> I played with it a bit, and I'm not very enthusiastic about that.  Like
> Stefan K says, it seems error-prone, and I think it would just create
> frustration.  And it's a bigger change in the interface than it first
> sounds like -- people may be used to hitting <up> as a way to reassert
> the prompt, for instance.

In case of doubt, we could add a new function read-y-or-n-p,
not to replace the implementation of the existing y-or-n-p.

Then like many users already put in init files:

  (fset 'yes-or-no-p 'y-or-n-p)

it will be possible to put:

  (fset 'yes-or-no-p 'read-y-or-n-p)
  (fset 'y-or-n-p 'read-y-or-n-p)

And when it will prove to work better than the current y-or-n-p,
maybe after the next release the implementation of y-or-n-p
could be switched to read-y-or-n-p later.



  reply	other threads:[~2019-10-29 23:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26 10:14 Strange use of (run-with-timer 0 nil #'foo args) in do-after-load-evaluation Alan Mackenzie
2019-10-26 12:41 ` Stefan Monnier
2019-10-26 13:16   ` Lars Ingebrigtsen
2019-10-26 16:38     ` Stefan Monnier
2019-10-27  1:01       ` HaiJun Zhang
2019-10-27 21:57     ` Juri Linkov
2019-10-27 22:29       ` Juri Linkov
2019-10-28  9:41         ` martin rudalics
2019-10-28  2:13       ` Stefan Monnier
2019-10-28 10:45       ` Lars Ingebrigtsen
2019-10-28 22:19         ` Juri Linkov
2019-10-28 23:20           ` Stefan Kangas
2019-10-29 23:39             ` Juri Linkov
2019-10-29 11:38           ` Lars Ingebrigtsen
2019-10-29 23:45             ` Juri Linkov [this message]
2019-10-29 23:58               ` Lars Ingebrigtsen
2019-10-30  8:22                 ` martin rudalics
2019-10-30 22:10                 ` Juri Linkov
2019-10-31  2:00                   ` Stefan Monnier
2019-11-03 20:50                     ` Juri Linkov
2019-10-26 14:18   ` Alan Mackenzie
2019-10-26 15:27   ` Juanma Barranquero
2019-10-27 21:51 ` Juri Linkov
2019-10-28  3:34   ` Eli Zaretskii

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=87pnifcdzd.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /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).