From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Patch: new function process-file (call-process with file handlers) Date: Sun, 17 Oct 2004 16:48:19 -0400 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <877jppm5x6.fsf-monnier+emacs@gnu.org> References: <863c0dnxxe.fsf@ketchup.de.uu.net> <86y8i5m9tf.fsf@ketchup.de.uu.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1098046132 18532 80.91.229.6 (17 Oct 2004 20:48:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 17 Oct 2004 20:48:52 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 17 22:48:41 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CJHxI-00035v-00 for ; Sun, 17 Oct 2004 22:48:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJI4Y-0004CP-TH for ged-emacs-devel@m.gmane.org; Sun, 17 Oct 2004 16:56:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CJI4I-00041X-Jm for emacs-devel@gnu.org; Sun, 17 Oct 2004 16:55:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CJI4H-0003zo-NQ for emacs-devel@gnu.org; Sun, 17 Oct 2004 16:55:53 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJI4H-0003zO-JN for emacs-devel@gnu.org; Sun, 17 Oct 2004 16:55:53 -0400 Original-Received: from [209.226.175.4] (helo=tomts16-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CJHwy-0007G2-6E for emacs-devel@gnu.org; Sun, 17 Oct 2004 16:48:20 -0400 Original-Received: from alfajor ([70.48.81.134]) by tomts16-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20041017204819.LOVD15612.tomts16-srv.bellnexxia.net@alfajor>; Sun, 17 Oct 2004 16:48:19 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id 1AF2BD7363; Sun, 17 Oct 2004 16:48:19 -0400 (EDT) Original-To: Kai Grossjohann In-Reply-To: <86y8i5m9tf.fsf@ketchup.de.uu.net> (Kai Grossjohann's message of "Sun, 17 Oct 2004 21:19:40 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:28531 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28531 > +(defun process-file (program &optional infile buffer display &rest args) > + "Process files synchronously in a separate process. > +Similar to `call-process', but may invoke a file handler based on > +`default-directory'. The current working directory of the > +subprocess is `default-directory'. > + > +File names in INFILE and BUFFER are handled normally, but file > +names in ARGS should be relative to `default-directory', as they > +are passed to the process verbatim. > + > +Some file handlers might not support all variants, for example > +they might behave as if DISPLAY was nil, regardless of the actual > +value passed." > + (let ((fh (find-file-name-handler default-directory 'process-file))) > + (if fh (apply fh 'process-file program infile buffer display args) > + (apply 'call-process program infile buffer display args)))) Looks good to me, except I'm not sure what INFILE should do. I guess we could use the following convention: if it is a relative file name, then it's a file on the remote host, otherwise, it's a file on the local host that should be passed "manually" by reading the file in a buffer and feeding it via the stdin pipe. Same thing for STDERR-FILE. Stefan