jwiegley / emacs-async

Simple library for asynchronous processing in Emacs
GNU General Public License v3.0
829 stars 68 forks source link

Add variable to set process-query-on-exit-flag #189

Closed bcc32 closed 3 months ago

bcc32 commented 3 months ago

This can't reliably be done by the caller of async-start, because make-process will create an extra process for the stderr buffer that cannot be easily found based on the returned process from async-start.

The new variable, async-process-query-on-exit-flag, can be let-bound to nil around a call to async-start in order to cause the parent Emacs to silently kill the child Emacs if the user quits the parent.

This can be useful for async processes run in timers for things like notifications, where the user doesn't really care if a running process actually finishes, since they're killing Emacs.

thierryvolpiatto commented 3 months ago

Aaron Zeng @.***> writes:

This can't reliably be done by the caller of async-start, because make-process will create an extra process for the stderr buffer that cannot be easily found based on the returned process from async-start.

The new variable, async-process-query-on-exit-flag, can be let-bound to nil around a call to async-start in order to cause the parent Emacs to silently kill the child Emacs if the user quits the parent.

Why the name is async-process-query-on-exit-flag and the default t and then you use :noquery (not async-process-query-on-exit-flag)? Why not async-process-noquery-on-exit-flag set to nil by default and then :noquery async-process-noquery-on-exit-flag? Did I miss something?

This can be useful for async processes run in timers for things like notifications, where the user doesn't really care if a running process actually finishes, since they're killing Emacs.

Yes, thanks.

-- Thierry

bcc32 commented 3 months ago

Emacs itself is a little confusing here; the basic primitive it exposes is set-process-query-on-exit-flag, but it provides :noquery in make-process to set the initial state of the flag. I sort of just arbitrarily picked a direction in this case (my initial version of this PR used set-process-query-on-exit-flag before I found out that :noquery exists), but would be happy to switch it if you think it makes more sense the other way.

thierryvolpiatto commented 3 months ago

Aaron Zeng @.***> writes:

  1. ( ) text/plain (*) text/html

Emacs itself is a little confusing here; the basic primitive it exposes is set-process-query-on-exit-flag, but it provides :noquery in make-process to set the initial state of the flag.

Yes, I guess because the default is to query they provide :noquery to disable it.

I sort of just arbitrarily picked a direction in this case (my initial version of this PR used set-process-query-on-exit-flag before I found out that :noquery exists), but would be happy to switch it if you think it makes more sense the other way.

Yes, it seems simpler to me.

Thanks.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.*Message ID: @.***>

-- Thierry

bcc32 commented 3 months ago

Sounds good, done!

thierryvolpiatto commented 3 months ago

Great, thank you, merged!