bug#2930: 23.0.92; `accept-process-output' and `sleep-for' do not run sentinels

Markus Triska <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Message-ID <[email protected]>
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)))

When I replace the call of `accept-process-output' with (sleep-for
0.1), it also does not run the sentinel. (sit-for 0.1) works as
documented, but is not a good alternative for the other functions in
this case: If keyboard input is available, `sit-for' returns
immediately, so it is currently unfortunately also necessary to
discard keyboard input to make such a loop reliably run the sentinel.

In GNU Emacs 23.0.92.2 (i386-apple-darwin9.6.1, GTK+ Version 2.14.7)
 of 2009-04-05 on mt-imac.local
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure  '--with-tiff=no''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.