Subject: Re: bug#76969: kill-buffer fails silently when a thread exists where it's current

From: Eli Zaretskii <[email-masked]>
Date: Thu, 13 Mar 2025 22:38:15 +0200

> From: Spencer Baugh <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Thu, 13 Mar 2025 16:16:46 -0400
> 
> Note that if you try kill a buffer which is the process-buffer of some
> process:
> 
> - process-kill-buffer-query-function will query the user whether they
>   want to proceed.
> 
> - If the user decides to proceed, then the process in that buffer will
>   simply be killed with SIGHUP.
> 
> Perhaps we should do a similar thing for threads?

That still leaves the issue of what to do if the user says to kill.
The basic problem of being unable to leave a thread without a
current-buffer still stands, and needs to be solved.

> - Add a new kill-buffer-query-functions which checks if the buffer being
>   killed is the current-buffer of any threads, and if so, queries the
>   user if they want to proceed.
> 
> - If the user decides to proceed, then do something like killing the
>   thread with SIGHUP.  Probably call thread-signal on the thread.  We'll
>   still need to switch the thread's current-buffer to a new buffer,
>   since the thread could choose to handle the signal and continue
>   executing.

Same here: these measures don't solve the technical reason why killing
buffers that are current in some other thread was disallowed.