all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why do we need a number of different terminal modes in Emacs?
@ 2015-02-01  7:09 Andrey Lisin
  2015-02-01 13:37 ` Robert Thorpe
  2015-02-01 15:00 ` Marcin Borkowski
  0 siblings, 2 replies; 9+ messages in thread
From: Andrey Lisin @ 2015-02-01  7:09 UTC (permalink / raw)
  To: help-gnu-emacs

Hi everyone,

could anyone explain me why do we need several of terminal
implementations inside Emacs? Shell, eshell, term, ansi-term... And as
far as I noticed they all suck one way or another. For example, shell
cannot complete commands when you ssh to remote server inside it. Eshell
tragically cannot do a very simple thing - source a bash script. Really,
try to run `. some_script.sh' or `source some_script.sh' inside eshell.

So, am I right and we need them all just because one solves restrictions
of the others and others do the same thing for the one? Why then not
just to write some standard terminal implementation, that will just
works? Does it have something with cross-platform nature of Emacs? Or,
maybe I'm doing something wrong and all this stuff makes sense? Thank
you.




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

* Re: Why do we need a number of different terminal modes in Emacs?
       [not found] <mailman.19088.1422774606.1147.help-gnu-emacs@gnu.org>
@ 2015-02-01 10:37 ` Pascal J. Bourguignon
  2015-02-01 11:10   ` Andrey Lisin
  0 siblings, 1 reply; 9+ messages in thread
From: Pascal J. Bourguignon @ 2015-02-01 10:37 UTC (permalink / raw)
  To: help-gnu-emacs

Andrey Lisin <andrey.lisin@gmail.com> writes:

> Hi everyone,
>
> could anyone explain me why do we need several of terminal
> implementations inside Emacs? Shell, eshell, term, ansi-term... And as
> far as I noticed they all suck one way or another. For example, shell
> cannot complete commands when you ssh to remote server inside it. Eshell
> tragically cannot do a very simple thing - source a bash script. Really,
> try to run `. some_script.sh' or `source some_script.sh' inside eshell.
>
> So, am I right and we need them all just because one solves restrictions
> of the others and others do the same thing for the one? Why then not
> just to write some standard terminal implementation, that will just
> works? Does it have something with cross-platform nature of Emacs? Or,
> maybe I'm doing something wrong and all this stuff makes sense? Thank
> you.

http://xkcd.com/927/

But if you feel like you'll be able to write one terminal to rule them
all, one terminal to find them, one terminal to bring them all and in
the darkness bind them, then go ahead!


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: Why do we need a number of different terminal modes in Emacs?
  2015-02-01 10:37 ` Why do we need a number of different terminal modes in Emacs? Pascal J. Bourguignon
@ 2015-02-01 11:10   ` Andrey Lisin
  2015-02-01 11:24     ` Andrey Lisin
       [not found]     ` <mailman.19095.1422789865.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Andrey Lisin @ 2015-02-01 11:10 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: help-gnu-emacs

It's perfectly fine to have different things for different tasks. The
question is what is the *real* reason to have a few different terminal
modes? And it has nothing to do with standards. Right now, for example,
I use shell for tasks on my local machine, but I need to run term each
time I want SSH somewhere.

And if you want me to write "one terminal to rule them all", I'd rather
fix this strange shell or eshell behavior. But it's very strange nobody
did it before. I think there could be some good reasons for that. Am I
the only person find it weird?

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:


> http://xkcd.com/927/
>
> But if you feel like you'll be able to write one terminal to rule them
> all, one terminal to find them, one terminal to bring them all and in
> the darkness bind them, then go ahead!



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

* Re: Why do we need a number of different terminal modes in Emacs?
  2015-02-01 11:10   ` Andrey Lisin
@ 2015-02-01 11:24     ` Andrey Lisin
       [not found]     ` <mailman.19095.1422789865.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Andrey Lisin @ 2015-02-01 11:24 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: help-gnu-emacs

BTW, I just found a good explanation here:
http://unix.stackexchange.com/questions/104325/what-is-the-difference-between-shell-eshell-and-term-in-emacs



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

* Re: Why do we need a number of different terminal modes in Emacs?
  2015-02-01  7:09 Andrey Lisin
@ 2015-02-01 13:37 ` Robert Thorpe
  2015-02-01 14:10   ` Andrey Lisin
  2015-02-01 15:00 ` Marcin Borkowski
  1 sibling, 1 reply; 9+ messages in thread
From: Robert Thorpe @ 2015-02-01 13:37 UTC (permalink / raw)
  To: Andrey Lisin; +Cc: help-gnu-emacs

Andrey Lisin <andrey.lisin@gmail.com> writes:

> Hi everyone,
>
> could anyone explain me why do we need several of terminal
> implementations inside Emacs? Shell, eshell, term, ansi-term... And as
> far as I noticed they all suck one way or another. For example, shell
> cannot complete commands when you ssh to remote server inside it. Eshell
> tragically cannot do a very simple thing - source a bash script. Really,
> try to run `. some_script.sh' or `source some_script.sh' inside eshell.
>
> So, am I right and we need them all just because one solves restrictions
> of the others and others do the same thing for the one? Why then not
> just to write some standard terminal implementation, that will just
> works? Does it have something with cross-platform nature of Emacs? Or,
> maybe I'm doing something wrong and all this stuff makes sense? Thank
> you.

I'll explain the trickiness.  Shell-mode works in an Emacs-like manner.
It hooks to an external shell, such as bash, ksh or tcsh.  It transfers
*lines* to the shell.  It has to work this way, since the line is edited by
Emacs editing commands.  Emacs editing commands work exactly as they do
elsewhere in Emacs.  For example, if you do C-a in tcsh or sh it will
bring you to the beginning of the line, that's not a feature of those
shells.  You can define keymaps for any key you like.

The shell-mode system can only work for programs with line-orientated
input.  A program that responds to keys one at a time can't be handled
this way.  Shell modes doesn't even try to do this, or to deal with
programs that have text-based GUIs, like "top" or curses programs.  Type
"top" in shell and see what happens.  Notice you have to type "q RET" to
exit, not just "q".

So, we have the terminal modes: ansi-term and term.  These emulate
*terminals* imperfectly, and a shell runs under that terminal.  These
have two modes, line mode and character mode.  In line-mode they behave
like shell mode as I described above.  In character mode they relay
characters one-at-a-time to the inferior program.  You switch between
the two modes with C-c C-j and C-c C-k.  Emacs only catches a few keys,
C-x, C-c, C-num and a few other without passing them through (see C-h m
in term-mode).  You can run programs with text-based GUIs like "top" and
"emacs -nw" in terms.

For example.  Go into term mode using bash.  Type some stuff in and
press M-b & M-f to move across words.  This works in either character
mode (C-c C-k) or line mode (C-c C-k).  It works in line mode because
those are Emacs keybindings and it works in character mode because
they're bash keybindings.  Now, run another shell like dash.  Try M-b &
M-f there.  They will work in line mode but fail in character mode.

There is little difference between term and ansi-term.  In the past only
ansi-term had colours, now both do.  The prefix key is C-c in term and
C-x in ansi-term.

Eshell is a completely different thing.  It's a shell written in Emacs
Lisp.  The idea of it is that you can write lisp at the command prompt
as well as calling shell programs.  For example you can write (+ 2 3) at
the eshell prompt and it will return 5.  Eshell can't source bash scripts
because bash is nowhere in sight here.  Like shell-mode it doesn't
emulate a terminal or have a character mode, so you can't use it with
the programs that need that.

For your use I think term in line-mode would be best, switching to
character mode when necessary.

BR,
Robert Thorpe



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

* Re: Why do we need a number of different terminal modes in Emacs?
  2015-02-01 13:37 ` Robert Thorpe
@ 2015-02-01 14:10   ` Andrey Lisin
  0 siblings, 0 replies; 9+ messages in thread
From: Andrey Lisin @ 2015-02-01 14:10 UTC (permalink / raw)
  To: Robert Thorpe; +Cc: help-gnu-emacs

Hi Robert,

I am very grateful to you for the detailed answer. I can say now I
understand this mess with terminals in Emacs! Thanks again!



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

* Re: Why do we need a number of different terminal modes in Emacs?
  2015-02-01  7:09 Andrey Lisin
  2015-02-01 13:37 ` Robert Thorpe
@ 2015-02-01 15:00 ` Marcin Borkowski
  1 sibling, 0 replies; 9+ messages in thread
From: Marcin Borkowski @ 2015-02-01 15:00 UTC (permalink / raw)
  To: help-gnu-emacs


On 2015-02-01, at 08:09, Andrey Lisin <andrey.lisin@gmail.com> wrote:

> [...] Eshell
> tragically cannot do a very simple thing - source a bash script. Really,
> try to run `. some_script.sh' or `source some_script.sh' inside eshell.

You know, it's even worse than that: can you imagine that you can't
extend Emacs in Java?  Try

(defun myCoolAbstractPublicStaticVoidGenericVirtualUnicodeCharacterFactory ()
  ...)

and put some Java code in place of "...".  It won't work!  How tragic!

(SCNR - please, don't get offended;-).  In fact, your question is imho
not an unreasonable one.  And I haven't yet read any answers of
others...)

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: Why do we need a number of different terminal modes in Emacs?
       [not found]     ` <mailman.19095.1422789865.1147.help-gnu-emacs@gnu.org>
@ 2015-02-01 15:09       ` Dan Espen
  2015-02-01 22:16         ` Robert Thorpe
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Espen @ 2015-02-01 15:09 UTC (permalink / raw)
  To: help-gnu-emacs

Andrey Lisin <andrey.lisin@gmail.com> writes:

> BTW, I just found a good explanation here:
> http://unix.stackexchange.com/questions/104325/what-is-the-difference-between-shell-eshell-and-term-in-emacs

Yes, pretty clear.

Your question left out M-!.

There are other ways to accomplish what a shell does more tightly bound
to Emacs, like:

ls -> dired
make -> M-x compile
grep -> M-x grep

these commands offer advantages over a shell buffer.
Years ago I used to use M-x shell, but I no longer find use for any of
these  shell interfaces.

-- 
Dan Espen


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

* Re: Why do we need a number of different terminal modes in Emacs?
  2015-02-01 15:09       ` Dan Espen
@ 2015-02-01 22:16         ` Robert Thorpe
  0 siblings, 0 replies; 9+ messages in thread
From: Robert Thorpe @ 2015-02-01 22:16 UTC (permalink / raw)
  To: Dan Espen; +Cc: help-gnu-emacs

Dan Espen <despen@verizon.net> writes:
...
> ls -> dired
> make -> M-x compile
> grep -> M-x grep
>
> these commands offer advantages over a shell buffer.
> Years ago I used to use M-x shell, but I no longer find use for any of
> these  shell interfaces.

Yes.  I only use Emac's shell modes for programs that can't be dealt
with by a specific mode.  For 90% of cases I get away without using them
at all, when I need them I use M-x term.

BR,
Robert Thorpe



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

end of thread, other threads:[~2015-02-01 22:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.19088.1422774606.1147.help-gnu-emacs@gnu.org>
2015-02-01 10:37 ` Why do we need a number of different terminal modes in Emacs? Pascal J. Bourguignon
2015-02-01 11:10   ` Andrey Lisin
2015-02-01 11:24     ` Andrey Lisin
     [not found]     ` <mailman.19095.1422789865.1147.help-gnu-emacs@gnu.org>
2015-02-01 15:09       ` Dan Espen
2015-02-01 22:16         ` Robert Thorpe
2015-02-01  7:09 Andrey Lisin
2015-02-01 13:37 ` Robert Thorpe
2015-02-01 14:10   ` Andrey Lisin
2015-02-01 15:00 ` Marcin Borkowski

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.