Mac – Running emacs inside screen

emacsgnu-screen

  1. I have a screenrc file but I am finding some conflicts when I run emacs inside screen. For e.g, moving across buffers in emacs, Ctrl-right arrow/left arrow, instead of moving back and forth sends some characters into the buffers such as 5C, 5D etc. This problem exists even when I invoke screen without any screenrc file. But at least the other conflicts were not there. But I would be very grateful if someone could tell me how to fix this ?

  2. Since I have my own bindings in my screenrc file and I want to continue using it, so I was thinking that I will keep my screenrc file but when I want to start emacs in a new screen, I will not use my screenrc. Is there any way to while invoking screen to not to use screenrc ? Till now I have been managing by renaming my screenrc file to something else when starting emacs.

  3. Is there any way in which emacs itself can work as screen, as in I am using screen so that my emacs session does not terminate whenever the remote ssh session goes down. I found some documentation regarding emacs client and emacs server but could not understand much. I would appreciate if someone could tell how to save sessions inside emacs and restore them so that I dont need to use screen for emacs if its possible, as in one should be able to restore the emacs process again.

Best Answer

I only have input on your question #3.

As of emacs 23, emacs has a daemon mode which for me has obviated the need to run emacs inside screen. On my first login after a boot, I start emacs --daemon in a terminal. This starts emacs in the background. Then, whenever I need to use emacs, I either run emacsclient -nc to get an X window to my emacs session, or emacsclient -t to get a terminal session.

Multiple clients can coexist happily. I routinely run an X client on my workstation screen at work, an X client through ssh login from home, and a terminal client on my phone. All talking to the same emacs process, with all my buffers and other state intact. And should my ssh connection on my phone die, I can just continue where I left off after logging in again.

I don't know enough about keybindings in screen to help you with your first two questions.

Related Question