random tidy-up changes made while re-fixing the 1.8->1.9 problem
#! /bin/sh
# $Id: emacsclient_wrapper,v 1.10 2006/07/31 17:52:50 mca1001 Exp $
## this is a nasty bodge for cvspublish's benefit
# <meta name="description" content="Many ways to run emacs or emacsclient depending on the environment">
# a silly solution:
# ps aux | grep $LOGNAME | grep -E ' emacs\b'
SCK="/tmp/esrv${UID}-"`hostname`
echo Checking for $SCK
# If we're not using X, we don't want the socket unless it isn't using X either (assume local console)
# Emacs now configured to only start server when window-system true
if [ -S $SCK ]; then
# Can find out which X server it lives on... under Linux, anyway
# -> fuser (psmisc) 21.5 : stderr="filename: ", stdout=" pid"
# -> other/earlier? version : stdout = "filename: pid" (?)
ESRVPID=`fuser $SCK 2>&1 | sed -r 's/^.*?: *//'`
# fuser will cheerfully list two processes if there are two servers running!
# then we get the name of the first (by PID order), when we really want either
# the last or better, the most recent one to listen(?)
# or grab part of "netstat -lxp"
ESRVDISPLAY="unknown [pid=$ESRVPID]"
if [ -f /proc/$ESRVPID/environ ]; then
ESRVDISPLAY=`cat /proc/$ESRVPID/environ | tr '\0' '\n' | grep '^DISPLAY=' | cut -c9-`
fi
# By this point, it is surely easier to write some Perl?!
if [ "x$DISPLAY x$ESRVDISPLAY" == "x x" ] || [ $ESRVDISPLAY == $DISPLAY ]; then
echo Socket on display \'$ESRVDISPLAY\' at $SCK
exec emacsclient $*
fi
echo Socket on display \'$ESRVDISPLAY\' at $SCK is not our friend today
fi
echo Start emacs?
if [ $TERM = "linux" ] || [ "x$DISPLAY" = "x" ]; then
exec emacs -nw $*
else
if [ $TERM = "xterm-debian" ] || [ $TERM = "xterm" ]; then
echo Starting emacs, waiting 8 sec
emacs &
sleep 8
exec emacsclient $*
else
echo Duh, now what\? \[ TERM = $TERM \]
fi
fi
|
Repository owner Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |