Path: utzoo!mnetor!uunet!littlei!ogcvax!schaefer From: schaefer@ogcvax.UUCP (Barton E. Schaefer) Newsgroups: comp.unix.wizards Subject: Re: Summary of Emacs csh alias replies Message-ID: <1512@ogcvax.UUCP> Date: 10 Dec 87 18:07:53 GMT References:Reply-To: schaefer@ogcvax.UUCP (Barton E. Schaefer) Organization: Oregon Graduate Center, Beaverton, OR Lines: 31 In article dsill@NSWC-OAS.arpa (Dave Sill) writes: }My question was: how can one set up a csh alias for emacs that will }run emacs if there isn't one in the background or foreground it if it }is in the background. } }Most "solutions" involved grepping the output of jobs to determine if }there was a background emacs job, followed by an if-then-else to }either run or foreground emacs. I've never been able to get an }if-then-else to work in an alias. Some suggested putting the if-then- }else in a file to be sourced by the alias. This works, but requires }reading the file each time the alias is invoked, so I might as well }use a script. "Might as well use a script" ?!?!? For something as short as the 6 or 7 lines in the file in question, the major part of the overhead is NOT in reading the file, but in fork-execing a new shell which then has to read the file anyway. Sourcing the file from the current shell will be MUCH faster than running a script. Furthermore, what do you think is going to happen when you issue a "%emacs" in the script? There isn't any background job running under the script shell! This is one case where you MUST use "source", or type the commands in yourself (which you don't want to do or you wouldn't have asked the question in the first place). -- Bart Schaefer CSNET: schaefer@cse.ogc.edu UUCP: ...{tektronix,verdix}!ogcvax!schaefer "A band of BIG, DUMB, LOUDMOUTHED, BUNGLING OGRES is a GREAT ASSET to the neighbohood. It keeps out the RIFF-RAFF." -- Wormy