all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* y-or-n-p-with-timeout
@ 2004-11-06 15:19 Richard Stallman
  2004-11-06 17:24 ` y-or-n-p-with-timeout Jan D.
  2004-11-06 18:14 ` y-or-n-p-with-timeout Alex Schroeder
  0 siblings, 2 replies; 16+ messages in thread
From: Richard Stallman @ 2004-11-06 15:19 UTC (permalink / raw)


    > Perhaps it has to do with y-or-n-p-with-timeout.
    > Can that operate with a dialog?  If so, it now won't work
    > correctly; the timeout will be ignored.  We could make
    > the timeout work once again using some other mechanism,
    > I guess.

    I think that is the case, there was a bug report on bug-gnu-emacs aut it 4
    days before the checkin,
    http://lists.gnu.org/archive/html/bug-gnu-emacs/2002-12/msg00062.ht:

That is enough evidence to convict anyone unless he works for Bush.

The question is whether to make y-or-n-p-with-timeout work correctly
or to declare it obsolete.  We could make it work using some other
timeout mechanism that can't run Lisp code.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-06 15:19 y-or-n-p-with-timeout Richard Stallman
@ 2004-11-06 17:24 ` Jan D.
  2004-11-07 18:04   ` y-or-n-p-with-timeout Richard Stallman
  2004-11-06 18:14 ` y-or-n-p-with-timeout Alex Schroeder
  1 sibling, 1 reply; 16+ messages in thread
From: Jan D. @ 2004-11-06 17:24 UTC (permalink / raw)
  Cc: emacs-devel

> The question is whether to make y-or-n-p-with-timeout work correctly
> or to declare it obsolete.  We could make it work using some other
> timeout mechanism that can't run Lisp code.

Actually, I took this as an OK to revert the change about timer 
handling in popup_get_selection:

> From: Richard Stallman <rms@gnu.org>
> To: storm@cua.dk (Kim F. Storm)
> Date: Sat, 06 Nov 2004 00:22:41 -0500
> Cc: jan.h.d@swipnet.se, mituharu@math.s.chiba-u.ac.jp, 
> emacs-devel@gnu.org
> Subject: Re: alarm_signal_handler is called too frequently

>     Why is it unsafe to Feval with input blocked?
>
> I thought that this was not handled at all, and wouldn't have a chance
> of working right.  But I can't find a reason now why it won't work.

Only Xt-based Emacs (Lucid/Motif/Lesstif) handle y-or-n-p-with-timeout, 
but I'm sure it can be done for the other X based versions.  Mac and 
W32 also doesn't timeout on y-or-n-p-with-timeout when a dialog is 
used.

	Jan D.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-06 15:19 y-or-n-p-with-timeout Richard Stallman
  2004-11-06 17:24 ` y-or-n-p-with-timeout Jan D.
@ 2004-11-06 18:14 ` Alex Schroeder
  2004-11-08 14:49   ` y-or-n-p-with-timeout Stefan
  2004-11-08 19:58   ` y-or-n-p-with-timeout Matthew Mundell
  1 sibling, 2 replies; 16+ messages in thread
From: Alex Schroeder @ 2004-11-06 18:14 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> The question is whether to make y-or-n-p-with-timeout work correctly
> or to declare it obsolete.  We could make it work using some other
> timeout mechanism that can't run Lisp code.

>From a usability perspective I don't like these kinds of timeouts.
They might make sense when booting your computer, but when using
Emacs?  I can't think of a use-case for y-or-n-p-with-timeout.  If
nobody brings up an interesting example, I think we should declare it
obsolete.

Alex.
-- 
.O.  http://www.emacswiki.org/alex/
..O  Schroeder's fifth law:
OOO  Never accept more work than you can handle in one night of hacking.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-06 17:24 ` y-or-n-p-with-timeout Jan D.
@ 2004-11-07 18:04   ` Richard Stallman
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2004-11-07 18:04 UTC (permalink / raw)
  Cc: emacs-devel

    Only Xt-based Emacs (Lucid/Motif/Lesstif) handle y-or-n-p-with-timeout, 
    but I'm sure it can be done for the other X based versions.  Mac and 
    W32 also doesn't timeout on y-or-n-p-with-timeout when a dialog is 
    used.

If it fails on any platform, that is a bug and ought to be fixed
(unless we decide to desupport the facility instead).

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-06 18:14 ` y-or-n-p-with-timeout Alex Schroeder
@ 2004-11-08 14:49   ` Stefan
  2004-11-09 11:14     ` y-or-n-p-with-timeout Richard Stallman
  2004-11-08 19:58   ` y-or-n-p-with-timeout Matthew Mundell
  1 sibling, 1 reply; 16+ messages in thread
From: Stefan @ 2004-11-08 14:49 UTC (permalink / raw)
  Cc: rms, emacs-devel

> From a usability perspective I don't like these kinds of timeouts.
> They might make sense when booting your computer, but when using
> Emacs?  I can't think of a use-case for y-or-n-p-with-timeout.  If
> nobody brings up an interesting example, I think we should declare it
> obsolete.

Agreed,


        Stefan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-06 18:14 ` y-or-n-p-with-timeout Alex Schroeder
  2004-11-08 14:49   ` y-or-n-p-with-timeout Stefan
@ 2004-11-08 19:58   ` Matthew Mundell
  2004-11-09 21:29     ` y-or-n-p-with-timeout Richard Stallman
  1 sibling, 1 reply; 16+ messages in thread
From: Matthew Mundell @ 2004-11-08 19:58 UTC (permalink / raw)
  Cc: emacs-devel

>>From a usability perspective I don't like these kinds of timeouts.
> They might make sense when booting your computer, but when using
> Emacs?  I can't think of a use-case for y-or-n-p-with-timeout.  If
> nobody brings up an interesting example, I think we should declare it
> obsolete.

Type-break mode with fixed-length periods between breaks could use
such a function to prompt the user to take a break.  That way if the
user returns to the machine after an extended period away, then any
prompting will, correctly, be gone.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-08 14:49   ` y-or-n-p-with-timeout Stefan
@ 2004-11-09 11:14     ` Richard Stallman
  2004-11-09 23:16       ` y-or-n-p-with-timeout Luc Teirlinck
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2004-11-09 11:14 UTC (permalink / raw)
  Cc: emacs-devel, alex

    > From a usability perspective I don't like these kinds of timeouts.
    > They might make sense when booting your computer, but when using
    > Emacs?  I can't think of a use-case for y-or-n-p-with-timeout.  If
    > nobody brings up an interesting example, I think we should declare it
    > obsolete.

    Agreed,

I think I added that function for compatibility with XEmacs.
Could someone check if that is true?

If the feature is painful to implement, and not really desirable in
itself, I guess compatibility is not enough reason to do the work to
implement.

Anyway, please tell me if you know of a good use for this function.
If I don't hear of one, I will mark it obsolete.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-08 19:58   ` y-or-n-p-with-timeout Matthew Mundell
@ 2004-11-09 21:29     ` Richard Stallman
  2004-11-09 22:51       ` y-or-n-p-with-timeout Matthew Mundell
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2004-11-09 21:29 UTC (permalink / raw)
  Cc: emacs-devel, alex

    Type-break mode with fixed-length periods between breaks could use
    such a function to prompt the user to take a break.  That way if the
    user returns to the machine after an extended period away, then any
    prompting will, correctly, be gone.

Would we want type-break mode to use a dialog box?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-09 21:29     ` y-or-n-p-with-timeout Richard Stallman
@ 2004-11-09 22:51       ` Matthew Mundell
  2004-11-11  3:14         ` y-or-n-p-with-timeout Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Mundell @ 2004-11-09 22:51 UTC (permalink / raw)
  Cc: emacs-devel, alex

Richard Stallman <rms@gnu.org> writes:

>     Type-break mode with fixed-length periods between breaks could use
>     such a function to prompt the user to take a break.  That way if the
>     user returns to the machine after an extended period away, then any
>     prompting will, correctly, be gone.
>
> Would we want type-break mode to use a dialog box?

The same situation would then be a case for the dialog box to time
out.  Using a dialog box would require an alternative for terminal
display.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-09 11:14     ` y-or-n-p-with-timeout Richard Stallman
@ 2004-11-09 23:16       ` Luc Teirlinck
  2004-11-11  3:14         ` y-or-n-p-with-timeout Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Luc Teirlinck @ 2004-11-09 23:16 UTC (permalink / raw)
  Cc: alex, monnier, emacs-devel

Richard Stallman wrote:

   Anyway, please tell me if you know of a good use for this function.
   If I don't hear of one, I will mark it obsolete.

feedmail.el uses `y-or-n-p-with-timeout' at a couple of places.  It
falls back on the regular `y-or-no-p' for Emacs versions for which
`y-or-n-p-with-timeout' is not defined.  If I understand correctly it
will _automatically_ fall back on the regular `y-or-no-p' behavior on
platforms and in situations where `y-or-n-p-with-timeout' is broken.
It would seem that this is exactly the desired behavior in such
situations.

y-or-n-p-with-timeout does not exactly do a lot:

(defun y-or-n-p-with-timeout (prompt seconds default-value)
  "Like (y-or-n-p PROMPT), with a timeout.
If the user does not answer after SECONDS seconds, return DEFAULT-VALUE."
  (with-timeout (seconds default-value)
    (y-or-n-p prompt)))

If `y-or-n-p-with-timeout' is broken on some platforms in certain
situations does this not automatically imply that `with-timeout' is
broken on these same platforms in those same situations?

Sincerely,

Luc.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-09 22:51       ` y-or-n-p-with-timeout Matthew Mundell
@ 2004-11-11  3:14         ` Richard Stallman
  2004-11-12 17:04           ` y-or-n-p-with-timeout Matthew Mundell
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2004-11-11  3:14 UTC (permalink / raw)
  Cc: emacs-devel, alex

    >     Type-break mode with fixed-length periods between breaks could use
    >     such a function to prompt the user to take a break.  That way if the
    >     user returns to the machine after an extended period away, then any
    >     prompting will, correctly, be gone.
    >
    > Would we want type-break mode to use a dialog box?

    The same situation would then be a case for the dialog box to time
    out.  Using a dialog box would require an alternative for terminal
    display.

We're failing to communicate.  The question is whether this is
a real example of wanting to use a dialog box.

Do we really want type-break to use a dialog box?
Does type-break now use a dialog box?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-09 23:16       ` y-or-n-p-with-timeout Luc Teirlinck
@ 2004-11-11  3:14         ` Richard Stallman
  2004-11-11  9:20           ` y-or-n-p-with-timeout Jan D.
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2004-11-11  3:14 UTC (permalink / raw)
  Cc: alex, monnier, emacs-devel

    If `y-or-n-p-with-timeout' is broken on some platforms in certain
    situations does this not automatically imply that `with-timeout' is
    broken on these same platforms in those same situations?

Yes, the timeout won't work if the code in Emacs is not running timers.

Since it turns out there is no harm in running Lisp code within
BLOCK_INPUT, can we arrange to check Lisp timers in the
places that currently fail to do so?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-11  3:14         ` y-or-n-p-with-timeout Richard Stallman
@ 2004-11-11  9:20           ` Jan D.
  2004-11-12  7:05             ` y-or-n-p-with-timeout Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Jan D. @ 2004-11-11  9:20 UTC (permalink / raw)
  Cc: emacs-devel, Luc Teirlinck, monnier, alex

>     If `y-or-n-p-with-timeout' is broken on some platforms in certain
>     situations does this not automatically imply that `with-timeout' is
>     broken on these same platforms in those same situations?
>
> Yes, the timeout won't work if the code in Emacs is not running timers.
>
> Since it turns out there is no harm in running Lisp code within
> BLOCK_INPUT, can we arrange to check Lisp timers in the
> places that currently fail to do so?

This should only be needed where we BLOCK_INPUT for a longer time, and 
the places I know of are menus and dialogs.  Are there any other 
operations that needs to be considered?  I'm fixing menus and dialogs 
right now.

	Jan D.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-11  9:20           ` y-or-n-p-with-timeout Jan D.
@ 2004-11-12  7:05             ` Richard Stallman
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2004-11-12  7:05 UTC (permalink / raw)
  Cc: alex, teirllm, monnier, emacs-devel

    This should only be needed where we BLOCK_INPUT for a longer time, and 
    the places I know of are menus and dialogs.  Are there any other 
    operations that needs to be considered?  I'm fixing menus and dialogs 
    right now.

Menus and dialogs are the only places I know of.
Emacs might sometimes wait longer when trying to read a file
if the data is really coming from the network; but 
the file-reading code isn't reentrant so we can't run timers
then.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-11  3:14         ` y-or-n-p-with-timeout Richard Stallman
@ 2004-11-12 17:04           ` Matthew Mundell
  2004-11-13 16:37             ` y-or-n-p-with-timeout Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Mundell @ 2004-11-12 17:04 UTC (permalink / raw)
  Cc: emacs-devel, alex

Richard Stallman <rms@gnu.org> writes:

>     >     Type-break mode with fixed-length periods between breaks could use
>     >     such a function to prompt the user to take a break.  That way if the
>     >     user returns to the machine after an extended period away, then any
>     >     prompting will, correctly, be gone.
>     >
>     > Would we want type-break mode to use a dialog box?
>
>     The same situation would then be a case for the dialog box to time
>     out.  Using a dialog box would require an alternative for terminal
>     display.
>
> We're failing to communicate.  The question is whether this is
> a real example of wanting to use a dialog box.

So this question is separate from y-or-n-p-with-timeout?

> Do we really want type-break to use a dialog box?

A dialog makes the prompt more aggressive, by covering some of the
frame.  It also requires the use of the mouse, to respond to the
prompt.

> Does type-break now use a dialog box?

It uses the value of `type-break-query-function', which is set to
`yes-or-no-p'.

It can be customised to use a dialog box, for example as follows.

(setq type-break-query-function
	  (lambda (msg)
		(x-popup-dialog t `(,msg ("yes" . t) ("no" . nil)))))

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: y-or-n-p-with-timeout
  2004-11-12 17:04           ` y-or-n-p-with-timeout Matthew Mundell
@ 2004-11-13 16:37             ` Richard Stallman
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2004-11-13 16:37 UTC (permalink / raw)
  Cc: alex, emacs-devel

This specific thread is obsolete now, because Jan Djarv has been
making timeouts work during all the menu and dialog box
implementations.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-11-13 16:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-06 15:19 y-or-n-p-with-timeout Richard Stallman
2004-11-06 17:24 ` y-or-n-p-with-timeout Jan D.
2004-11-07 18:04   ` y-or-n-p-with-timeout Richard Stallman
2004-11-06 18:14 ` y-or-n-p-with-timeout Alex Schroeder
2004-11-08 14:49   ` y-or-n-p-with-timeout Stefan
2004-11-09 11:14     ` y-or-n-p-with-timeout Richard Stallman
2004-11-09 23:16       ` y-or-n-p-with-timeout Luc Teirlinck
2004-11-11  3:14         ` y-or-n-p-with-timeout Richard Stallman
2004-11-11  9:20           ` y-or-n-p-with-timeout Jan D.
2004-11-12  7:05             ` y-or-n-p-with-timeout Richard Stallman
2004-11-08 19:58   ` y-or-n-p-with-timeout Matthew Mundell
2004-11-09 21:29     ` y-or-n-p-with-timeout Richard Stallman
2004-11-09 22:51       ` y-or-n-p-with-timeout Matthew Mundell
2004-11-11  3:14         ` y-or-n-p-with-timeout Richard Stallman
2004-11-12 17:04           ` y-or-n-p-with-timeout Matthew Mundell
2004-11-13 16:37             ` y-or-n-p-with-timeout Richard Stallman

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.