GNU bug report logs -
#76969
kill-buffer fails silently when a thread exists where it's current
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi Eli,
On 18/03/2025 02:21, Dmitry Gutov wrote:
> On 17/03/2025 21:41, Eli Zaretskii wrote:
>> Don't forget that
>> the target thread could be the main thread.
>
> Good question what we should do with the main thread in this case - but
> even if it receives the signal, it should be more a lot more visible to
> the user than in background threads, helping fix whatever misbehavior
> that caused it.
>
> But we'll probably use the same method that's being discussed to declare
> a thread an exception, prohibiting its buffer from being killed externally.
Here's a patch with implementation:
* It's a property of the thread, on by default.
* Set to nil for the main thread (currently can be changed from Lisp).
* Not a buffer-local variable - and looking more at it, that seems not a
good idea, because several threads could have the same buffer current,
and some might be okay with this behavior, while others not.
* A couple of questions about the finer details of the implementation,
see comments in 'thread_all_before_buffer_killed'.
* Two tests included.
Seems to work well in my testing, and in the diff-hl scenario described
in the report: step 5 kills the buffer and sends the signal which I can
catch inside condition-case in diff-hl--update-safe.
WDYT?
[thread-buffer-killable-p.diff (text/x-patch, attachment)]
This bug report was last modified 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.