From: Oliver Kiddle <opk@u.genie.co.uk>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: Re: Alternate patch Re: PATCH: New prompt themes
Date: Thu, 21 Oct 1999 09:54:09 +0100 [thread overview]
Message-ID: <380ED4B0.CB258973@u.genie.co.uk> (raw)
In-Reply-To: <991020041621.ZM6569@candle.brasslantern.com>
Bart Schaefer wrote:
> That's why the prompt themes created by bash2zshprompt install a precmd
> function that includes "setop promptsubst", and why I patched several of
I hadn't thought of doing it that way and had only read the text not the patch in your message so hadn't seen it. I agree with your past comments about stomping on precmd though and think it is better not to use precmd just for one setopt which doesn't need to be run every time the prompt is printed anyway.
> Just do
> [[ $HOST == (${(j(|))~normal_hosts}) ]] && host=""
That works well, thanks.
Bart Schaefer wrote:
> I'm not sure that it's that useful to factor out the prefix "prompt" from
> each of the strings in prompt_opts, but I'm not going to change that here.
I did that because it seemed an easy way to restrict it to the prompt options.
> Further, I might suggest that instead of an assoc. array with both set and
> unset values, just use a regular array of only the values that are meant to
> be set; e.g. one command instead of a loop:
> setopt noprompt{bang,cr,percent,subst} prompt$^prompt_opts
> However, I didn't make that change either.
That probably is better. An alternative patch to do it that way follows. The only thing I'm not sure about is whether it is wise that promptcr is controlled by the prompt themes. I'd consider it to be down to personal preference whether it's set or not. I also can't see that it could be crucial to a particular theme so you might want to remove cr from the brace expansion.
Incidentally, I had to use prompt${^prompt_opts[@]} instead of what you suggested because after emulate -R ksh, only the first word in the array would be expanded.
*** Functions/Prompts/promptinit.bak Wed Oct 20 18:25:20 1999
--- Functions/Prompts/promptinit Wed Oct 20 18:37:18 1999
***************
*** 34,40 ****
prompt_newline=$(echo -ne "\n%{\r%}")
}
! prompt () {
emulate -L zsh
local opt preview theme usage old_theme
--- 34,40 ----
prompt_newline=$(echo -ne "\n%{\r%}")
}
! set_prompt() {
emulate -L zsh
local opt preview theme usage old_theme
***************
*** 103,108 ****
--- 103,117 ----
promptzzzz=$reset_color
;;
esac
+ }
+
+ prompt() {
+ local prompt_opts
+
+ set_prompt "$@"
+
+ (( $#prompt_opts )) &&
+ setopt noprompt{bang,cr,percent,subst} prompt${^prompt_opts[@]}
}
promptinit "$@"
next prev parent reply other threads:[~1999-10-21 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-19 19:11 Oliver Kiddle
1999-10-20 0:40 ` Bart Schaefer
1999-10-20 4:16 ` Alternate patch " Bart Schaefer
1999-10-21 8:54 ` Oliver Kiddle [this message]
1999-10-21 15:09 ` 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=380ED4B0.CB258973@u.genie.co.uk \
--to=opk@u.genie.co.uk \
--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).