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 19:54:47 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

() Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org>
() Tue, 22 Mar 2022 20:28:12 +0100

   Isn't the syntax/usage rather as in e.g.

   (defun erc-element-next (&optional prev)
     (interactive "P")
     (when (erc-at-prompt-p)
       (goto-char (point-min)) )
     (condition-case nil
         (if prev
             (erc-button-previous)
           (erc-button-next) )
       (error (progn
                (goto-char (point-max))
                (when prev
                  (erc-bol) )))))

I assume you're talking about ‘condition-case’, right?  I think
it's no problem to specify ‘t’ as the condition instead of
‘error’.  (I've used both forms in my code before w/o issue.)

   > (a) Can anyone else reproduce this on their Emacs?
   >     (Obviously your Emacs has to be built w/
   >     thread support.)

   What are threads in this context and how do you build Emacs
   for that

Threads are the "mini process" abstraction supported by modern
operating systems (in various ways):

- https://en.wikipedia.org/wiki/Thread_%28computing%29

On my system, the pre-packaged Emacs (27.1) has thread support
already included; i did not need to do anything special to
enable it.  However, if you're building from source, i see that
the configure script has this ‘--help’ output excerpt:

  --without-threads       don't compile with elisp threading support

which makes me think that thread support is enabled unless you
explicitly disable it.  (TLDR: Maybe your Emacs already has it!)

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

   What's a process filter?

It's the function that manages the output of a subprocess:

- (info "(elisp) Filter Functions")

In this context, it also manages network connections (which are
treated using the subprocess framework).

-- 
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]