Subject: Re: bug#43834: 27.1; [PATCH] Sentinels under X and command line

From: Eli Zaretskii <[email-masked]>
Date: Tue, 06 Oct 2020 21:57:49 +0300

> From: dick <[email-masked]>
> Date: Tue, 06 Oct 2020 14:25:50 -0400
> 
> emacs -Q -l cl-lib \
>   --eval "(let* (flag \
>                  (proc (apply (function start-process) \"test\" nil \"sleep\" (list \"3\")))) \
>             (set-process-sentinel proc (lambda (&rest _args) (setq flag t))) \
>             (cl-assert (cl-loop repeat 10 \
>                         until flag \
>                         do (accept-process-output nil 0.5) \
>                         finally return flag)) \
>             (message \"good!\"))"
> 
> >From cd25ae2e9f8cf1d155084c125dae4058fccb6544 Mon Sep 17 00:00:00 2001
> From: dickmao <none>
> Date: Tue, 6 Oct 2020 14:21:03 -0400
> Subject: [PATCH] Process sentinels need to work under X and commandline
> 
> This is also noted in
> https://emacs.stackexchange.com/questions/60408/\
> process-sentinels-dont-run-during-init-in-gui-emacs
> 
> * src/process.c (add_non_keyboard_read_fd): Make this a public function.
> (add_process_read_fd): Fold old, static add_non_keyboard_read_fd guts
> into here.
> * src/xsmfns.c (ice_conn_watch_CB): Call add_non_keyboard_read_fd.

I'm probably missing something, because I don't understand the
rationale for your changes.  Can you please elaborate on the
rationale?  Also, are your changes supposed to fix the problem
reported at stackexchange, and if so, please also elaborate on that.

Thanks.

P.S. I'd prefer not to change the add_*_fd unless strictly necessary.
It's okay to make a static function be extern, but can we please avoid
other reshuffling?  If necessary (but I'd like to understand why), I'd
even prefer introducing a new function, rather than changing the
existing ones.  Specifically, I'd like to avoid the change of the
semantics of add_non_keyboard_read_fd.