From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6428 invoked by alias); 20 Sep 2011 07:28:12 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16389 Received: (qmail 17911 invoked from network); 20 Sep 2011 07:28:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at m.gmane.org designates 80.91.229.12 as permitted sender) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Daniel Subject: Re: named jobs in RPROMPT Date: Tue, 20 Sep 2011 07:27:51 +0000 (UTC) Message-ID: References: <25285513.300695.1316475776167.JavaMail.servlet@pustefix152.kundenserver.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 85.178.15.7 (Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0) 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.