Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for tmux Terminal Emulation Protocol #1

Open
ricardog opened this issue Jan 23, 2013 · 2 comments
Open

Add support for tmux Terminal Emulation Protocol #1

ricardog opened this issue Jan 23, 2013 · 2 comments

Comments

@ricardog
Copy link

This is not an issue per se, rather a rather abstract idea and I didn't find any other way to bring it up.

George Nachman (creator of iTerm2) and Nicholas Marriot (creator of tmux) created something called the Terminal Emulation Protocol. This allows a terminal emulation program (like iTerm2) to natively support tmux sessions. See for reference

http://code.google.com/p/iterm2/wiki/TmuxIntegration

The description of the protocol is at

https://docs.google.com/document/d/1ABI0kqUUxoAjxhWW3AsWFis6bgvMoEbcTcA2N21ncmU/edit?hl=en&authkey=COHZn78P

I quickly glanced at the doc and at the elisp code and it seems feasible to support it natively in emacs using emux as a starting point. The big advantage of using tmux is that it allows remote sessions to persist, even when the connection is broken. I normally login to a server and run tmux there, using iTerm as a terminal. It would be great if I could use emacs as a terminal.

I think currently only iTerm implements the protocol so there aren't a bunch of sample clients.

Is this something you would be interested in working on? I can definitely help--although it's been 10 years since I wrote any elisp.

@re5et
Copy link
Owner

re5et commented Jan 23, 2013

I have never seen a need for this. You can just run an emacs server and attach and detach frames with it. Am I missing something?

For posterity just in case someone comes across this, might be useful:

# create a server if none exists
$ emacs --daemon

# create a frame, will attach to running server 
$ emacsclient -c

# do whatever you want

# close the frame
M-x delete-frame
# or
C-x 5 0

Once the frame is gone, you can do whatever you want until you need it again. You can disconnect your ssh session, and connect later and emacsclient -c to get back at the server session.

You can also use X11 forwarding to launch a local frame attached to the remote, which is what I usually do.

@ricardog
Copy link
Author

Let's say you have a laptop (local) and a server (remote). Sometimes the link between the two is fast and low latency and sometimes it's slow and high latency. Sounds like what you do is run emacs on the remote and display locally. That's pretty limiting, what do you do when you are disconnected? No emacs? Plus when the link is slow remote X sucks.

I run emacs on the laptop. Using tramp, ssh, emacsclient I can get along pretty well. But I lose my session when I disconnect from the remote---all shells die and subprocesses die. It has the advantage emacs is always available (which I use for reading mail, news, irc, etc.) The advantage of tmux (or screen) is that the session continues when you lose connection.

Using emacs as the terminal client with a tmux-like protocol gets me the best of both worlds. I can use tmux to have one (or more) sessions on the remote server that I can then interact with using emacs. Furthermore, I could interact with the same session from my ipad (or any other tablet that has a good ssh client) because you can still run tmux against that session on any terminal.

I can approximate this by using term to connect to the remote and then running tmux inside. That only gives me one frame though. It would be great if emacs was aware of the multiple frames (or windows in tmux/screen terminology).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants