Emacs & Screen: backspaces, servers, and escape characters

Posted by dgtized Mon, 25 Feb 2008 00:00:00 GMT

I frequently have trouble using Emacs under screen because sometimes erase and backspace get switched, resulting in emacs believing every backspace is a Control-h for help. For some reason I always forget the command to fix this. For now and future reference, the fix is: M-x normal-erase-is-backspace-mode.

I highly recommend upgrading to Emacs CVS-HEAD as it now includes multi-tty emacs. Multi-tty allows console or graphical frames to attach to an existing emacs server on the system, regardless of the graphics mode. What this means is that I can start a server using (server-start) in an emacs session under my screen session. I can then connect to this instance of emacs using emacsclient from both another console, or from a graphical frame. Since all of the buffers are shared between instances I no longer need to worry if I remembered to save changes to a buffer of another instance running on the same computer.

It does have a few bugs that remain to be fixed. If I forget and invoke screen -DAr from another console that forceably disconnects both the screen on the other terminal, as well as the other terminal. If that terminal is also hosting the graphical emacsclient it seems to kill both the emacs client and the hosting emacs server. I’m sure this issue will be corrected prior to the next official release.

Given that RMS has just stepped down as the maintainer for GNU Emacs1, perhaps a new release is forthcoming sooner rather then the more usual later. Moving away from CVS to a more distributed SCM may also assist in this venture.

I have returned to using Ctrl-z as the prefix code for screen commands. Despite it’s obvious shortcomings by overriding normal process suspension, it does not impair XON/XOFF terminal status in the way Ctrl-q did. As a side effect this would also break creation of new screen-shells in screen, as they would not forward key events back to the main screen session. This prevents screen switching until the newly created screen-shell is terminated. The Ctrl-a code despite being the default screen prefix is not suitable as it overrides emacs/bash keybindings for beginning of line. Finally, Ctrl-z still allows for process suspend using Ctrl-z z. Ctrl-z is a bit cramped, but as a bonus it does make it easier to eat or drink and monitor several screen-shells at the same time.

1 RMS relinquishes status as GNU Emacs maintainer


/">Valid CSS