#!/bin/bash # Provide a shared terminal window to a running emacs session. # All scripts can be found at: # # http://zwizwa.be/darcs/bin/session # # # This uses: # # - session # # A wrapper script around dtach. Can be found at # http://zwizwa.be/darcs/bin/session # # - s.emacs # # Outer wrapper. This is what you use to attach to a session. # # - s.emacs.start # # This script. Start emacsclient in detach. The reason we're using # dtach as an intermediate is that we don't just want a shared emacs # session (just emacsclient would be enough) but also want identical # screens. # # - s.emacs.resize # # Use xtermcontrol to resize the PTY in which emacsclient runs. # This PTY is provided by dtach -- it's not your private PTY. Check # that xterm has resize access enabled. If not, add the following # lines to ~/.Xdefaults # # xterm*allowWindowOps: true # xterm*allowTitleOps: true # xterm*allowFontOps: true # # and refresh using: xrdb ~/.Xdefaults # #################################################################### # Need xterm because of xtermcontrol and the emacs colorscheme. NEED_TERM=xterm-256color echo TERM=$TERM [ "$TERM" == xterm ] && TERM=$NEED_TERM [ ! "$TERM" == $NEED_TERM ] && echo "Please use xterm." && exit 1 # Resize our terminal before attaching to the shared terminal. xtermcontrol --geometry `s.emacs.geometry` exec session s.emacs $0.start