Function: make-comint-in-buffer

make-comint-in-buffer is an autoloaded and byte-compiled function defined in comint.el.gz.

Signature

(make-comint-in-buffer NAME BUFFER PROGRAM &optional STARTFILE &rest SWITCHES)

Documentation

Make a Comint process NAME in BUFFER, running PROGRAM.

If BUFFER is nil, it defaults to NAME surrounded by *s. If there is a running process in BUFFER, it is not restarted.

PROGRAM should be one of the following:
- a string, denoting an executable program to create via
  start-file-process
- a cons pair of the form (HOST . SERVICE), denoting a TCP
  connection to be opened via open-network-stream
- nil, denoting a newly-allocated pty.

Optional fourth arg STARTFILE is the name of a file, whose contents are sent to the process as its initial input.

If PROGRAM is a string, any more args are arguments to PROGRAM.

Return the (possibly newly created) process buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
;;;###autoload
(defun make-comint-in-buffer (name buffer program &optional startfile &rest switches)
  "Make a Comint process NAME in BUFFER, running PROGRAM.
If BUFFER is nil, it defaults to NAME surrounded by `*'s.
If there is a running process in BUFFER, it is not restarted.

PROGRAM should be one of the following:
- a string, denoting an executable program to create via
  `start-file-process'
- a cons pair of the form (HOST . SERVICE), denoting a TCP
  connection to be opened via `open-network-stream'
- nil, denoting a newly-allocated pty.

Optional fourth arg STARTFILE is the name of a file, whose
contents are sent to the process as its initial input.

If PROGRAM is a string, any more args are arguments to PROGRAM.

Return the (possibly newly created) process buffer."
  (or (fboundp 'make-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
  ;; comint mode.  Otherwise, leave buffer and existing process alone.
  (unless (comint-check-proc buffer)
    (with-current-buffer buffer
      (unless (derived-mode-p 'comint-mode)
	(comint-mode))) ; Install local vars, mode, keymap, ...
    (comint-exec buffer name program startfile switches))
  buffer)