help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trapping process filter error in a thread


From: Thien-Thi Nguyen
Subject: Re: trapping process filter error in a thread
Date: Sat, 02 Apr 2022 20:07:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

() Felix Dietrich <felix.dietrich@sperrhaken.name>
() Thu, 24 Mar 2022 03:33:50 +0100

   > would like to use Emacs' threads and ‘url-http’ funcs.

   You are much braver than I ;).  I am not sure if the url
   library is robust enough for that task, but you can certainly
   try and play around with it.

'Tis a fine line between brave and foolish, i'm told.  :-D

   > (a) Can anyone else reproduce this on their Emacs?

   Yes (also Debianʼs 27.1), but it does not appear to have
   anything to do with threads: it happens just as well when you
   call ‘func’ directly.

I think this tells us that error handing wrt threads are as if
they were invoked as a (top-level) command.

   [analysis: chain of failures] I have not found a good way to
   handle these errors with the url library.

Thanks for digging into the details.  After some poking around,
i realize that the url*.el facility has quite a lot of baggage
to deal w/, as well.  It's amazing how much cruft RFCs output!

   > (c) Is there a recommended way to trap process filter
   > errors for a noninteractive (perhaps batch) session?

   Fix the process filter ;).

Haha!

   I found the variable ‘command-error-function’ in the Emacs
   Lisp manual [...].

Good eye!  I have managed to adapt your code fragment to produce
a bad.el (attached here):

Attachment: bad.el
Description: application/emacs-lisp

that is able to trap the error (see bad.out, here):

Attachment: bad.out
Description: Binary data

Curiously, there is ‘no-catch’ in the CAR of ‘var’ contents, but
i was not able to find any mention of it in the Elisp reference
manual.

   > (d) Is there a more idiomatic way to work w/ threads and
   >     ‘url-http’ (or async network connections, in general)?

   [url-*.el overview, plus emacs-aio]

I hope to be able to study these Someday.

   > Thank-you for any insight into this corner of Emacs Lisp!

   [‘read-string’ in batch mode]

Thanks for the tip.  It's good to see Emacs can be useful in
many different contexts.

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)               ; (2022) Software Libero
   (pcase (context query)               ;       = Dissenso Etico
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]