* Re: Bug#444583: zsh: precmd not executed before a new prompt is displayed when a job exists
2007-09-29 15:28 ` Bug#444583: zsh: precmd not executed before a new prompt is displayed when a job exists Clint Adams
@ 2007-09-29 21:31 ` Bart Schaefer
2007-09-29 21:49 ` Clint Adams
2007-10-01 9:52 ` Peter Stephenson
1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2007-09-29 21:31 UTC (permalink / raw)
To: zsh-workers; +Cc: 444583-forwarded, Bas Zoetekouw
On Sep 29, 11:28am, Clint Adams wrote:
} Subject: Re: Bug#444583: zsh: precmd not executed before a new prompt is d
}
} On Sat, Sep 29, 2007 at 05:10:35PM +0200, Bas Zoetekouw wrote:
} > - the zsh then displays something like "[1] + done xeyes" and a new
} > prompt. Before this prompt, the precmd command doesn't seem to be
} > executed.
}
} Could someone clarify the documentation here?
Do you mean clarify it for you, here on the list, or clarify it in the
yodl files for commit to CVS?
I'm not really sure how to do the latter. To explain that "before each
prompt" does not mean "before each time the prompt is printed" but
rather "before each time zsh computes the prompt it will be re-printing
over and over between finishing the previous command and the next time
the accept-line widget is executed" is probably *more* confusing rather
than less.
Bas, how would you phrase it?
The thing is, that when zsh is interrupted by the child-exited signal
handler and displays the "[1] + done xeyes" message, the prompt that
it prints next is the SAME prompt that it printed before; it's merely
re-printing the "old" prompt to make the display look nice. The precmd
function is run only when zsh regenerates a NEW prompt. But it's simply
not possible to document every possible special case; in fact, you won't
even get the "[1] + done xeyes" if you "unsetopt NOTIFY", and NOTIFY
is not set by default, so the circumstance you describe doesn't happen
in the shell's base configuration.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#444583: zsh: precmd not executed before a new prompt is displayed when a job exists
2007-09-29 15:28 ` Bug#444583: zsh: precmd not executed before a new prompt is displayed when a job exists Clint Adams
2007-09-29 21:31 ` Bart Schaefer
@ 2007-10-01 9:52 ` Peter Stephenson
1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2007-10-01 9:52 UTC (permalink / raw)
To: zsh-workers; +Cc: Bas Zoetekouw, 444583-forwarded
On Sat, 29 Sep 2007 11:28:45 -0400
Clint Adams <schizo@debian.org> wrote:
> On Sat, Sep 29, 2007 at 05:10:35PM +0200, Bas Zoetekouw wrote:
> > Zsh's man page says: "precmd Executed before each prompt."
> > However, it doesn't seem to be executed in the following situation:
> >
> > - start xeyes in the background (xeyes &)
> > - kill the xeyes window
> > - the zsh then displays something like "[1] + done xeyes" and a new
> > prompt. Before this prompt, the precmd command doesn't seem to be
> > executed.
> >
> > This situation is a bit annoying for be, because I use precmd to put
> > the number of background jobs in the xterm title. However, when I
> > kill one of these backgorund applications, the xterm title isn't
> > updated currently.
>
> Could someone clarify the documentation here?
How about this?
Index: Doc/Zsh/func.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/func.yo,v
retrieving revision 1.15
diff -u -r1.15 func.yo
--- Doc/Zsh/func.yo 10 Nov 2006 09:59:27 -0000 1.15
+++ Doc/Zsh/func.yo 1 Oct 2007 09:40:01 -0000
@@ -188,7 +188,9 @@
findex(precmd)
vindex(precmd_functions)
item(tt(precmd))(
-Executed before each prompt.
+Executed before each prompt. Note that precommand functions are not
+reexecuted simply because the command line is redrawn, as happens, for
+example, when a notification about an exiting job is displayed.
)
findex(preexec)
vindex(preexec_functions)
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
^ permalink raw reply [flat|nested] 4+ messages in thread