unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Hongyi Zhao <hongyi.zhao@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Open multiple separate terminal buffers with multi-term in Emacs.
Date: Wed, 2 Jun 2021 06:53:02 +0300	[thread overview]
Message-ID: <YLcAnkwTpnG0irKg@protected.localdomain> (raw)
In-Reply-To: <CAGP6POKbYykiCJ7sXWkZP5MFT6_-tE+oV5mj+63zh8BzGo9QBw@mail.gmail.com>

* 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/



  reply	other threads:[~2021-06-02  3:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02  1:38 Open multiple separate terminal buffers with multi-term in Emacs Hongyi Zhao
2021-06-02  3:53 ` Jean Louis [this message]
2021-06-02  9:28   ` Hongyi Zhao
2021-06-02  9:35     ` Hongyi Zhao
2021-06-02  6:57 ` Joost Kremers
2021-06-02  9:56   ` Hongyi Zhao
2021-06-02 10:04     ` Joost Kremers
2021-06-02 11:07       ` Jean Louis
2021-06-02 13:09   ` Hongyi Zhao
2021-06-02 14:05     ` Hongyi Zhao
2021-11-15  7:37 ` Thien-Thi Nguyen
2021-11-15  7:44   ` Hongyi Zhao
2021-11-15  9:12     ` Thien-Thi Nguyen
2021-11-15 11:25       ` Hongyi Zhao
2021-11-15 12:12         ` Thien-Thi Nguyen
2021-11-15 23:35           ` Hongyi Zhao
2021-11-16  0:24             ` Hongyi Zhao
2021-11-17  3:26               ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-17  4:31                 ` Hongyi Zhao
2021-11-17 14:27                   ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-11-18  2:33                     ` Hongyi Zhao
2021-11-20  3:13           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-26 20:56             ` Samuel Banya
2021-11-27  3:22               ` Hongyi Zhao
2021-11-27 21:45                 ` Samuel Banya
2021-11-27 21:52                   ` Samuel Banya
2021-11-28  2:59                     ` Hongyi Zhao
2021-11-27 23:04                       ` Samuel Banya
2021-11-28  4:38                     ` Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLcAnkwTpnG0irKg@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hongyi.zhao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).