# HG changeset patch # User Michael Albinus # Date 1185310158 0 # Node ID 76546b143f2df7f2eac1edd1c00c981c6598d42f # Parent ec5e699d1426a42adc5f1fa5f496ae9ce5d9f73c * subr.el (start-file-process-shell-command) (process-file-shell-command): New defuns. * progmodes/compile.el (compilation-start): Apply `start-file-process-shell-command'. diff -r ec5e699d1426 -r 76546b143f2d lisp/ChangeLog --- a/lisp/ChangeLog Tue Jul 24 20:40:26 2007 +0000 +++ b/lisp/ChangeLog Tue Jul 24 20:49:18 2007 +0000 @@ -1,3 +1,11 @@ +2007-07-24 Michael Albinus + + * subr.el (start-file-process-shell-command) + (process-file-shell-command): New defuns. + + * progmodes/compile.el (compilation-start): Apply + `start-file-process-shell-command'. + 2007-07-24 Alexandre Julliard * vc-git.el (vc-git-checkout, vc-directory-exclusion-list): Fix diff -r ec5e699d1426 -r 76546b143f2d lisp/progmodes/compile.el --- a/lisp/progmodes/compile.el Tue Jul 24 20:40:26 2007 +0000 +++ b/lisp/progmodes/compile.el Tue Jul 24 20:49:18 2007 +0000 @@ -1101,8 +1101,7 @@ (unless (getenv "EMACS") (list "EMACS=t")) (list "INSIDE_EMACS=t") - (copy-sequence process-environment))) - (start-process (symbol-function 'start-process))) + (copy-sequence process-environment)))) (set (make-local-variable 'compilation-arguments) (list command mode name-function highlight-regexp)) (set (make-local-variable 'revert-buffer-function) @@ -1123,22 +1122,14 @@ ;; comint uses `start-file-process'. (get-buffer-process (with-no-warnings - (comint-exec outbuf (downcase mode-name) - shell-file-name nil `("-c" ,command)))) - ;; Redefine temporarily `start-process' in order to - ;; handle remote compilation. - (fset 'start-process - (lambda (name buffer program &rest program-args) - (apply - (if (file-remote-p default-directory) - 'start-file-process - start-process) - name buffer program program-args))) - (unwind-protect - (start-process-shell-command (downcase mode-name) - outbuf command) - ;; Unwindform: Reset original definition of `start-process'. - (fset 'start-process start-process))))) + (comint-exec + outbuf (downcase mode-name) + (if (file-remote-p default-directory) + "/bin/sh" + shell-file-name) + `("-c" ,command)))) + (start-file-process-shell-command (downcase mode-name) + outbuf command)))) ;; Make the buffer's mode line show process state. (setq mode-line-process '(":%s")) (set-process-sentinel proc 'compilation-sentinel) diff -r ec5e699d1426 -r 76546b143f2d lisp/subr.el --- a/lisp/subr.el Tue Jul 24 20:40:26 2007 +0000 +++ b/lisp/subr.el Tue Jul 24 20:49:18 2007 +0000 @@ -2310,6 +2310,15 @@ (start-process name buffer shell-file-name shell-command-switch (mapconcat 'identity args " "))))) +(defun start-file-process-shell-command (name buffer &rest args) + "Start a program in a subprocess. Return the process object for it. +Similar to `start-process-shell-command', but calls `start-file-process'." + (start-file-process + name buffer + (if (file-remote-p default-directory) "/bin/sh" shell-file-name) + (if (file-remote-p default-directory) "-c" shell-command-switch) + (mapconcat 'identity args " "))) + (defun call-process-shell-command (command &optional infile buffer display &rest args) "Execute the shell command COMMAND synchronously in separate process. @@ -2341,6 +2350,16 @@ infile buffer display shell-command-switch (mapconcat 'identity (cons command args) " "))))) + +(defun process-file-shell-command (command &optional infile buffer display + &rest args) + "Process files synchronously in a separate process. +Similar to `call-process-shell-command', but calls `process-file'." + (process-file + (if (file-remote-p default-directory) "/bin/sh" shell-file-name) + infile buffer display + (if (file-remote-p default-directory) "-c" shell-command-switch) + (mapconcat 'identity (cons command args) " "))) ;;;; Lisp macros to do various things temporarily.