all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Run multiple shells in Emacs.
@ 2021-05-31 23:13 Hongyi Zhao
  2021-05-31 23:18 ` Jean Louis
  2021-05-31 23:23 ` Óscar Fuentes
  0 siblings, 2 replies; 7+ messages in thread
From: Hongyi Zhao @ 2021-05-31 23:13 UTC (permalink / raw)
  To: help-gnu-emacs

What's the preferable way to open multiple shell windows at the same
time in Emacs?

After searching with Google, I find the discussion here:

<https://stackoverflow.com/questions/6532998/how-to-run-multiple-shells-on-emacs>

Basically, there are two types of methods to accomplish this:

1. Write a simple function, just as the one suggested on the above website:

(defun create-shell ()
    "creates a shell with a given name"
    (interactive);; "Prompt\n shell name:")
    (let ((shell-name (read-string "shell name: " nil)))
    (shell (concat "*" shell-name "*"))))

2. Use an Emacs plugin/package, and I've found the following one:
<https://github.com/manateelazycat/aweshell>.

What are the recommended ways to use Emacs based on this kind of technique?

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Run multiple shells in Emacs.
  2021-05-31 23:13 Run multiple shells in Emacs Hongyi Zhao
@ 2021-05-31 23:18 ` Jean Louis
  2021-05-31 23:23 ` Óscar Fuentes
  1 sibling, 0 replies; 7+ messages in thread
From: Jean Louis @ 2021-05-31 23:18 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

* Hongyi Zhao <hongyi.zhao@gmail.com> [2021-06-01 02:14]:
> What's the preferable way to open multiple shell windows at the same
> time in Emacs?

Just C-u M-x shell is enough to span a new shell.


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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Run multiple shells in Emacs.
  2021-05-31 23:13 Run multiple shells in Emacs Hongyi Zhao
  2021-05-31 23:18 ` Jean Louis
@ 2021-05-31 23:23 ` Óscar Fuentes
  2021-05-31 23:54   ` Hongyi Zhao
  1 sibling, 1 reply; 7+ messages in thread
From: Óscar Fuentes @ 2021-05-31 23:23 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> What's the preferable way to open multiple shell windows at the same
> time in Emacs?
>
> After searching with Google, I find the discussion here:
>
> <https://stackoverflow.com/questions/6532998/how-to-run-multiple-shells-on-emacs>
>
> Basically, there are two types of methods to accomplish this:
>
> 1. Write a simple function, just as the one suggested on the above website:
>
> (defun create-shell ()
>     "creates a shell with a given name"
>     (interactive);; "Prompt\n shell name:")
>     (let ((shell-name (read-string "shell name: " nil)))
>     (shell (concat "*" shell-name "*"))))
>
> 2. Use an Emacs plugin/package, and I've found the following one:
> <https://github.com/manateelazycat/aweshell>.
>
> What are the recommended ways to use Emacs based on this kind of technique?

Aweshell does a lot of things and works with Eshell, not `shell' as your
first method.

Plain `eshell' already supports multiple instances (see its docstring),
as well as `shell' (see its docstring).

So if you want to open multiple shell buffers, you don't need neither a
new function nor a new package.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Run multiple shells in Emacs.
  2021-05-31 23:23 ` Óscar Fuentes
@ 2021-05-31 23:54   ` Hongyi Zhao
  2021-06-01  3:23     ` Abhiseck Paira
  0 siblings, 1 reply; 7+ messages in thread
From: Hongyi Zhao @ 2021-05-31 23:54 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: help-gnu-emacs

On Tue, Jun 1, 2021 at 7:24 AM Óscar Fuentes <ofv@wanadoo.es> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> > What's the preferable way to open multiple shell windows at the same
> > time in Emacs?
> >
> > After searching with Google, I find the discussion here:
> >
> > <https://stackoverflow.com/questions/6532998/how-to-run-multiple-shells-on-emacs>
> >
> > Basically, there are two types of methods to accomplish this:
> >
> > 1. Write a simple function, just as the one suggested on the above website:
> >
> > (defun create-shell ()
> >     "creates a shell with a given name"
> >     (interactive);; "Prompt\n shell name:")
> >     (let ((shell-name (read-string "shell name: " nil)))
> >     (shell (concat "*" shell-name "*"))))
> >
> > 2. Use an Emacs plugin/package, and I've found the following one:
> > <https://github.com/manateelazycat/aweshell>.
> >
> > What are the recommended ways to use Emacs based on this kind of technique?
>
> Aweshell does a lot of things and works with Eshell, not `shell' as your
> first method.
>
> Plain `eshell' already supports multiple instances (see its docstring),
> as well as `shell' (see its docstring).
>
> So if you want to open multiple shell buffers, you don't need neither a
> new function nor a new package.
>

I want to use Emacs as an advanced terminal multiplexer similar to
tmux. Now, I find the method described here:
<https://iloveemacs.wordpress.com/2014/09/10/emacs-as-an-advanced-terminal-multiplexer/comment-page-1/>.
Any hints/comments/suggestions will be highly appreciated.

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Run multiple shells in Emacs.
  2021-05-31 23:54   ` Hongyi Zhao
@ 2021-06-01  3:23     ` Abhiseck Paira
  2021-06-01 11:21       ` Leo Butler
  0 siblings, 1 reply; 7+ messages in thread
From: Abhiseck Paira @ 2021-06-01  3:23 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: Óscar Fuentes, help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1971 bytes --]


> I want to use Emacs as an advanced terminal multiplexer similar to
> tmux. Now, I find the method described here:
> <https://iloveemacs.wordpress.com/2014/09/10/emacs-as-an-advanced-terminal-multiplexer/comment-page-1/>.
> Any hints/comments/suggestions will be highly appreciated.

When I first started using Emacs, I wanted to recreate tmux+terminal
workflow with Emacs. So I tried to use *shell* and found it inadequate
because I tried to run TUI (not CLI) applications and it would complain
that terminal wasn't fully operational. Also if I use *term* then I
don't get to use the Emacs keybindings.

Then I read this article[1] and it opened my eyes.
[1] https://ambrevar.xyz/emacs-eshell/index.html

I was thinking it wrong, why does terminal emulator and POSIX shell
should go together? I should be able to use POSIX shell without using a
terminal emulator.

So the first thing I did was to remove all TUI applications. So I use
Emacs packages and CLI programs. CLI programs can easily be used in
*shell* (with Bash running) without any problem. The benefits are:

1. You can have as many buffers running shell as you want.
"C-u M-x shell" will create as many shell buffers as you want.

2. You get to use Emacs keybindings and other Emacs perks everywhere in
a buffer. (See shell manual for details).

I also added this option in my init.el file:
(setq shell-command-switch "-ic")

This makes it possible to type "M-!" and "M-&" and run shell commands
from anywhere in Emacs. Also in dired mode you can type ! and & to run
shell commands with the file at point.

So this is what I have done with my workflow, sometimes I go by weeks
without needing to open a proper terminal emulator. I was even
considering uninstalling it, but thought it may come in handy in
emergency situations.

-- 
Abhisek Paira
E34E 825B 979E EB9F 8505  F80E E93D 353B 7740 0709
"There is no system but GNU, and Linux is one of its kernels."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Run multiple shells in Emacs.
  2021-06-01  3:23     ` Abhiseck Paira
@ 2021-06-01 11:21       ` Leo Butler
  2021-06-02  0:52         ` Hongyi Zhao
  0 siblings, 1 reply; 7+ messages in thread
From: Leo Butler @ 2021-06-01 11:21 UTC (permalink / raw)
  To: Abhiseck Paira; +Cc: Óscar Fuentes, help-gnu-emacs, Hongyi Zhao

Abhiseck Paira <abhiseckpaira@disroot.org> writes:

>> I want to use Emacs as an advanced terminal multiplexer similar to
>> tmux. Now, I find the method described here:
>> <https://iloveemacs.wordpress.com/2014/09/10/emacs-as-an-advanced-terminal-multiplexer/comment-page-1/>.
>> Any hints/comments/suggestions will be highly appreciated.
>
> When I first started using Emacs, I wanted to recreate tmux+terminal
> workflow with Emacs. So I tried to use *shell* and found it inadequate
> because I tried to run TUI (not CLI) applications and it would complain
> that terminal wasn't fully operational. Also if I use *term* then I
> don't get to use the Emacs keybindings.

Not quite. In *term*, one can switch `modes' between char and line entry. One lets
you interact with the terminal as if in a *shell* buffer. This is super
handy.

Leo



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Run multiple shells in Emacs.
  2021-06-01 11:21       ` Leo Butler
@ 2021-06-02  0:52         ` Hongyi Zhao
  0 siblings, 0 replies; 7+ messages in thread
From: Hongyi Zhao @ 2021-06-02  0:52 UTC (permalink / raw)
  To: Leo Butler; +Cc: Óscar Fuentes, help-gnu-emacs, Abhiseck Paira

On Tue, Jun 1, 2021 at 7:21 PM Leo Butler <leo.butler@umanitoba.ca> wrote:
>
> Abhiseck Paira <abhiseckpaira@disroot.org> writes:
>
> >> I want to use Emacs as an advanced terminal multiplexer similar to
> >> tmux. Now, I find the method described here:
> >> <https://iloveemacs.wordpress.com/2014/09/10/emacs-as-an-advanced-terminal-multiplexer/comment-page-1/>.
> >> Any hints/comments/suggestions will be highly appreciated.
> >
> > When I first started using Emacs, I wanted to recreate tmux+terminal
> > workflow with Emacs. So I tried to use *shell* and found it inadequate
> > because I tried to run TUI (not CLI) applications and it would complain
> > that terminal wasn't fully operational. Also if I use *term* then I
> > don't get to use the Emacs keybindings.
>
> Not quite. In *term*, one can switch `modes' between char and line entry. One lets
> you interact with the terminal as if in a *shell* buffer. This is super
> handy.

This is exactly one of the wonderful features I pursue.

HY
>
> Leo

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-02  0:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-31 23:13 Run multiple shells in Emacs Hongyi Zhao
2021-05-31 23:18 ` Jean Louis
2021-05-31 23:23 ` Óscar Fuentes
2021-05-31 23:54   ` Hongyi Zhao
2021-06-01  3:23     ` Abhiseck Paira
2021-06-01 11:21       ` Leo Butler
2021-06-02  0:52         ` Hongyi Zhao

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.