From: Daniel <quite@hack.org>
To: zsh-users@zsh.org
Subject: Re: named jobs in RPROMPT
Date: Tue, 20 Sep 2011 07:27:51 +0000 (UTC) [thread overview]
Message-ID: <loom.20110920T091456-635@post.gmane.org> (raw)
In-Reply-To: <25285513.300695.1316475776167.JavaMail.servlet@pustefix152.kundenserver.de>
<fhml <at> herrmann-koenigsberg.de> writes:
>
> 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.
I'm well aware of the function of single-quotes and the need for them here.
Sorry I omitted them from what was pseudo-code but didn't look like that ;)
But thanks anyway, because now I tried to minimize my code even more.
setopt promptsubst
Now consider:
RPROMPT='"$jobstates"'
and
my_jobs() { print $jobstates }
RPROMPT='"$(my_jobs)"'
The first one display the jobstates array, the second doesn't. Also, running
my_jobs from the prompt does display the array. Could this be because inside
the function, there are no background jobs? It's in a different context, or
something like that?
My idea is to have my_jobs print a very compact list of jobs, fitting in
the right prompt.
next prev parent reply other threads:[~2011-09-20 7:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 23:42 fhml
2011-09-20 7:27 ` Daniel [this message]
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=loom.20110920T091456-635@post.gmane.org \
--to=quite@hack.org \
--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).