[Top][All Lists]

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

Re: How can I write this function better?

From: Thien-Thi Nguyen
Subject: Re: How can I write this function better?
Date: Thu, 16 Mar 2017 09:30:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

() Patrick <>
() Wed, 15 Mar 2017 10:55:29 +0100

   Note how you can define the process and then add properties
   or set a sentinel `later' in the function, took me some time
   to figure this out.  But I still don't know if that's always
   the case (feedback very welcome).

Generally, if you have:

(let ((proc (start-process ...)))
  (set-process-sentinel proc FUNC))

FUNC will not be run (due to ‘proc’ not accepting output) unless
OTHER-CODE does (directly or indirectly) ‘sit-for’, ‘sleep-for’,
or ‘accept-process-output’, or waits for terminal input (e.g.,
w/ ‘read-string’).  See: (info "(elisp) Output from Processes")
and ‘git grep -n -H -e set-process-\\\(sentinel\\\|filter\\\)’
output (Emacs source) for theory and practice, respectively.

Assigning the process sentinel (or filter) need not even occur
in the same block.  Indeed, any "later" point in time is fine
(although there is such a thing as "too late to be useful" :-D).
I use this one-process-multiple-filter-set-"later" approach in
gnugo.el, for example.

Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(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]