[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Open multiple separate terminal buffers with multi-term in Emacs.
From: |
Jean Louis |
Subject: |
Re: Open multiple separate terminal buffers with multi-term in Emacs. |
Date: |
Wed, 2 Jun 2021 06:53:02 +0300 |
User-agent: |
Mutt/2.0.7+183 (3d24855) (2021-05-28) |
* 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))))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/