Function: comint-exec-1

comint-exec-1 is a byte-compiled function defined in comint.el.gz.

Signature

(comint-exec-1 NAME BUFFER COMMAND SWITCHES)

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
;; This auxiliary function cranks up the process for comint-exec in
;; the appropriate environment.

(defun comint-exec-1 (name buffer command switches)
  (let ((process-environment
	 (nconc
          (comint-term-environment)
	  (list (format "INSIDE_EMACS=%s,comint" emacs-version))
          (when comint-pager
            (if (stringp comint-pager)
                (list (format "PAGER=%s" comint-pager))
              (error "comint-pager should be a string: %s" comint-pager)))
	  process-environment))
	(default-directory
	  (if (file-accessible-directory-p default-directory)
	      default-directory
	    "/"))
	proc decoding encoding changed)
    (let ((exec-path (if (and command (file-name-directory command))
			 ;; 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-file-process name buffer command switches)))
    ;; Some file name handler cannot start a process, fe ange-ftp.
    (unless (processp proc) (error "No process started"))
    (let ((coding-systems (process-coding-system proc)))
      (setq decoding (car coding-systems)
	    encoding (cdr coding-systems)))
    ;; 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.
    (if (and decoding (not encoding))
	(setq encoding (coding-system-change-eol-conversion decoding 'unix)
	      changed t))
    (if changed
	(set-process-coding-system proc decoding encoding))
    proc))