From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16729 invoked from network); 18 May 2008 16:14:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 18 May 2008 16:14:39 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 71261 invoked from network); 18 May 2008 16:13:46 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 May 2008 16:13:46 -0000 Received: (qmail 24486 invoked by alias); 18 May 2008 16:13:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25063 Received: (qmail 24472 invoked from network); 18 May 2008 16:13:42 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 18 May 2008 16:13:42 -0000 Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id 88AE780589A4 for ; Sun, 18 May 2008 18:13:37 +0200 (CEST) Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20080518161731.UKIE58.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Sun, 18 May 2008 17:17:31 +0100 Received: from pws-pc ([81.107.40.67]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20080518161620.BBAT17393.aamtaout02-winn.ispmail.ntl.com@pws-pc> for ; Sun, 18 May 2008 17:16:20 +0100 Date: Sun, 18 May 2008 17:12:15 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: update prompt themes Message-ID: <20080518171215.02a2f725@pws-pc> In-Reply-To: <080517183510.ZM12224@torch.brasslantern.com> References: <4430.1211063817@pws-pc> <080517183510.ZM12224@torch.brasslantern.com> X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.91.2/7149/Sun May 18 16:40:15 2008 on bifrost X-Virus-Status: Clean On Sat, 17 May 2008 18:35:10 -0700 Bart Schaefer wrote: > } - functions[precmd]="${functions[precmd]//prompt_bart_precmd}" > } + precmd_functions[(r)prompt_*_precmd]= > } + precmd_functions=($precmd_functions) > > I'm curious why the second assignment is necessary there. Remove an > empty element? Couldn't you just do this? > > precmd_functions[(r)prompt_*_precmd]=() > > Or perhaps better > > add-zsh-hook -D precmd 'prompt_*_precmd' Yes, the latter is correct. I missed that one when I updated to use add-zsh-hook because it wasn't in the usual place. > (Or do I misunderstand the -D option you added?) > > } # Abuse the fg assoc to hold our selected colors ... > } - fg[%m]=$fg[${1:-red}] > > Er, the fg assoc came from Functions/Misc/colors which you're no longer > including, so it's no longer "abuse" to do this to the $fg that you've > declared global in this same function. Well, yes, but I didn't really want to fiddle too much with the comments. Index: Functions/Prompts/prompt_bart_setup =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_bart_setup,v retrieving revision 1.14 diff -u -r1.14 prompt_bart_setup --- Functions/Prompts/prompt_bart_setup 17 May 2008 22:42:17 -0000 1.14 +++ Functions/Prompts/prompt_bart_setup 18 May 2008 16:10:39 -0000 @@ -151,8 +151,7 @@ # A few extra niceties ... repeat 1 case "$1:l" in (off|disable) - precmd_functions[(r)prompt_*_precmd]= - precmd_functions=($precmd_functions) + add-zsh-hook -D precmd "prompt_*_precmd" functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch}" [[ $prompt_theme[1] = bart ]] && PS1=${${(f)PS1}[-1]} return 1 @@ -162,7 +161,10 @@ [[ $prompt_theme[1] = bart ]] && break ;& (*) - # Abuse the fg assoc to hold our selected colors ... + # Use the fg assoc to hold our selected colors ... + # This used to be provided by the function colors, but is now + # set directly from here. There should be no clash if both + # are in use. fg[%m]="%F{${1:-red}}" fg[%h]="%F{${2:-blue}}" fg[%~]="%F{${3:-default}}" -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/