From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9446 invoked from network); 14 Sep 1997 23:14:31 -0000 Received: from math.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 14 Sep 1997 23:14:31 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id TAA12460; Sun, 14 Sep 1997 19:09:47 -0400 (EDT) Resent-Date: Sun, 14 Sep 1997 19:09:29 -0400 (EDT) From: "Bart Schaefer" Message-Id: <970914160910.ZM23900@candle.brasslantern.com> Date: Sun, 14 Sep 1997 16:09:10 -0700 In-Reply-To: <19970914150505.11879@sco.com> Comments: In reply to "Adam R. Paul" "Re: multiple background jobs of the same program" (Sep 14, 3:05pm) References: <9709140326.AA21133@cryptica.UCSD.EDU> <19970914102839.45957@sco.com> <970914121042.ZM22784@candle.brasslantern.com> <19970914150505.11879@sco.com> X-Mailer: Z-Mail (4.0b.820 20aug96) To: "Adam R. Paul" Subject: Re: multiple background jobs of the same program Cc: zsh MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"pAL0h3.0.623.ew67q"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1020 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Sep 14, 3:05pm, Adam R. Paul wrote: } Subject: Re: multiple background jobs of the same program } } > Replace the `#' with `;:'. This works best if you have menu completion } > so that the `;' isn't interpreted as a command separator until after you } > have a chance to cycle through all the possibilities. } } Hmm, it doesn't appear to work at all unless menu_complete is set :( I use automenu, not menucomplete, and it's OK there .... However, it works for me with autolist and listambiguous, at least as far as getting the listing: zagzig[37] fg %1 ;: vim fo %2 ;: info -f zsh %3 ;: vim bar zagzig[37] fg % At this point if I hit TAB again I get a beep, and if I supply (say) the digit 1 and then hit TAB I encounter what must be a completion bug: zagzig[37] fg %1 zagzig[37] fg %^@1 %1 ;: vim fo %2 ;: info -f zsh %3 ;: vim bar zagzig[37] fg % That ^@ in there is a nul byte that zsh is incorrectly inserting. It then gets erased by compctl -U, but it shouldn't be there to begin with. Anyway, the ;: has nothing to do with this particular problem -- get rid of the -U if you don't use automenu or menucomplete, and things should be much better. I just played around with this a bit and discovered that you don't need -U at all as long as reply is an empty array (rather than an array containing the empty string) when there are no jobs -- which you can do by testing whether "jobs" produced any output before running the "sed". See below. } > Either remove the temp file or use >| so `setopt clobber' isn't needed. } } I'd love to not use a temp file, but it appears that piping 'jobs' output No, I didn't mean don't use the temp file; I meant end the function with "rm /tmp/._zshjobcomp.$$". Anyway, to summarize: listjobs() { jobs >| /tmp/._zshjobcomp.$$ 2>&1 if [[ -s /tmp/._zshjobcomp.$$ ]] then reply=( "${(@f)$(sed -e '{ s/.\(....\).............\(.*\)/%\1 ;: \2/g s/\]//g s/ */ /g }' /tmp/._zshjobcomp.$$)}" ) else reply=() fi } compctl -Q -K listjobs fg bg kill -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com