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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 09 Aug 2025 15:20:19 +0300

> Date: Fri, 1 Aug 2025 03:01:11 +0300
> Cc: [email-masked], [email-masked]
> From: Dmitry Gutov <[email-masked]>
> 
> +@var{buffer-disposition} indicates what happens if the thread's current
> +buffer is about to be killed.  If the value is @code{t}, it's not
> +allowed.

I'd say "killing the buffer is not allowed", because "it" might be
ambiguous.

>            Any other value, including nil (which is the default), means
                                        ^^^
@code{nil}

> --- a/src/thread.h
> +++ b/src/thread.h
> @@ -143,6 +143,9 @@ #define lisp_eval_depth (current_thread->m_lisp_eval_depth)
>    struct buffer *m_current_buffer;
>  #define current_buffer (current_thread->m_current_buffer)
>  
> +  /* Decides whether the thread's current buffer can be killed.  */
> +  Lisp_Object buffer_disposition;

I think this change means ABI_VERSION in comp.c should be bumped.

Also, please move this member to before event_object, because the
comment there says:

  /* event_object must be the last Lisp field.  */

which is consistent with how we allocate thread objects:

  struct thread_state *new_thread
    = ALLOCATE_ZEROED_PSEUDOVECTOR (struct thread_state, event_object,
				    PVEC_THREAD);

Finally, this needs a NEWS entry.

With the above nits fixed, please feel free to install, and thanks.