From 4b29e550e628763797dac6f7c51a31816d2c500c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 10 Jul 2007 19:52:11 +0000 Subject: [PATCH] * comint.el (make-comint, make-comint-in-buffer) (comint-exec-1): Replace `start-process' by `start-file-process'. * progmodes/compile.el (compilation-start): Revert redefining `start-process'. --- lisp/ChangeLog | 8 ++++++ lisp/comint.el | 20 +++++++-------- lisp/progmodes/compile.el | 54 +++++++++++++++------------------------ 3 files changed, 38 insertions(+), 44 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index babcb63d9c8..2c0e79bb75f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2007-07-10 Michael Albinus + + * comint.el (make-comint, make-comint-in-buffer) + (comint-exec-1): Replace `start-process' by `start-file-process'. + + * progmodes/compile.el (compilation-start): Revert redefining + `start-process'. + 2007-07-10 Stefan Monnier * follow.el: Don't change the global map from the follow-mode-map diff --git a/lisp/comint.el b/lisp/comint.el index 7d81f357e22..bf53741f658 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -670,13 +670,13 @@ BUFFER can be either a buffer or the name of one." "Make a Comint process NAME in BUFFER, running PROGRAM. If BUFFER is nil, it defaults to NAME surrounded by `*'s. PROGRAM should be either a string denoting an executable program to create -via `start-process', or a cons pair of the form (HOST . SERVICE) denoting a TCP -connection to be opened via `open-network-stream'. If there is already a -running process in that buffer, it is not restarted. Optional fourth arg +via `start-file-process', or a cons pair of the form (HOST . SERVICE) denoting +a TCP connection to be opened via `open-network-stream'. If there is already +a running process in that buffer, it is not restarted. Optional fourth arg STARTFILE is the name of a file to send the contents of to the process. If PROGRAM is a string, any more args are arguments to PROGRAM." - (or (fboundp 'start-process) + (or (fboundp 'start-file-process) (error "Multi-processing is not supported for this system")) (setq buffer (get-buffer-create (or buffer (concat "*" name "*")))) ;; If no process, or nuked process, crank up a new one and put buffer in @@ -693,9 +693,9 @@ If PROGRAM is a string, any more args are arguments to PROGRAM." "Make a Comint process NAME in a buffer, running PROGRAM. The name of the buffer is made by surrounding NAME with `*'s. PROGRAM should be either a string denoting an executable program to create -via `start-process', or a cons pair of the form (HOST . SERVICE) denoting a TCP -connection to be opened via `open-network-stream'. If there is already a -running process in that buffer, it is not restarted. Optional third arg +via `start-file-process', or a cons pair of the form (HOST . SERVICE) denoting +a TCP connection to be opened via `open-network-stream'. If there is already +a running process in that buffer, it is not restarted. Optional third arg STARTFILE is the name of a file to send the contents of the process to. If PROGRAM is a string, any more args are arguments to PROGRAM." @@ -781,17 +781,17 @@ buffer. The hook `comint-exec-hook' is run after each exec." ;; If the command has slashes, make sure we ;; first look relative to the current directory. (cons default-directory exec-path) exec-path))) - (setq proc (apply 'start-process name buffer command switches))) + (setq proc (apply 'start-file-process name buffer command switches))) (let ((coding-systems (process-coding-system proc))) (setq decoding (car coding-systems) encoding (cdr coding-systems))) - ;; If start-process decided to use some coding system for decoding + ;; If start-file-process decided to use some coding system for decoding ;; data sent from the process and the coding system doesn't ;; specify EOL conversion, we had better convert CRLF to LF. (if (vectorp (coding-system-eol-type decoding)) (setq decoding (coding-system-change-eol-conversion decoding 'dos) changed t)) - ;; Even if start-process left the coding system for encoding data + ;; Even if start-file-process left the coding system for encoding data ;; sent from the process undecided, we had better use the same one ;; as what we use for decoding. But, we should suppress EOL ;; conversion. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 0d08b755a9e..31fd7741a25 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1098,8 +1098,7 @@ Returns the compilation buffer created." (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) @@ -1114,39 +1113,26 @@ Returns the compilation buffer created." (if compilation-process-setup-function (funcall compilation-process-setup-function)) (compilation-set-window-height outwin) - ;; 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))) ;; Start the compilation. - (unwind-protect - (let ((proc (if (eq mode t) - (get-buffer-process - (with-no-warnings - (comint-exec outbuf (downcase mode-name) - shell-file-name nil - `("-c" ,command)))) - (start-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) - (set-process-filter proc 'compilation-filter) - (set-marker (process-mark proc) (point) outbuf) - (when compilation-disable-input - (condition-case nil - (process-send-eof proc) - ;; The process may have exited already. - (error nil))) - (setq compilation-in-progress - (cons proc compilation-in-progress))) - ;; Unwindform: Reset original definition of `start-process' - (fset 'start-process start-process))) + (let ((proc (if (eq mode t) + (get-buffer-process + (with-no-warnings + (comint-exec outbuf (downcase mode-name) + shell-file-name nil `("-c" ,command)))) + (start-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) + (set-process-filter proc 'compilation-filter) + (set-marker (process-mark proc) (point) outbuf) + (when compilation-disable-input + (condition-case nil + (process-send-eof proc) + ;; The process may have exited already. + (error nil))) + (setq compilation-in-progress + (cons proc compilation-in-progress)))) ;; Now finally cd to where the shell started make/grep/... (setq default-directory thisdir)) (if (buffer-local-value 'compilation-scroll-output outbuf) -- 2.39.2