0

After running eshell, I was trying to establish a SSH connection and do some changes on the server:

ssh [email protected]

The connection was successfully established (the real IP address was modified). However, for some reason, vi does not work. After executing it, the eshell interface becomes messy:

enter image description here

On the other hand, if I use my regular terminal outside of Emacs, everything works fine. Also, using term instead of eshell inside of Emacs, things seem to work fine (with some lag).

Finally, I must admit that my initial goal was to keep everything inside Emacs. This means doing the SSH connection via eshell and editions on the server using Emacs (with my init file).

I was planning to add my config file to the server, after installing Emacs. But it did not work out, because I can't even run Emacs. I receive an error message on the server being dumb:

root@ubuntu-s-1vcpu-512mb-10gb-nyc1-01:~# emacs text.txt

emacs: Terminal type "dumb" is not powerful enough to run Emacs.
It lacks the ability to position the cursor.
If that is not the actual type of terminal you have,
use the Bourne shell command 'TERM=...; export TERM' (C-shell:
'setenv TERM ...') to specify the correct type.  It may be necessary
to do 'unset TERMINFO' (C-shell: 'unsetenv TERMINFO') as well.

I might be missing something on how to interact with a server via SSH while using Emacs.

How would you handle this situation? Should I go for tramp (I need to learn it)? Is there other alternatives beyond tramp?

2 Answers 2

3

Eshell is a shell, not a terminal emulator. Use M-x shell or M-x term if you want to run programs that need terminal emulation.

I definitely recommend using TRAMP to edit remote files rather than running a nested Emacs session inside of an Emacs buffer.

1
  • 2
    And eshell also supports Tramp. Try the following command in your eshell buffer: cd /ssh:[email protected]: Commented Jul 17, 2022 at 14:01
1

No dumb terminal is capable of handling Emacs, nor any other program which requires a more capable terminal.

For the local system you can add emacs to eshell-visual-commands and then run emacs -nw from eshell -- but that just makes eshell run it in a term buffer ala M-x term; and frankly, nested Emacs instances may prove problematic due to the term char mode escape key -- which eshell sets to C-x rather than the default C-c, so exiting a single inner Emacs would be C-x C-x C-x C-c for instance; for a doubly-nested Emacs it would be C-x C-x C-x C-x C-x C-x C-x C-c; etc...

SSH is not much of a factor in this, except that once you're interacting with a remote shell rather than eshell directly, the "run it in a term buffer instead" eshell behaviour isn't going to be available either.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.