Subject: Re: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels

From: Chong Yidong <[email-masked]>
Date: Sat, 15 Aug 2009 21:58:11 -0400

> The documentation for sentinels states:
>
>    A program can wait, so that sentinels will run, by calling
>    `sit-for' or `sleep-for' (...), or `accept-process-output' (...).
>
> However, when I do M-x eval-region RET on the following forms in
> "emacs -Q", then Emacs loops unexpectedly:
>
>    (defun my-sentinel (proc str)
>      (setq my-finished t))
>
>    (let ((p (start-process "bc" nil "bc"))
>          my-finished)
>      (set-process-sentinel p 'my-sentinel)
>      (process-send-string p "quit\n")
>      (while (not my-finished)
>        (accept-process-output nil 0.1)))

The trouble is that accept-process-output passes a zero DO_DISPLAY
argument to wait_reading_process_output (process.c:4306).  When
DO_DISPLAY is zero, status notifications are not performed
(process.c:4763).

Having accept-process-output pass a non-zero DO_DISPLAY argument to
wait_reading_process_output fixes this problem, but I don't know what
ramifications this would have.

Stefan, WDYT?