zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-users@math.gatech.edu
Subject: Re: multiple background jobs of the same program
Date: Mon, 15 Sep 1997 07:56:33 -0700	[thread overview]
Message-ID: <970915075634.ZM30556@candle.brasslantern.com> (raw)
In-Reply-To: <5ld8ma95sf.fsf@tequila.systemsz.cs.yale.edu>

On Sep 15,  7:26am, Stefan Monnier wrote:
> Subject: Re: multiple background jobs of the same program
>
> I must be stupid, because a much simpler alternative works just as well if not
> better:

What's $TMP ?  When I first cut'n'pasted this, I got

zsh: permission denied: /zshjobcomp.30447

Here's a better idea:

    complete_listjobs() {
      tmpfile=${TMPPREFIX}jobcomp.$$
      jobs >&| $tmpfile
      if [[ -s $tmpfile ]] then
         reply=("${(@f)$(sed -e 's/^\[\([0-9]*\)\][-+ ]*/%\1 ;: /' $tmpfile)}")
      else
        reply=()
      fi
    }
     
    compctl -Q -K complete_listjobs fg bg kill

If not for the nofunctionargzero option, I'd use $TMPPREFIX$0.$$ for the
temp file name.

> - only list the plainly suspended jobs (and not waiting on tty) for bg
> - aknowledge the fact that kill has more uses than to kill jobs. the jobs
>   completion should only work once "%" is entered. "ls /proc" might be used
>   as well as "kill -l" for other cases.

Too bad both of those would require separate but very similar functions.
Or is there some way to get at the name of the command that caused the
completion to be selected?

(Also too bad that using /proc isn't portable. `ps` output is better, but
only marginally.)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


      parent reply	other threads:[~1997-09-15 15:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-14  3:26 Jose Unpingco
1997-09-14 17:28 ` Adam R. Paul
1997-09-14 19:10   ` Bart Schaefer
1997-09-14 22:05     ` Adam R. Paul
1997-09-14 23:09       ` Bart Schaefer
1997-09-15  3:02         ` Adam R. Paul
     [not found]           ` <5len6q9692.fsf@tequila.systemsz.cs.yale.edu>
     [not found]             ` <5ld8ma95sf.fsf@tequila.systemsz.cs.yale.edu>
1997-09-15 14:56               ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=970915075634.ZM30556@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).