help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Open multiple separate terminal buffers with multi-term in Emacs.


From: Hongyi Zhao
Subject: Re: Open multiple separate terminal buffers with multi-term in Emacs.
Date: Wed, 2 Jun 2021 17:28:27 +0800

On Wed, Jun 2, 2021 at 11:57 AM Jean Louis <bugs@gnu.support> wrote:
>
> * Hongyi Zhao <hongyi.zhao@gmail.com> [2021-06-02 04:39]:
> > But I noticed that the shell commands issued in one terminal will also
> > be shown in the other, i.e., they are the identical one. And I want to
> > open multiple separate terminal buffers, with which I can issue
> > different shell commands in them respectively and observe the
> > corresponding executions of them.
>
> You can use `ansi-term' command to open terminal with different programs:
>
> ansi-term is an autoloaded interactive compiled Lisp function in
> ‘term.el’.
>
> (ansi-term PROGRAM &optional NEW-BUFFER-NAME)
>
>   Probably introduced at or before Emacs version 28.1.
>
> Start a terminal-emulator in a new buffer.
> This is almost the same as ‘term’ apart from always creating a new buffer,
> and ‘C-x’ being marked as a ‘term-escape-char’.
>
> This below would open 2 different terminals with different shells:
>
> (ansi-term "/bin/bash")
> (ansi-term "/bin/zsh")
>
> You can then use argument to invoke new program in new term.
>
> (defun run-with-term ()
>   (interactive)
>   "Runs new command with term"
>   (let ((my-programs '("/bin/bash" "/usr/bin/mc")))
>     (ansi-term (completing-read "Program to run: " my-programs nil nil))))
>

Thank you. It really does the trick.

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China



reply via email to

[Prev in Thread] Current Thread [Next in Thread]