From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26263 invoked from network); 27 May 1999 21:45:36 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 May 1999 21:45:36 -0000 Received: (qmail 2323 invoked by alias); 27 May 1999 21:45:27 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6360 Received: (qmail 2311 invoked from network); 27 May 1999 21:45:27 -0000 Message-ID: <374DBCEE.69426B26@linna.com> Date: Thu, 27 May 1999 14:45:58 -0700 From: Nik Gervae Reply-To: nik@linna.com X-Mailer: Mozilla 4.51 (Macintosh; I; PPC) X-Accept-Language: English,en,ja MIME-Version: 1.0 To: zsh-workers@sunsite.auc.dk Subject: The mystery of deferred prompt evaluation Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Folks-- If I do this in 3.0.5: PROMPT_LEN=3 PROMPT_DYN='%${PROMPT_LEN}C' PROMPT='%0(#..)${PROMPT_DYN}% ' I get the really cool feature of being able to change PROMPT_LEN at any point and having my prompt adjust how much of my path it shows. Oddly enough, this only works if I put the %(...) construct before the parameter reference in the prompt, if that isn't there then my prompt ends up being the literal text of the definition, with the parameter not getting expanded. I might add that in 3.1.5 the latter behavior is always the case (which I when I first noticed this). Does anyone know: a) Why I shouldn't be able to defer parameter expansion in my prompts in general? b) Why in 3.0.5 it works with %(...) before the parameter but not without? c) Why it doesn't work at all, ever, in 3.1.5? d) How I can get this behavior back? :-) In case you're wondering why I would want something so convoluted, I was trying to make life easier for the non-power users, so that they could set a single variable and get as much of the prompt as they wanted without having to learn all the details of prompt syntax. I happened to have the $(...) there for another such feature, which is why this happened to work for me for so long. -- Nik Gervae < nik at linna dot com > Techwriter, vegan, dilettante