[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `y-or-n-p' does not wait for input - assumes `n'
From: |
Luc Teirlinck |
Subject: |
Re: `y-or-n-p' does not wait for input - assumes `n' |
Date: |
Tue, 25 Jan 2005 21:59:02 -0600 (CST) |
Richard Stallman wrote:
In that case, I am stumped. Can you figure out what is really happening?
I believe I did.
I replaced Drew's function with:
(defun custom-foobar (widget)
(if (progn (input-pending-p) (read-event) (y-or-n-p "foo: "))
(progn (message "Yes")(sit-for 1))
(message "No")(sit-for 1)))
Then I edebugged that. `input-pending' was t and `read-event' returned
a mouse-motion event. The problem is that the function is executed
with the variable track-mouse bound to t.
There are two ways to interpret this. The first way (which to me
looks far fetched) would be that functions used in
`custom-variable-menu' should bind track-mouse themselves to nil if
they want to read input that does not track the mouse. That is,
Drew's function should be:
(defun custom-foobar (widget)
(if (let (track-mouse) (y-or-n-p "foo: "))
(progn (message "Yes")(sit-for 1))
(message "No")(sit-for 1)))
This indeed fixes the bug.
The second way to interpret it is that the functions in
`custom-variable-menu' should be executed with track-mouse bound to
nil, and if they need to track the mouse, they have to simply rebind
it to t once more. This is implemented by the following patch, which
I could install if desired. It fixes the bug. It is an incompatible
change and I am not 100% sure that it does not break something else,
although I would be surprised.
===File ~/wid-edit-diff=====================================
*** wid-edit.el 27 Dec 2004 15:02:40 -0600 1.134
--- wid-edit.el 25 Jan 2005 21:20:06 -0600
***************
*** 939,945 ****
;; its action function.
(when (and pos
(eq (get-char-property pos 'button)
button))
! (widget-apply-action button event))))
(overlay-put overlay 'face face)
(overlay-put overlay 'mouse-face mouse-face))))
--- 939,946 ----
;; its action function.
(when (and pos
(eq (get-char-property pos 'button)
button))
! (let (track-mouse)
! (widget-apply-action button event)))))
(overlay-put overlay 'face face)
(overlay-put overlay 'mouse-face mouse-face))))
============================================================
- Re: `y-or-n-p' does not wait for input - assumes `n', (continued)
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23
- RE: `y-or-n-p' does not wait for input - assumes `n', Drew Adams, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23
- RE: `y-or-n-p' does not wait for input - assumes `n', Drew Adams, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23
- RE: `y-or-n-p' does not wait for input - assumes `n', Drew Adams, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Richard Stallman, 2005/01/24
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/24
- Re: `y-or-n-p' does not wait for input - assumes `n', Richard Stallman, 2005/01/25
- Re: `y-or-n-p' does not wait for input - assumes `n',
Luc Teirlinck <=
- Re: `y-or-n-p' does not wait for input - assumes `n', Richard Stallman, 2005/01/26
- Re: `y-or-n-p' does not wait for input - assumes `n', Stefan Monnier, 2005/01/26
- Re: `y-or-n-p' does not wait for input - assumes `n', Richard Stallman, 2005/01/27
- Re: `y-or-n-p' does not wait for input - assumes `n', Kim F. Storm, 2005/01/26
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/26
- Re: `y-or-n-p' does not wait for input - assumes `n', Kim F. Storm, 2005/01/27
- Re: `y-or-n-p' does not wait for input - assumes `n', Richard Stallman, 2005/01/27
- Re: `y-or-n-p' does not wait for input - assumes `n', Kim F. Storm, 2005/01/27
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/27
- Re: `y-or-n-p' does not wait for input - assumes `n', Stefan Monnier, 2005/01/27