From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: [QUESTION] How to use :filter in `make-process'?
Date: Tue, 03 Mar 2020 09:39:04 -0500 [thread overview]
Message-ID: <jwvzhcx5wut.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 87r1y97u8v.fsf@gmail.com
> (let ((op-fn (lambda () (message "call the fn"))))
> (make-process
> :name "sleep command test"
> :command (list "sleep" "3")
> :filter `(lambda (proc event)
> (message "event catched!")
^^^^^^^
caught ;-)
> (funcall ,op-fn))
> :buffer "*sleep test*"))
More importantly, the ,op-fn is incorrect, it should be ',op-fn
otherwise the value contained in op-fn will be re-interpreted as an
expression (which will sometimes be harmless but sometimes not,
depending on how the function value ends up represented).
Of course, the better solution is to use `lexical-binding` so you can
just write:
(let ((op-fn (lambda () (message "call the fn"))))
(make-process
:name "sleep command test"
:command (list "sleep" "3")
:filter (lambda (proc event)
(message "event catched!")
(funcall op-fn))
:buffer "*sleep test*"))
-- Stefan
next prev parent reply other threads:[~2020-03-03 14:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 7:49 [QUESTION] How to use :filter in `make-process'? stardiviner
2020-03-03 8:19 ` Joost Kremers
2020-03-03 16:18 ` [SOLVED] " stardiviner
2020-03-03 16:51 ` Stefan Monnier
2020-03-03 17:33 ` stardiviner
2020-03-03 14:39 ` Stefan Monnier [this message]
2020-03-03 15:08 ` stardiviner
2020-03-03 15:25 ` Michael Heerdegen
2020-03-03 17:34 ` stardiviner
2020-03-03 16:49 ` Stefan Monnier
2020-03-03 17:35 ` stardiviner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvzhcx5wut.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).