3

GNU Screen and Tmux can make processes survive user's logging out, and resume when logging back again.

Can Emacs be used for the same purpose, and how?

  • Depending on what you mean by "logging out", you may be able to use only Emacs. e.g. I keep an Emacs server running on the remote environments I connect to via ssh, and although I am "logging in" and "logging out" of those terminal sessions, my emacs server keeps running the whole time. I run shells and other processes inside Emacs, so I do more or less use it as an alternative to Screen, etc. – phils Feb 9 '17 at 20:45
  • So basically, you should start an emacs daemon, then "log out" and "log in" again, and see if you can still connect to it. If so, you can indeed do what you're wanting to do. – phils Feb 9 '17 at 20:46
1

You can run emacs in server mode, and then connect and disconnect clients.

Each client you start (either graphic or on a terminal) will produce a new frame, normally opening a new file or buffer.

So it is similar to screen or tmux in the sense that you have the emacs process persistent across client connections. But you won't get the exact screen rendering each time.

I personally use screen, and launch emacs clients as needed.

  • 1
    Note that the emacs process will persist across client connections, but not across login sessions like screen does (I think). It would be great if it could - maybe by running emacs --daemon from the screen session? – Tyler Apr 12 '16 at 17:14
  • Emacs master has a --new-daemon option that avoids daemonization of the process, that way something like screen/tmux or your init system can easily monitor it. – wasamasa Feb 9 '17 at 8:32
1

@Tim, I think you've answered your own question.

Running an emacsclient / daemon from within an existing tmux session

$ tmux attach
$ emacsclient -c -a ""

will reconnect you to the existing Emacs deamon, on an attached (possibly remote) tmux session.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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