From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 599 invoked from network); 15 Sep 1997 11:27:42 -0000 Received: from dns.primenet.com.au (HELO ns2.primenet.com.au) (7795@203.24.36.40) by coral.primenet.com.au with SMTP; 15 Sep 1997 11:27:42 -0000 Received: (qmail 1123 invoked from network); 15 Sep 1997 11:27:40 -0000 Received: from math.gatech.edu (list@130.207.146.50) by dns.primenet.com.au with SMTP; 15 Sep 1997 11:27:40 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id HAA17075; Mon, 15 Sep 1997 07:16:24 -0400 (EDT) Resent-Date: Mon, 15 Sep 1997 07:16:24 -0400 (EDT) To: zsh-workers@math.gatech.edu Sender: monnier@TEQUILA.SYSTEMSZ.CS.YALE.EDU From: Stefan Monnier Newsgroups: lists.zsh.workers Subject: Re: multiple background jobs of the same program References: <9709140326.AA21133@cryptica.UCSD.EDU> <19970914102839.45957@sco.com> <970914121042.ZM22784@candle.brasslantern.com> <19970914150505.11879@sco.com> <970914160910.ZM23900@candle.brasslantern.com> <19970914200202.04363@sco.com> Date: 15 Sep 1997 07:16:41 -0400 Message-ID: <5len6q9692.fsf@tequila.systemsz.cs.yale.edu> X-Newsreader: Gnus v5.5/Emacs 20.0 Path: tequila.systemsz.cs.yale.edu NNTP-Posting-Host: tequila.systemsz.cs.yale.edu Resent-Message-ID: <"4UtlC3.0.kA4.7aH7q"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3489 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu "Adam R. Paul" writes: > Thanks much again! That's _almost_ perfect :) The only remaining thing is > that if a job is suspended due to tty output/input, the sed script doesn't > quite do the right thing (the completion looks like: > > fg %1 ;: tty output) vi foo > > which then gives a parse error if you hit due to the unmatched ')'. > Oh well, no biggie:) Good point, here is a version that should correctly ignore the "(tty input)" thingie if present: complete_listjobs() { tmpfile=$TMP/zshjobcomp.$$ jobs >| $tmpfile 2>&1 if [[ -s $tmpfile ]] then reply=( "${(@f)$(sed -e '{ s/suspended (tty [a-z]*put)/suspended/ s/^\[\([0-9]*\)\][-+ ]*\([0-9]* *\)[a-z][a-z]* *\(.*\)/%\1 ;: \2\3/ }' $tmpfile)}" ) else reply=() fi } compctl -Q -K complete_listjobs fg bg kill -- Stefan