summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2000-10-27 08:00:32 +0000
committerMiles Bader <miles@gnu.org>2000-10-27 08:00:32 +0000
commita7fd458a8c8548929ac0c499a42ffa7dc6c2c7a1 (patch)
treea8654a58c683e207023ef7277ce2f01b5ea3d5d1 /lisp/comint.el
parent05ea7ef21a0f047b31205de0434af6bc3a42dfcd (diff)
downloademacs-a7fd458a8c8548929ac0c499a42ffa7dc6c2c7a1.tar.gz
(make-comint-in-buffer): New function.
(make-comint): Use it.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el33
1 files changed, 23 insertions, 10 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 8b23aa62b28..d42a2ef0a86 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -640,6 +640,28 @@ BUFFER can be either a buffer or the name of one."
(and proc (memq (process-status proc) '(open run stop)))))
;;;###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.
+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
+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)
+ (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
+ (comint-mode)) ; Install local vars, mode, keymap, ...
+ (comint-exec buffer name program startfile switches))
+ buffer)
+
+;;;###autoload
(defun make-comint (name program &optional startfile &rest switches)
"Make a comint process NAME in a buffer, running PROGRAM.
The name of the buffer is made by surrounding NAME with `*'s.
@@ -650,16 +672,7 @@ running process in that buffer, it is not restarted. Optional third 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)
- (error "Multi-processing is not supported for this system"))
- (let ((buffer (get-buffer-create (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
- (comint-mode)) ; Install local vars, mode, keymap, ...
- (comint-exec buffer name program startfile switches))
- buffer))
+ (apply #'make-comint-in-buffer name nil program startfile switches))
;;;###autoload
(defun comint-run (program)