0
+ − 1 # This defines a csh command named `edit' which resumes an
+ − 2 # existing Emacs or starts a new one if none exists.
+ − 3 # One way or another, any arguments are passed to Emacs to specify files
+ − 4 # (provided you have loaded `resume.el').
+ − 5 # - Michael DeCorte
+ − 6
+ − 7 # These are the possible values of $whichjob
+ − 8 # 1 = new ordinary emacs (the -nw is so that it doesn't try to do X)
+ − 9 # 2 = resume emacs
+ − 10 # 3 = new emacs under X (-i is so that you get a reasonable icon)
+ − 11 # 4 = resume emacs under X
+ − 12 # 5 = new emacs under suntools
+ − 13 # 6 = resume emacs under suntools
+ − 14 # 7 = new emacs under X and suntools - doesn't make any sense, so use X
+ − 15 # 8 = resume emacs under X and suntools - doesn't make any sense, so use X
+ − 16 set EMACS_PATTERN="^\[[0-9]\] . Stopped ............ $EMACS"
+ − 17
+ − 18 alias edit 'set emacs_command=("emacs -nw \!*" "fg %emacs" "emacs -i \!* &"\
+ − 19 "emacsclient \!* &" "emacstool \!* &" "emacsclient \!* &" "emacs -i \!* &"\
+ − 20 "emacsclient \!* &") ; \
+ − 21 jobs >! $HOME/.jobs; grep "$EMACS_PATTERN" < $HOME/.jobs >& /dev/null; \
+ − 22 @ isjob = ! $status; \
+ − 23 @ whichjob = 1 + $isjob + $?DISPLAY * 2 + $?WINDOW_PARENT * 4; \
+ − 24 test -S ~/.emacs_server && emacsclient \!* \
+ − 25 || echo `pwd` \!* >! ~/.emacs_args && eval $emacs_command[$whichjob]'