1 # Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007
2 # Free Software Foundation, Inc.
4 # This defines a csh command named `edit' which resumes an
5 # existing Emacs or starts a new one if none exists.
6 # One way or another, any arguments are passed to Emacs to specify files
7 # (provided you have loaded `resume.el').
10 # These are the possible values of $whichjob
11 # 1 = new ordinary emacs (the -nw is so that it doesn't try to do X)
13 # 3 = new emacs under X (-i is so that you get a reasonable icon)
14 # 4 = resume emacs under X
15 # 5 = new emacs under suntools
16 # 6 = resume emacs under suntools
17 # 7 = new emacs under X and suntools - doesn't make any sense, so use X
18 # 8 = resume emacs under X and suntools - doesn't make any sense, so use X
19 set EMACS_PATTERN="^\[[0-9]\] . Stopped ............ $EMACS"
21 alias edit 'set emacs_command=("emacs -nw \!*" "fg %emacs" "emacs -i \!* &"\
22 "emacsclient \!* &" "emacstool \!* &" "emacsclient \!* &" "emacs -i \!* &"\
23 "emacsclient \!* &") ; \
24 jobs >! $HOME/.jobs; grep "$EMACS_PATTERN" < $HOME/.jobs >& /dev/null; \
25 @ isjob = ! $status; \
26 @ whichjob = 1 + $isjob + $?DISPLAY * 2 + $?WINDOW_PARENT * 4; \
27 test -S ~/.emacs_server && emacsclient \!* \
28 || echo `pwd` \!* >! ~/.emacs_args && eval $emacs_command[$whichjob]'
32 # Permission is hereby granted, free of charge, to any person obtaining
33 # a copy of this file, to deal in the file without restriction, including
34 # without limitation the rights to use, copy, modify, merge, publish,
35 # distribute, sublicense, and/or sell copies of the file, and to
36 # permit persons to whom the file is furnished to do so, subject to
37 # the following condition:
39 # The above copyright notice and this permission notice shall be
40 # included in all copies or substantial portions of the file.
43 # arch-tag: 433d58df-15b9-446f-ad37-f0393e3a23d4