From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.devel Subject: Re: Patch: new function process-file (call-process with file handlers) Date: Sun, 17 Oct 2004 21:19:40 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <86y8i5m9tf.fsf@ketchup.de.uu.net> References: <863c0dnxxe.fsf@ketchup.de.uu.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1098040833 4159 80.91.229.6 (17 Oct 2004 19:20:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 17 Oct 2004 19:20:33 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 17 21:20:27 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 1CJGZu-0006dW-00 for ; Sun, 17 Oct 2004 21:20:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJGhA-0006od-Ki for ged-emacs-devel@m.gmane.org; Sun, 17 Oct 2004 15:27:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CJGh1-0006oT-CB for emacs-devel@gnu.org; Sun, 17 Oct 2004 15:27:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CJGh0-0006o9-MO for emacs-devel@gnu.org; Sun, 17 Oct 2004 15:27:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CJGh0-0006nz-Ie for emacs-devel@gnu.org; Sun, 17 Oct 2004 15:27:46 -0400 Original-Received: from [80.91.229.2] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CJGZI-0004ir-1J for emacs-devel@gnu.org; Sun, 17 Oct 2004 15:19:48 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1CJGZH-0005Rx-00 for ; Sun, 17 Oct 2004 21:19:47 +0200 Original-Received: from pd9e1ec9e.dip.t-dialin.net ([217.225.236.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 17 Oct 2004 21:19:47 +0200 Original-Received: from kai by pd9e1ec9e.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 17 Oct 2004 21:19:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 148 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: pd9e1ec9e.dip.t-dialin.net User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:NQrUYy1jS7h/wtM2WDvF1xZzQbQ= 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:28528 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28528 --=-=-= Oops, thanks for the friendly hints about the attachment... Kai --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=x cvs diff: Diffing lisp Index: lisp/simple.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v retrieving revision 1.661 diff -u -r1.661 simple.el --- lisp/simple.el 19 Sep 2004 00:02:44 -0000 1.661 +++ lisp/simple.el 17 Oct 2004 15:38:08 -0000 @@ -1879,6 +1879,25 @@ (with-current-buffer standard-output (call-process shell-file-name nil t nil shell-command-switch command)))) + +(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)))) + + (defvar universal-argument-map (let ((map (make-sparse-keymap))) Index: lisp/vc.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v retrieving revision 1.381 diff -u -r1.381 vc.el --- lisp/vc.el 13 Oct 2004 17:04:45 -0000 1.381 +++ lisp/vc.el 17 Oct 2004 15:38:10 -0000 @@ -953,7 +953,7 @@ (vc-exec-after `(unless (active-minibuffer-window) (message "Running %s in the background... done" ',command)))) - (setq status (apply 'call-process command nil t nil squeezed)) + (setq status (apply 'process-file command nil t nil squeezed)) (when (or (not (integerp status)) (and okstatus (< okstatus status))) (pop-to-buffer (current-buffer)) (goto-char (point-min)) cvs diff: Diffing lisp/calc cvs diff: Diffing lisp/calendar cvs diff: Diffing lisp/emacs-lisp cvs diff: Diffing lisp/emulation cvs diff: Diffing lisp/eshell cvs diff: Diffing lisp/gnus cvs diff: Diffing lisp/international cvs diff: Diffing lisp/language cvs diff: Diffing lisp/mail cvs diff: Diffing lisp/mh-e cvs diff: Diffing lisp/net Index: lisp/net/tramp-vc.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/net/tramp-vc.el,v retrieving revision 1.9 diff -u -r1.9 tramp-vc.el --- lisp/net/tramp-vc.el 17 Jul 2004 17:28:06 -0000 1.9 +++ lisp/net/tramp-vc.el 17 Oct 2004 15:38:11 -0000 @@ -217,6 +217,7 @@ ;; Daniel Pittman ;;-(if (fboundp 'vc-call-backend) ;;- () ;; This is the new VC for which we don't have an appropriate advice yet +(unless (fboundp 'process-file) (if (fboundp 'vc-call-backend) (defadvice vc-do-command (around tramp-advice-vc-do-command @@ -242,7 +243,7 @@ (setq ad-return-value (apply 'tramp-vc-do-command buffer okstatus command (or file (buffer-file-name)) last flags)) - ad-do-it)))) + ad-do-it))))) ;;-) Index: lisp/net/tramp.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/net/tramp.el,v retrieving revision 1.52 diff -u -r1.52 tramp.el --- lisp/net/tramp.el 17 Oct 2004 14:05:51 -0000 1.52 +++ lisp/net/tramp.el 17 Oct 2004 15:38:16 -0000 @@ -1770,6 +1770,7 @@ (delete-file . tramp-handle-delete-file) (directory-file-name . tramp-handle-directory-file-name) (shell-command . tramp-handle-shell-command) + (process-file . tramp-handle-process-file) (insert-directory . tramp-handle-insert-directory) (expand-file-name . tramp-handle-expand-file-name) (file-local-copy . tramp-handle-file-local-copy) @@ -3469,6 +3470,18 @@ (tramp-run-real-handler 'shell-command (list command output-buffer error-buffer)))) +(defun tramp-handle-process-file (program &optional infile buffer display &rest args) + "Like `process-file' for Tramp files." + (when infile (error "Implementation does not handle input from file")) + (when (and (numberp buffer) (zerop buffer)) + (error "Implementation does not handle immediate return")) + (when (consp buffer) (error "Implementation does not handle error files")) + (shell-command + (mapconcat 'tramp-shell-quote-argument + (cons program args) + " ") + buffer)) + ;; File Editing. (defsubst tramp-make-temp-file () @@ -3960,6 +3973,8 @@ ; COMMAND ((member operation (list 'dired-call-process 'shell-command + ; Post Emacs 21.3 only + 'process-file ; XEmacs only 'dired-print-file 'dired-shell-call-process)) default-directory) cvs diff: Diffing lisp/obsolete cvs diff: Diffing lisp/play cvs diff: Diffing lisp/progmodes cvs diff: Diffing lisp/term cvs diff: Diffing lisp/textmodes cvs diff: Diffing lisp/toolbar cvs diff: Diffing lisp/url --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--