Mercurial > emacs
comparison lisp/comint.el @ 32942:395a1cdfb022
(make-comint-in-buffer): New function.
(make-comint): Use it.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 27 Oct 2000 08:00:32 +0000 |
parents | 25182c4fd302 |
children | ab1061464a32 |
comparison
equal
deleted
inserted
replaced
32941:7a425cdcc3b2 | 32942:395a1cdfb022 |
---|---|
638 BUFFER can be either a buffer or the name of one." | 638 BUFFER can be either a buffer or the name of one." |
639 (let ((proc (get-buffer-process buffer))) | 639 (let ((proc (get-buffer-process buffer))) |
640 (and proc (memq (process-status proc) '(open run stop))))) | 640 (and proc (memq (process-status proc) '(open run stop))))) |
641 | 641 |
642 ;;;###autoload | 642 ;;;###autoload |
643 (defun make-comint-in-buffer (name buffer program &optional startfile &rest switches) | |
644 "Make a comint process NAME in BUFFER, running PROGRAM. | |
645 If BUFFER is nil, it defaults to NAME surrounded by `*'s. | |
646 PROGRAM should be either a string denoting an executable program to create | |
647 via `start-process', or a cons pair of the form (HOST . SERVICE) denoting a TCP | |
648 connection to be opened via `open-network-stream'. If there is already a | |
649 running process in that buffer, it is not restarted. Optional third arg | |
650 STARTFILE is the name of a file to send the contents of to the process. | |
651 | |
652 If PROGRAM is a string, any more args are arguments to PROGRAM." | |
653 (or (fboundp 'start-process) | |
654 (error "Multi-processing is not supported for this system")) | |
655 (setq buffer (get-buffer-create (or buffer (concat "*" name "*")))) | |
656 ;; If no process, or nuked process, crank up a new one and put buffer in | |
657 ;; comint mode. Otherwise, leave buffer and existing process alone. | |
658 (unless (comint-check-proc buffer) | |
659 (with-current-buffer buffer | |
660 (comint-mode)) ; Install local vars, mode, keymap, ... | |
661 (comint-exec buffer name program startfile switches)) | |
662 buffer) | |
663 | |
664 ;;;###autoload | |
643 (defun make-comint (name program &optional startfile &rest switches) | 665 (defun make-comint (name program &optional startfile &rest switches) |
644 "Make a comint process NAME in a buffer, running PROGRAM. | 666 "Make a comint process NAME in a buffer, running PROGRAM. |
645 The name of the buffer is made by surrounding NAME with `*'s. | 667 The name of the buffer is made by surrounding NAME with `*'s. |
646 PROGRAM should be either a string denoting an executable program to create | 668 PROGRAM should be either a string denoting an executable program to create |
647 via `start-process', or a cons pair of the form (HOST . SERVICE) denoting a TCP | 669 via `start-process', or a cons pair of the form (HOST . SERVICE) denoting a TCP |
648 connection to be opened via `open-network-stream'. If there is already a | 670 connection to be opened via `open-network-stream'. If there is already a |
649 running process in that buffer, it is not restarted. Optional third arg | 671 running process in that buffer, it is not restarted. Optional third arg |
650 STARTFILE is the name of a file to send the contents of to the process. | 672 STARTFILE is the name of a file to send the contents of to the process. |
651 | 673 |
652 If PROGRAM is a string, any more args are arguments to PROGRAM." | 674 If PROGRAM is a string, any more args are arguments to PROGRAM." |
653 (or (fboundp 'start-process) | 675 (apply #'make-comint-in-buffer name nil program startfile switches)) |
654 (error "Multi-processing is not supported for this system")) | |
655 (let ((buffer (get-buffer-create (concat "*" name "*")))) | |
656 ;; If no process, or nuked process, crank up a new one and put buffer in | |
657 ;; comint mode. Otherwise, leave buffer and existing process alone. | |
658 (unless (comint-check-proc buffer) | |
659 (with-current-buffer buffer | |
660 (comint-mode)) ; Install local vars, mode, keymap, ... | |
661 (comint-exec buffer name program startfile switches)) | |
662 buffer)) | |
663 | 676 |
664 ;;;###autoload | 677 ;;;###autoload |
665 (defun comint-run (program) | 678 (defun comint-run (program) |
666 "Run PROGRAM in a comint buffer and switch to it. | 679 "Run PROGRAM in a comint buffer and switch to it. |
667 The buffer name is made by surrounding the file name of PROGRAM with `*'s. | 680 The buffer name is made by surrounding the file name of PROGRAM with `*'s. |