From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Open multiple separate terminal buffers with multi-term in Emacs. Date: Wed, 2 Jun 2021 17:28:27 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25818"; mail-complaints-to="usenet@ciao.gmane.io" To: Hongyi Zhao , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 02 11:30:24 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1loNCi-0006XL-0I for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 02 Jun 2021 11:30:24 +0200 Original-Received: from localhost ([::1]:42196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loNCh-0000vk-24 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 02 Jun 2021 05:30:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loNB4-0007Im-8i for help-gnu-emacs@gnu.org; Wed, 02 Jun 2021 05:28:42 -0400 Original-Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:39935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1loNB2-0001b1-MN for help-gnu-emacs@gnu.org; Wed, 02 Jun 2021 05:28:42 -0400 Original-Received: by mail-lf1-x133.google.com with SMTP id p17so1566977lfc.6 for ; Wed, 02 Jun 2021 02:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=8AA5ilEAarDpjAjScc0KktD3NqBpxraeGZbDCOutY40=; b=A+BGButnAjlDNqw7uhJbgu1ty1jZmBF8SIrdNug05JqGmmFX7ObPdPRJquGr5l1iLa 3R4ZWW6/u6CVL+o9Og29yss5LVYhOG9rCXl3JQGvov/jPFDmI3E7bUa3ikT+RzotPq8H 4MW5WqKreRdJ4gFTpAOyP8T+EVQQi+BmatOcftYOZOlLQJVPcVCHal5LZYuEOtB0LR1b hu6LowfmeBmx/SV7eLdqdVi4hHFo8gsu+t5pf90DowMAcHuOeHKYNc0DQLfR6e2STkQk CaL0OdLt/JbmXJdK1Obs4Pk04GdNAvh/ZR/WJqpnhBlZd8XbcKJIKjxBRqbwgJxEiNxw fQFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=8AA5ilEAarDpjAjScc0KktD3NqBpxraeGZbDCOutY40=; b=bEA9ZGB2kX+9DnS1c8DtUBJ0LQ5eaPO2Vh6stJgjhidFCu7U2mNgm7qij+SCwUQ1NZ bH9crvVqL3QzB3vmgioHx5poxL1yeYYwg9DPjHNbz2et1hzHSa5nWl4+AN/eJlTOFKf9 4sf2Pl8UfBjl5ZhiUrPXHxp9MRrXI+nM+xfAGsqAANw3FSAYyPYzdu6sYTHpAEDtmWcw szDPrKngBfusCn+4NuewZx7+saJ6lUMqc+cWZC4yuzFZqK0uwu7iCREDV1+oC7Hhu2Fl 1qhpWPkPo9sa5WZ+TwkasAj0wTq54j6Paez3jPP1UDDY08I0ZYyN0uoK2K23fBvMOSxo V1zQ== X-Gm-Message-State: AOAM531sQQ0wMEB461CzuOVD+r3WUQGYKlNwCJUq28JDFiN3lJ3HizaR w64HI7ryl7htfe9z2pjnRaaZ+fGV90MbdjycKP2ldmW8ObKHkWlP X-Google-Smtp-Source: ABdhPJyehr5SjyUbA+q53c0Zu6hApUbmQCQZYH3yte/Tvpfh77Jj683nEl+6L/7cAYW9+KRaInk9RnMsYnqovEQq8pA= X-Received: by 2002:a05:6512:3f9a:: with SMTP id x26mr23187279lfa.75.1622626119121; Wed, 02 Jun 2021 02:28:39 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=hongyi.zhao@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130492 Archived-At: On Wed, Jun 2, 2021 at 11:57 AM Jean Louis wrote: > > * Hongyi Zhao [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 > =E2=80=98term.el=E2=80=99. > > (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 =E2=80=98term=E2=80=99 apart from always creat= ing a new buffer, > and =E2=80=98C-x=E2=80=99 being marked as a =E2=80=98term-escape-char=E2= =80=99. > > 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 --=20 Assoc. Prof. Hongyi Zhao Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering NO. 552 North Gangtie Road, Xingtai, China