[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in new sit-for?
From: |
Chong Yidong |
Subject: |
Re: Bug in new sit-for? |
Date: |
Sun, 16 Jul 2006 18:18:48 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Lennart Borgman <address@hidden> writes:
> Create a file sit-for-bug.el:
>
> (message "calling (sit-for 0)")(sit-for 0)
> (message "calling (sit-for 1)")(sit-for 1)
> (message "after sit-for")
>
> Evaluate this inside Emacs with eval-buffer. Works fine. Now try instead
>
> emacs.exe -batch -Q -l sit-for-bug.el
>
> This hangs after the displaying "calling (sit-for 1)". The first
> (sit-for 0) does not hang.
(First off, it isn't hung: press enter, and the sit-for will exit.
The problem is that `read-event' can't be interrupted by the timer in
batch mode).
Anyway, the situation is a little more complicated than that, because
the old sit-for also doesn't work properly.
With the old sit-for, there is no way to interrupt in batch mode: no
matter what key you press, including enter, the sit-for will sit for
the entire duration.
With the new sit-for, the sit-for sits forever. However, typing in
something + enter (to send the input to Emacs) interrupts it.
Neither behavior is completely satisfactory, and I don't know if
there's a way to do this properly. I can probably make the new
sit-for mimic the old behavior by not calling read-event in batch
mode.