Subject: bug#32169: 27.0.50; Wishlist: cleanup of thread-last-error

From: Eli Zaretskii <[email-masked]>
Date: Mon, 16 Jul 2018 18:28:07 +0300

> From: Michael Albinus <[email-masked]>
> Cc: [email-masked]
> Date: Mon, 16 Jul 2018 16:49:42 +0200
> 
> > How about having thread-last-error clear the error as a side effect,
> > perhaps when called with an optional argument?
> 
> I'd be happy with either variant.

Should be easy to do, I think.

> While working on making Tramp threadsafe, I use the following instead of
> `signal':
> 
> (defsubst tramp-compat-signal (error-symbol data)
>   "Signal an error to the main thread."
>   (when tramp-compat-main-thread
>     (tramp-compat-funcall
>      'thread-signal tramp-compat-main-thread error-symbol data))
>   (signal error-symbol data))
> 
> Works sufficient so far. `tramp-compat-main-thread' is a defconst, which
> has as value (car (all-threads)).

I was certain we had on master a function ti return the main thread,
but I guess I was dreaming.  We could easily add it, though.

In any case, I think it could be a good idea to describe this
technique in the ELisp manual.

> PS: Maybe I shall push this to a git branch, giving people a chance for
> early tests. `find-file-noselect' survives already in simple cases, w/o
> an Emacs crash.

SGTM, thanks.