From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: start-process and set-process-filter sequence Date: Thu, 14 Apr 2011 07:11:55 +0200 Message-ID: <878vvdpgbo.fsf@gmail.com> References: <21glbp094jfn.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1302757947 14501 80.91.229.12 (14 Apr 2011 05:12:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 14 Apr 2011 05:12:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 14 07:12:23 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QAEqt-0002ru-IF for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Apr 2011 07:12:23 +0200 Original-Received: from localhost ([::1]:57832 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAEqt-0003rR-3y for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Apr 2011 01:12:23 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAEqo-0003rK-0t for help-gnu-emacs@gnu.org; Thu, 14 Apr 2011 01:12:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QAEqm-0007rW-CK for help-gnu-emacs@gnu.org; Thu, 14 Apr 2011 01:12:17 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:51388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAEqm-0007rE-3o for help-gnu-emacs@gnu.org; Thu, 14 Apr 2011 01:12:16 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QAEql-0002ob-48 for help-gnu-emacs@gnu.org; Thu, 14 Apr 2011 07:12:15 +0200 Original-Received: from 82.77.197-77.rev.gaoland.net ([77.197.77.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Apr 2011 07:12:15 +0200 Original-Received: from thierry.volpiatto by 82.77.197-77.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Apr 2011 07:12:15 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 82.77.197-77.rev.gaoland.net User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.3.50 (gnu/linux) Cancel-Lock: sha1:/hSvfju7uWI5l23Rn8pKHsK8oG8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80787 Archived-At: William Xu writes: > Hi, > > Because set-process-filter will be done after the process is created by > start-process, it seems there is a possibility that the filter may miss > some process output. Consider this: > > (defun foo (proc output) > (setq a output)) > > (let ((proc (start-process "ls" "ls" "ls"))) > ;; (read-string "Mood: ") > (setq a nil) > (set-process-filter proc 'foo)) > > Compare comment and uncomment the read-string line, `a' would be > different. > > Is there a way to set a process filter before the process starts? so > that we won't miss any output. prog1 something like this: --8<---------------cut here---------------start------------->8--- (prog1 (start-process "ls" "ls" "ls") (set-process-filter (get-process "ls") 'foo) (setq a nil) ;(read-string "Mood: ") ) --8<---------------cut here---------------end--------------->8--- -- A+ Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997