zsh-users
 help / color / mirror / code / Atom feed
From: "René 'Necoro' Neumann" <lists@necoro.eu>
To: zsh-users@zsh.org
Subject: Re: problem with function in prompt
Date: Thu, 24 Mar 2011 23:09:23 +0100	[thread overview]
Message-ID: <4D8BC113.3070703@necoro.eu> (raw)
In-Reply-To: <F8A44F57-744F-41C4-B030-8170FCF1F03D@agrussell.com>

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

Am 24.03.2011 21:23, schrieb Stephen Prater:
> 
> The problem is that it never re-executes the function in the prompt ----
> 
> setopt prompt_subst
> 
> PROMPT_INFO="$(draw f21 ul hbar) $(host_name)- %L
> $(draw f21 ll hbar) $(dir_name) $(free_mem)"
> DEF_PROMPT="${(e)${PROMPT_INFO}} %F{cyan} [ %f"
> INS_MODE_PROMPT="${(e)${PROMPT_INFO}} %F{red} [ %f"
> 
> 
> The value that appears in the prompt is always the same as the one when
> the shell was initially executed.

You should use FOO='$bla' instead of FOO="$bla" -- with the latter, $bla
is evaluated while assigning -- with the first one, $bla is evaluated
while evaluating $FOO.

This means, with your current way, the variables and functions are all
computed while setting the prompt variable -- and then there is nothing
left to evaluate while printing the prompt :)

HTH,
- René


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

      reply	other threads:[~2011-03-24 22:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24 20:23 Stephen Prater
2011-03-24 22:09 ` René 'Necoro' Neumann [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=4D8BC113.3070703@necoro.eu \
    --to=lists@necoro.eu \
    --cc=zsh-users@zsh.org \
    /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).