Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!rutgers!nysernic!itsgw!leah!uwmcsd1!ig!jade!ucbcad!zen!stinson!grady
From: grady@stinson.uucp (Steven Grady)
Newsgroups: comp.emacs
Subject: Re: Emacs csh alias
Message-ID: <5239@zen.berkeley.edu>
Date: Sun, 6-Dec-87 23:28:49 EST
Article-I.D.: zen.5239
Posted: Sun Dec  6 23:28:49 1987
Date-Received: Sat, 12-Dec-87 06:08:42 EST
References: <8712041951.AA21105@ucbvax.Berkeley.EDU>
Sender: news@zen.berkeley.edu
Reply-To: grady@postgres.berkeley.edu (Steven Grady)
Organization: Postgres Research Group, UC Berkeley
Lines: 31

In article <8712041951.AA21105@ucbvax.Berkeley.EDU> dsill@NSWC-OAS.ARPA (Dave Sill) writes:
>I've been trying to set up a C-Shell (4.2 BSD) alias for Emacs (GNU
>17.64, not that it matters) which, when run the first time will
>actually run Emacs, but after suspending Emacs with C-z, will bring
>the background Emacs job to the foreground.  The catch is that I'd
>also like the alias to re-load emacs if I exit with C-x C-c.  Simply
>stated, I want an alias named "emacs" which will load Emacs if it
>isn't already loaded, but will foreground a background Emacs if one
>exists.

A friend (I helped a little) wrote this:

alias e 'eval "if (-e ~/.emacs.$$) then\\
%?emacs.${$}\\
else\\
(emacs.${$}:>~/.emacs.$$ ; emacs \!*; /bin/rm -f ~/.emacs.$$)\\
endif" >& /dev/null'

     The only process it  forks (other than emacs)  is the rm  to
remove the file.  We also  created a similar alias if you  wanted
to have one of these jobs per directory (ie if you were using vi,
it might be useful).  I haven't really used the alias above -  we
just got something  that seems  to work -  so I  don't know  what
problems there might be.   One marginally annoying thing: if  you
suspend, then restart the emacs, when you finally quit emacs,  it
prints 2  question  marks.    These  are  from  the  if-then-else
statement.  They mean nothing.

	Steven
	grady@postgres.berkeley.edu
	...!ucbvax!grady