zsh-users
 help / color / mirror / code / Atom feed
* list all jobs before prompt
@ 2005-06-12  5:16 Michael Wardle
  2005-06-12 17:10 ` Bart Schaefer
  2005-06-13  0:18 ` Michael Wardle
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Wardle @ 2005-06-12  5:16 UTC (permalink / raw)
  To: zsh-users

Hi

I would like zsh to list /all/ jobs when I suspend one.

A reasonable method is to add "jobs" to my precmd function, but this
will cause zsh to print a status message for the suspended job and list
the same job again in the output of "jobs".  I don't see the need for
the suspended job to be listed twice.  It also looks a bit silly if the
command I type at the prompt is "jobs". :-)

I could also do a lot of manual filtering in precmd, but I would have to
make some assumptions and it still wouldn't produce the desired,
consistent output format unless I could also prevent the default message
on suspension.

Is there a better way to accomplish this?

The closest behavior to what I desire is tcsh's listjobs option.

-- 
Michael Wardle <michael@endbracket.net>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: list all jobs before prompt
  2005-06-12  5:16 list all jobs before prompt Michael Wardle
@ 2005-06-12 17:10 ` Bart Schaefer
  2005-06-13  0:18 ` Michael Wardle
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2005-06-12 17:10 UTC (permalink / raw)
  To: Michael Wardle, zsh-users

On Jun 12,  3:16pm, Michael Wardle wrote:
> 
> I would like zsh to list /all/ jobs when I suspend one.

I think the closest you can get without a modification of the source code
is this:

precmd () {
  local x=$?	# This must be the first line of precmd!
  # ... do whatever precmd stuff you already do, then ...
  # This requires zmodload zsh/parameter plus extendedglob:
  (( x == 20 )) && jobs %${(k)^jobstates[(R)^*:+:*]}
}

> I could also do a lot of manual filtering in precmd

Not a lot, is it?

> still wouldn't produce the desired,
> consistent output format unless I could also prevent the default message

Oh, well; you can't always get what you want.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: list all jobs before prompt
  2005-06-12  5:16 list all jobs before prompt Michael Wardle
  2005-06-12 17:10 ` Bart Schaefer
@ 2005-06-13  0:18 ` Michael Wardle
  2005-06-13  8:06   ` Miek Gieben
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Wardle @ 2005-06-13  0:18 UTC (permalink / raw)
  To: zsh-users

Perhaps the two good solutions are:

1. make the suspend message match the format of the jobs command

Sending a STOP signal (usually via Control-Z) to a process would print
(for example):

[1]  + suspended  vim

instead of:

zsh: suspended  vim

Bash does this and I think it would be quite useful.


2. add support for an option similar to listjobs in tcsh


Is there any interest in either of these suggestions?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: list all jobs before prompt
  2005-06-13  0:18 ` Michael Wardle
@ 2005-06-13  8:06   ` Miek Gieben
  0 siblings, 0 replies; 4+ messages in thread
From: Miek Gieben @ 2005-06-13  8:06 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

[On 13 Jun, @02:18, Michael Wardle wrote in "Re: list all jobs before promp ..."]
> Perhaps the two good solutions are:
> 
> 1. make the suspend message match the format of the jobs command
> 
> Sending a STOP signal (usually via Control-Z) to a process would print
> (for example):
> 
> [1]  + suspended  vim
> 
> instead of:
> 
> zsh: suspended  vim
> 
> Bash does this and I think it would be quite useful.

I agree. I didn't even know I was missing that bash feature :-) In
bash I've never used the 'jobs' command, in zsh I do...because I don't
know the job numbers.

What is needed for this? I expect any change for this to be minor.

> 2. add support for an option similar to listjobs in tcsh

I don't know what that is,

--
grtz,
  - Miek

http://www.miek.nl                      http://www.nlnetlabs.nl
PGP Key ID: 0xB18453A1
fingerprint: 002B B079 0DDA 7D44 2B5C  CAB0 C3B7 F943 B184 53A1

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-06-13  8:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-12  5:16 list all jobs before prompt Michael Wardle
2005-06-12 17:10 ` Bart Schaefer
2005-06-13  0:18 ` Michael Wardle
2005-06-13  8:06   ` Miek Gieben

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).