zsh-workers
 help / color / mirror / code / Atom feed
* precmd reserved names
@ 2009-01-14 20:24 tek
  2009-01-15 14:46 ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: tek @ 2009-01-14 20:24 UTC (permalink / raw)
  To: zsh-workers

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

Hello,
I noticed that prompt_THEME_precmd(in a prompt theme) isn't executed anymore 
if added to precmd_functions in 4.3.9, while it was in 4.3.6. As I didn't 
find anything in the ChangeLog, I thought maybe someone forgot to mention 
that.

Regards,
Torsten

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: precmd reserved names
  2009-01-14 20:24 precmd reserved names tek
@ 2009-01-15 14:46 ` Peter Stephenson
  2009-01-18 13:23   ` tek
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2009-01-15 14:46 UTC (permalink / raw)
  To: zsh-workers

On Wed, 14 Jan 2009 21:24:10 +0100
tek <tek@moonitor.org> wrote:
> I noticed that prompt_THEME_precmd(in a prompt theme) isn't executed anymore 
> if added to precmd_functions in 4.3.9, while it was in 4.3.6. As I didn't 
> find anything in the ChangeLog, I thought maybe someone forgot to mention 
> that.

It can't be quite that simple.

% prompt_THEME_precmd() { print Executing function; }  
% precmd_functions=(prompt_THEME_precmd)
Executing function

Do you mean something different?  For example, do you mean "doesn't get
automatically added to precmd_functions"?  That also seems to be working
for me.

Can you reproduce this starting from "zsh -f"?

-- 
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] 6+ messages in thread

* Re: precmd reserved names
  2009-01-15 14:46 ` Peter Stephenson
@ 2009-01-18 13:23   ` tek
  2009-01-19  9:43     ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: tek @ 2009-01-18 13:23 UTC (permalink / raw)
  To: zsh-workers

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

Yes, sorry, I should have been more detailed about this - it is in a prompt 
theme file, called prompt_foo_setup, and the file lies in a directory added 
to $fpath. I load the prompt with 'prompt foo', and when the function is 
named prompt_foo_precmd, it isn't executed, but it is otherwise.

Peter wrote:
> On Wed, 14 Jan 2009 21:24:10 +0100
>
> tek <tek@moonitor.org> wrote:
> > I noticed that prompt_THEME_precmd(in a prompt theme) isn't executed
> > anymore if added to precmd_functions in 4.3.9, while it was in 4.3.6. As
> > I didn't find anything in the ChangeLog, I thought maybe someone forgot
> > to mention that.
>
> It can't be quite that simple.
>
> % prompt_THEME_precmd() { print Executing function; }
> % precmd_functions=(prompt_THEME_precmd)
> Executing function
>
> Do you mean something different?  For example, do you mean "doesn't get
> automatically added to precmd_functions"?  That also seems to be working
> for me.
>
> Can you reproduce this starting from "zsh -f"?



[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: precmd reserved names
  2009-01-18 13:23   ` tek
@ 2009-01-19  9:43     ` Peter Stephenson
  2009-01-20 12:08       ` tek
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2009-01-19  9:43 UTC (permalink / raw)
  To: zsh-workers

On Sun, 18 Jan 2009 14:23:29 +0100
tek <tek@moonitor.org> wrote:
> Yes, sorry, I should have been more detailed about this - it is in a prompt 
> theme file, called prompt_foo_setup, and the file lies in a directory added 
> to $fpath. I load the prompt with 'prompt foo', and when the function is 
> named prompt_foo_precmd, it isn't executed, but it is otherwise.

It should work as long as it's marked for autoload by that point.

-- 
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] 6+ messages in thread

* Re: precmd reserved names
  2009-01-19  9:43     ` Peter Stephenson
@ 2009-01-20 12:08       ` tek
  2009-01-20 12:21         ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: tek @ 2009-01-20 12:08 UTC (permalink / raw)
  To: zsh-workers

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

Seems, not for me. It also doesn't need to be autoloaded, if it's called 
prompt_foo_precmd_bar, it just isn't executed if it has exactly the mentioned 
name.

Peter wrote:
> On Sun, 18 Jan 2009 14:23:29 +0100
>
> tek <tek@moonitor.org> wrote:
> > Yes, sorry, I should have been more detailed about this - it is in a
> > prompt theme file, called prompt_foo_setup, and the file lies in a
> > directory added to $fpath. I load the prompt with 'prompt foo', and when
> > the function is named prompt_foo_precmd, it isn't executed, but it is
> > otherwise.
>
> It should work as long as it's marked for autoload by that point.



[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: precmd reserved names
  2009-01-20 12:08       ` tek
@ 2009-01-20 12:21         ` Peter Stephenson
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2009-01-20 12:21 UTC (permalink / raw)
  To: tek; +Cc: zsh-workers

tek wrote:
> Seems, not for me. It also doesn't need to be autoloaded, if it's called
> prompt_foo_precmd_bar, it just isn't executed if it has exactly the
> mentioned name.

Ah, I see.  Old hooks get deleted when the prompt is set up, just before
prompt_*_setup is run.  You need something like:

    add-zsh-hook precmd prompt_bart_precmd

*inside* (or after) prompt_foo_setup.

This did indeed change.  How to add new prompts to the themes was never
a documented interface, only how to use it; the only way to do it has
bene to look at the existing themes.  Feel free to supply documentation
if you think it's lacking.

-- 
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] 6+ messages in thread

end of thread, other threads:[~2009-01-20 12:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-14 20:24 precmd reserved names tek
2009-01-15 14:46 ` Peter Stephenson
2009-01-18 13:23   ` tek
2009-01-19  9:43     ` Peter Stephenson
2009-01-20 12:08       ` tek
2009-01-20 12:21         ` Peter Stephenson

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