From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Proposal for extending set-process-filter Date: 27 Apr 2004 01:55:46 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1083023898 21870 80.91.224.253 (26 Apr 2004 23:58:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Apr 2004 23:58:18 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Apr 27 01:58:11 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BIFzG-0007QP-00 for ; Tue, 27 Apr 2004 01:58:10 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BIFzG-0002Lo-00 for ; Tue, 27 Apr 2004 01:58:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BIFzC-00037H-E2 for emacs-devel@quimby.gnus.org; Mon, 26 Apr 2004 19:58:06 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BIFxb-0001xf-H1 for emacs-devel@gnu.org; Mon, 26 Apr 2004 19:56:27 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BIFwy-0001Re-11 for emacs-devel@gnu.org; Mon, 26 Apr 2004 19:56:19 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BIFwx-0001RV-KO for emacs-devel@gnu.org; Mon, 26 Apr 2004 19:55:47 -0400 Original-Received: from fencepost.gnu.org ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.24) id 1BIFv1-0005qV-Hw for emacs-devel@gnu.org; Mon, 26 Apr 2004 19:53:47 -0400 Original-To: emacs-devel@gnu.org Original-Lines: 38 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22204 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22204 Currently, processes called with call-process can't have their stdout and stderr directed to different buffers/filter functions/whatever. This is painfully obvious when using pipes and redirections in eshell. I'd propose that set-process-filter gets extended in the following way: set-process-filter is a built-in function in `src/process.c'. (set-process-filter PROCESS FILTER) Give PROCESS the filter function FILTER; nil means no filter. t means stop accepting output from the process. A filter can be 1) a function which gets two arguments. [insert old description] 2) a buffer into which output gets inserted. 3) a file name for output. 4) t to stop accepting output. 5) a list of filter/file descriptor associations. The car's of the elements of this list are an item from 1)-4) as above, while the cdr is a list of file ids for which this item is supposed to apply. So to redirect output of stdout and stderr to /dev/null, you'd specify (set-process-filter my-process '(("/dev/null" 1 2))) If a list is specified in this manner, the operation of unspecified file descriptors is not affected. This does not yet do everything needed for a full-bodied eshell: input redirections (including procedural input, equivalents to filter functions) and output appending redirection (>>) are not covered yet. But it would be a first step. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum