title: emacs as a screen/tmux alternative - detach from terminal
body: <p>It's well known that emacs can be used as a terminal emulator (while itself is running in a terminal emulator), thus making it a valid alternative to more traditional terminal-in-a-terminal approaches, such as <code>tmux</code> or <code>screen</code>. However, there's one thing that could be done easily with the latter and I've found no alternative in emacs' <code>term</code> for this one so far.</p>
  
  <p>Both <code>tmux</code> and <code>screen</code> can <em>detach from a terminal</em> and all tasks ran in their windows continue to run in background. It's done using <em>C-b, d</em> in <code>tmux</code> and <em>C-a, d</em> in <code>screen</code> by default. Later, I can return (reattach) to the terminal I've detached from by running something like <code>tmux attach</code> or <code>screen -r</code>. Also, sessions run in both of these terminal multiplexers are persistent - i.e. if I'm connected to some remote terminal and connection fails, I can reconnect and reattach to the terminal without losing any of my work - it really helps in case of faulty network link that occasionally breaks ssh connections.</p>
  
  <p>Is there something like that available for emacs? Basically, I'd want to be able to:</p>
  
  <ul>
  <li>Detach from emacs and leave it running in background with all the sub-processes ran in <code>term</code> buffers intact.</li>
  <li>Reattach to it later and find all my processes running.</li>
  <li>Automatic detachment of emacs from terminal on receiving a SIGHUP.</li>
  </ul>