zsh-users
 help / color / mirror / code / Atom feed
From: fhml@herrmann-koenigsberg.de
To: <zsh-users@zsh.org>
Subject: RE: named jobs in RPROMPT
Date: Tue, 20 Sep 2011 01:42:56 +0200	[thread overview]
Message-ID: <25285513.300695.1316475776167.JavaMail.servlet@pustefix152.kundenserver.de> (raw)

Hey there.

> [...] and then set
>RPROMPT=$(jobfunction) But I get nothing, it seems jobstates is empty
>during prompt generation?

When you do >>PROMPT=$(code)<< then 'code' gets executed and the result is stored in PROMPT. Sometimes that is not what you want. What you probably want is >>PROMPT='$(code)'<<. See the little 's? Those prevent 'code' from being evaluated immediately. Now the code gets evaluated every time the PROMPT is shown.

A simple example where 'code' is 'date'. Lets say its currently 1970-01-01 00:00:00. When you enter >>PROMPT=$(date)<<, '$(date)' gets evaluated immediately, which is the same as if you typed >>PROMPT="1970-01-01 00:00:00"<<. Of course, that will never change. If you use 's, then '$(date)' gets stored in PROMPT - just as you typed it, not evaluated. Now every time PROMPT is evaluated '$(date)' gets evaluated which gives you a brand new date every time your PROMPT is updated.

Greetings :)


             reply	other threads:[~2011-09-20  0:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 23:42 fhml [this message]
2011-09-20  7:27 ` Daniel
2011-09-20 19:04   ` Julien Jehannet
2011-09-25 17:39   ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2011-09-18 14:48 Daniel

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=25285513.300695.1316475776167.JavaMail.servlet@pustefix152.kundenserver.de \
    --to=fhml@herrmann-koenigsberg.de \
    --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).