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