From: Nik Gervae <nik@linna.com>
To: zsh-workers@sunsite.auc.dk
Subject: The mystery of deferred prompt evaluation
Date: Thu, 27 May 1999 14:45:58 -0700 [thread overview]
Message-ID: <374DBCEE.69426B26@linna.com> (raw)
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
next reply other threads:[~1999-05-27 21:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-27 21:45 Nik Gervae [this message]
1999-05-31 9:20 ` Bart Schaefer
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=374DBCEE.69426B26@linna.com \
--to=nik@linna.com \
--cc=zsh-workers@sunsite.auc.dk \
/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).