GNU bug report logs -
#63311
30.0.50; [PATCH] smtpmail-send-it split
Previous Next
Full log
Message #118 received at 63311 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
>> Cc: 63311 <at> debbugs.gnu.org
>> Date: Mon, 06 Nov 2023 21:55:49 +0100
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> >> If it is dead and (thread-last-error) returns nil maybe we can conclude
>> >> that everything went well. But if (thread-last-error) returns a
>> >> message, it could be message from any other Emacs thread: what to do in
>> >> such case?
>> >
>> > Display a message about the error.
>>
>> I mean, the last error message could come from another thread not
>> related in anyway to mail sending. No?
>
> It could, but why would there be other threads in this case?
It seems that threads aren't used much in Emacs but isn't it dangerous
to consider we're the only one using them? I don't if it would be easy
but I think that it would be good to have a function like this:
(thread-error thread)
that would return the error message of the given thread like the global
'thread-last-error' does.
>> >> Or worse: the thread is dead, (thread-last-error) returns
>> >> nil... but it was cleared from another part of Emacs.
>> >
>> > This means it exited successfully. We could also maintain a data
>> > structure where successfully-exiting threads will leave their success
>> > status together with some id of the message they sent -- unlike a
>> > thread that dies abruptly due to an error, a successful thread can
>> > store the information in the data structure before exiting.
>>
>> Yes why not but then I'd have to modify internals of 'message-send':
>> something I thought I could escape.
>
> I thought we were talking about a new function for this purpose, which
> would replace message-send, no? Then that new function could have
> this code.
You're right it should be feasible inside this new function with
something like that:
--8<---------------cut here---------------start------------->8---
(make-thread #'(lambda ()
(if (message-send)
(store-my-success)
(store-my-failure))))
--8<---------------cut here---------------end--------------->8---
and then the main-thread will read those success or failure and act
accordingly.
--
Manuel Giraud
This bug report was last modified 1 year and 221 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.