zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: prompt fun
@ 1999-10-04 18:40 Adam Spiers
  1999-10-04 23:14 ` Bart Schaefer
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Adam Spiers @ 1999-10-04 18:40 UTC (permalink / raw)
  To: zsh workers mailing list

Here's a more light-hearted addition, which I've finally got round to
turning into a releasable form -- themeable prompts.  Those of
you with any taste will probably wince at this point, but it would
really be nice to see zsh getting the kind of mainstream attention it
deserves, and the sad fact is that most command-line hackers in the
newer generation of the culture appreciate a fancy prompt more than an
amazing completion system (only because they've never experienced the
latter, though).  Besides, bash has bashprompt, and I don't like bash
having anything zsh doesn't ...

This patch adds:

Functions/Prompts/promptinit
  -- in a direct parallel with compinit, sets up the prompt themes system

Completion/User/_prompt
  -- completion for `prompt', the command which controls the system

Functions/Misc/colors
  -- a bunch of ANSI colou?rs

Misc/bash2zshprompt
  -- an evil, ugly hack for converting bashprompt themes to the system
     (don't look at this for too long :-)

Functions/Prompts/prompt_*_setup
  -- a whole load of themes, some very simple, some excessively fancy
     (all autoloaded, of course).  Some aren't 8-bit clean; let me
     know if this is a problem.

To play with the system:

  autoload -U promptinit
  promptinit
  prompt -h

`prompt -p' gives a preview of all the themes, which is quite cute.

Suggestions on how to improve the mess with $(echo <ANSI codes>)
welcome, as are comments on how many of the themes belong in the
distribution, or any other comments for that matter.

Index: Completion/User/_prompt
===================================================================
RCS file: _prompt
diff -N _prompt
--- /dev/null	Tue May  5 21:32:27 1998
+++ _prompt	Mon Oct  4 18:04:35 1999
@@ -0,0 +1,7 @@
+#compdef prompt
+
+_arguments -s \
+  '-l[list themes]:*:' \
+  "-h[help]::prompt theme:($prompt_themes):*:" \
+  "-p[preview theme(s)]:*:prompt theme:($prompt_themes):*:" \
+  {-s'[set and save theme]','*'}":prompt themes:($prompt_themes):*:"
Index: Functions/Misc/colors
===================================================================
RCS file: colors
diff -N colors
--- /dev/null	Tue May  5 21:32:27 1998
+++ colors	Mon Oct  4 18:41:11 1999
@@ -0,0 +1,67 @@
+# Put standard ANSI color codes in environment for easy use
+
+reset_color="$(echo -n '\e[0m')"
+bold_color="$(echo -n '\e[1m')"
+
+# Foreground
+
+fg_grey="$(echo -n '\e[30m')"
+fg_red="$(echo -n '\e[31m')"
+fg_green="$(echo -n '\e[32m')"
+fg_yellow="$(echo -n '\e[33m')"
+fg_blue="$(echo -n '\e[34m')"
+fg_magenta="$(echo -n '\e[35m')"
+fg_cyan="$(echo -n '\e[36m')"
+fg_white="$(echo -n '\e[37m')"
+
+fg_no_bold_grey="$(echo -n '\e[0;30m')"
+fg_no_bold_red="$(echo -n '\e[0;31m')"
+fg_no_bold_green="$(echo -n '\e[0;32m')"
+fg_no_bold_yellow="$(echo -n '\e[0;33m')"
+fg_no_bold_blue="$(echo -n '\e[0;34m')"
+fg_no_bold_magenta="$(echo -n '\e[0;35m')"
+fg_no_bold_cyan="$(echo -n '\e[0;36m')"
+fg_no_bold_white="$(echo -n '\e[0;37m')"
+
+fg_bold_grey="$(echo -n '\e[1;30m')"
+fg_bold_red="$(echo -n '\e[1;31m')"
+fg_bold_green="$(echo -n '\e[1;32m')"
+fg_bold_yellow="$(echo -n '\e[1;33m')"
+fg_bold_blue="$(echo -n '\e[1;34m')"
+fg_bold_magenta="$(echo -n '\e[1;35m')"
+fg_bold_cyan="$(echo -n '\e[1;36m')"
+fg_bold_white="$(echo -n '\e[1;37m')"
+
+# Background
+
+bg_grey="$(echo -n '\e[40m')"
+bg_red="$(echo -n '\e[41m')"
+bg_green="$(echo -n '\e[42m')"
+bg_yellow="$(echo -n '\e[43m')"
+bg_blue="$(echo -n '\e[44m')"
+bg_magenta="$(echo -n '\e[45m')"
+bg_cyan="$(echo -n '\e[46m')"
+bg_white="$(echo -n '\e[47m')"
+
+bg_no_bold_grey="$(echo -n '\e[0;40m')"
+bg_no_bold_red="$(echo -n '\e[0;41m')"
+bg_no_bold_green="$(echo -n '\e[0;42m')"
+bg_no_bold_yellow="$(echo -n '\e[0;43m')"
+bg_no_bold_blue="$(echo -n '\e[0;44m')"
+bg_no_bold_magenta="$(echo -n '\e[0;45m')"
+bg_no_bold_cyan="$(echo -n '\e[0;46m')"
+bg_no_bold_white="$(echo -n '\e[0;47m')"
+
+bg_bold_grey="$(echo -n '\e[1;40m')"
+bg_bold_red="$(echo -n '\e[1;41m')"
+bg_bold_green="$(echo -n '\e[1;42m')"
+bg_bold_yellow="$(echo -n '\e[1;43m')"
+bg_bold_blue="$(echo -n '\e[1;44m')"
+bg_bold_magenta="$(echo -n '\e[1;45m')"
+bg_bold_cyan="$(echo -n '\e[1;46m')"
+bg_bold_white="$(echo -n '\e[1;47m')"
+
+# Stop these screwing the environment listing up
+bg_zzzz=$reset_color
+fg_zzzz=$reset_color
+bold_zzzz=$reset_color
Index: Functions/Prompts/prompt_adam1_setup
===================================================================
RCS file: prompt_adam1_setup
diff -N prompt_adam1_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_adam1_setup	Mon Oct  4 18:11:15 1999
@@ -0,0 +1,33 @@
+# adam1 prompt theme
+
+prompt_adam1_setup () {
+  base_prompt="%{$bg_no_bold_blue%}%n@%m%{$reset_color%} "
+  post_prompt="%{$reset_color%}"
+
+  base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%{.*?%}//g")
+  post_prompt_no_color=$(echo "$post_prompt" | perl -pe "s/%{.*?%}//g")
+
+  precmd  () { prompt_adam1_precmd }
+  preexec () { }
+}
+
+prompt_adam1_precmd () {
+  setopt noxtrace localoptions
+  local base_prompt_expanded_no_color base_prompt_etc
+  local prompt_length space_left
+
+  base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color")
+  base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~")
+  prompt_length=${#base_prompt_etc}
+  if [[ $prompt_length -lt 40 ]]; then
+    path_prompt="%{$fg_bold_cyan%}%(4~|...|)%3~%{$fg_bold_white%}"
+  else
+    space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 ))
+    path_prompt="%{$fg_bold_green%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
+  fi
+  PS1="$base_prompt$path_prompt %# $post_prompt"
+  PS2="$base_prompt$path_prompt %_> $post_prompt"
+  PS3="$base_prompt$path_prompt ?# $post_prompt"
+}
+
+prompt_adam1_setup "$@"
Index: Functions/Prompts/prompt_adam2_setup
===================================================================
RCS file: prompt_adam2_setup
diff -N prompt_adam2_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_adam2_setup	Mon Oct  4 18:49:05 1999
@@ -0,0 +1,116 @@
+# adam2 prompt theme
+
+prompt_adam2_help () {
+  cat <<'EOF'
+This prompt is color-theme-able.  You can invoke it thus:
+
+  prompt adam2 [ simple ] <color1> <color2> <color3>
+
+where the colors are for the hyphens, current directory, and user@host
+bits respectively.
+
+And you probably thought adam1 was overkill.  If you've ever seen a
+more complex prompt in your whole life, please e-mail it to me at
+<adam@spiers.net>; I'd love to know that I'm not the saddest person
+on the planet.
+EOF
+}
+
+prompt_adam2_setup () {
+  # Some can't be local
+  local prompt_gfx_tlc prompt_gfx_mlc prompt_gfx_blc prompt_gfx_bbox 
+
+  if [[ $1 == 'plain' ]]; then
+    shift
+    prompt_gfx_tlc='.'
+    prompt_gfx_mlc='|'
+    prompt_gfx_blc='\`'
+    prompt_gfx_hyphen='-'
+  else
+    prompt_gfx_tlc=$(echo "\xda")
+    prompt_gfx_mlc=$(echo "\xc3")
+    prompt_gfx_blc=$(echo "\xc0")
+    prompt_gfx_hyphen=$(echo "\xc4")
+  fi
+
+  # Colour scheme
+  prompt_scheme_color1=${1:-'cyan'}    # hyphens
+  prompt_scheme_color2=${2:-'green'}   # current directory
+  prompt_scheme_color3=${3:-'cyan'}    # user@host
+
+  local num
+  for num in 1 2 3; do
+    # Grok this!
+    eval "prompt_color$num="'${(P)$(echo "fg_no_bold_$prompt_scheme_color'"$num\")}"
+    eval "prompt_bold_color$num="'${(P)$(echo "fg_bold_$prompt_scheme_color'"$num\")}"
+  done
+
+  prompt_gfx_tbox=$(echo "%{$prompt_bold_color1%}${prompt_gfx_tlc}%{$prompt_color1%}${prompt_gfx_hyphen}")
+  prompt_gfx_bbox=$(echo "%{$prompt_bold_color1%}${prompt_gfx_blc}${prompt_gfx_hyphen}%{$prompt_color1%}")
+
+  # This is a cute hack.  Well I like it, anyway.
+  prompt_gfx_bbox_to_mbox=$(echo "%{\e[A\r$prompt_bold_color1${prompt_gfx_mlc}$prompt_color1${prompt_gfx_hyphen}\e[B%}")
+
+  prompt_l_paren=$(echo "%{$fg_bold_grey%}(")
+  prompt_r_paren=$(echo "%{$fg_bold_grey%})")
+
+  prompt_l_bracket=$(echo "%{$fg_bold_grey%}[")
+  prompt_r_bracket=$(echo "%{$fg_bold_grey%}]")
+
+  prompt_machine=$(echo "%{$prompt_color3%}%n%{$prompt_bold_color3%}@%{$prompt_color3%}%m")
+
+  prompt_padding_text=`perl -e "print qq{${prompt_gfx_hyphen}} x 200"`
+
+  prompt_line_1a="$prompt_gfx_tbox$prompt_l_paren%{$prompt_bold_color2%}%~$prompt_r_paren%{$prompt_color1%}"
+  prompt_line_1a_no_color=$(echo "$prompt_line_1a" | perl -pe "s/%{.*?%}//g")
+  prompt_line_1b=$(echo "$prompt_l_paren$prompt_machine$prompt_r_paren%{$prompt_color1%}${prompt_gfx_hyphen}")
+  prompt_line_1b_no_color=$(echo "$prompt_line_1b" | perl -pe "s/%{.*?%}//g")
+
+  prompt_line_2="$prompt_gfx_bbox${prompt_gfx_hyphen}%{$fg_bold_white%}"
+
+  prompt_char="%(!.#.>)"
+
+  precmd () { prompt_adam2_precmd }
+  preexec () { prompt_adam2_preexec }
+}
+
+prompt_adam2_precmd () {
+  setopt noxtrace localoptions
+  local prompt_line_1a_no_color_expanded prompt_line_2a_no_color_expanded
+  local prompt_padding_size prompt_padding prompt_line_1 pre_prompt
+  local prompt_pwd_size
+
+  prompt_line_1a_no_color_expanded=$(print -P "$prompt_line_1a_no_color")
+  prompt_line_1b_no_color_expanded=$(print -P "$prompt_line_1b_no_color")
+  prompt_padding_size=$(( $COLUMNS
+                            - $#prompt_line_1a_no_color_expanded 
+                            - $#prompt_line_1b_no_color_expanded ))
+
+  if [[ $prompt_padding_size -ge 0 ]]; then
+    prompt_padding=$(printf "%$prompt_padding_size.${prompt_padding_size}s" "$prompt_padding_text")
+    prompt_line_1="$prompt_line_1a$prompt_padding$prompt_line_1b"
+  else
+    prompt_padding_size=$(( $COLUMNS
+                              - $#prompt_line_1a_no_color_expanded ))
+
+    if [[ $prompt_padding_size -ge 0 ]]; then
+      prompt_padding=$(printf "%$prompt_padding_size.${prompt_padding_size}s" "$prompt_padding_text")
+      prompt_line_1="$prompt_line_1a$prompt_padding"
+    else
+      prompt_pwd_size=$(( $COLUMNS - 5 ))
+      prompt_line_1="$prompt_gfx_tbox$prompt_l_paren%{$prompt_bold_color2%}%$prompt_pwd_size<...<%~%<<$prompt_r_paren%{$prompt_color1$prompt_gfx_hyphen%}"
+    fi
+  fi
+
+  pre_prompt="$prompt_line_1$prompt_newline$prompt_line_2"
+
+  PS1="$pre_prompt%{$fg_bold_white%}$prompt_char "
+  PS2="$prompt_line_2%{$prompt_gfx_bbox_to_mbox$fg_bold_white%}%_> "
+  PS3="$prompt_line_2%{$prompt_gfx_bbox_to_mbox$fg_bold_white%}?# "
+}
+
+prompt_adam2_preexec () {
+  print -n "$fg_no_bold_white"
+}
+
+prompt_adam2_setup "$@"
Index: Functions/Prompts/prompt_blue_setup
===================================================================
RCS file: prompt_blue_setup
diff -N prompt_blue_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_blue_setup	Mon Oct  4 17:42:42 1999
@@ -0,0 +1,23 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 333 262 261 260 333 262 261 260; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Blue
+# Created by BadlandZ in v.0.4b
+# Adapted by jf
+# Changed By Spidey 08/06 Adding Ending brackets %}
+#
+prompt_blue_setup () {
+  PS1="%{$fg_blue$bg_blue$bold_color%}$char_333$char_262$char_261$char_260%{$fg_white$bg_blue$bold_color%}%n@%m%{$reset_color%}\
+  %{$fg_blue$bg_grey%}$char_333$char_262$char_261$char_260%{$fg_white$bg_grey$bold_color%} \
+  %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%{$fg_blue$bg_grey$bold_color%}%~/%{$reset_color%} "
+    PS2="%{$fg_blue$bg_grey%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_blue_setup "$@"
Index: Functions/Prompts/prompt_combo_setup
===================================================================
RCS file: prompt_combo_setup
diff -N prompt_combo_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_combo_setup	Mon Oct  4 17:42:42 1999
@@ -0,0 +1,18 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 260 261 262 333 333 262 261 260 333 262 261 260 260 261 262 333 333 262 261 260; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Created by James Manning <jmm@raleigh.ibm.com>
+# Changed by Spidey 08/06
+prompt_combo_setup () {
+  PS1="%{$bold_color$fg_blue$bold_color%}$char_333$char_262$char_261$char_260%{$bold_color$fg_white$bg_blue%}%n@%m%{$reset_color$fg_blue$bg_grey%}$char_260$char_261$char_262$char_333%{$reset_color$fg_blue$bg_grey%}$char_333$char_262$char_261$char_260%{$bold_color$fg_white$bg_grey%} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%{$bold_color$fg_yellow$bg_grey%}$PWD>%{$reset_color%} "
+  PS2="%{$bold_color$fg_blue$bold_color%}$char_333$char_262$char_261$char_260%{$reset_color$fg_blue$bg_grey%}$char_260$char_261$char_262$char_333%{$reset_color$fg_blue$bg_grey%}$char_333$char_262$char_261$char_260%{$bold_color$bold_color$fg_blue%}>%{$reset_color%} "
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_combo_setup "$@"
Index: Functions/Prompts/prompt_cyan_setup
===================================================================
RCS file: prompt_cyan_setup
diff -N prompt_cyan_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_cyan_setup	Mon Oct  4 17:42:42 1999
@@ -0,0 +1,18 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 333 262 261 260 333 262 261 260; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Created by Jim Foltz <aa204@acorn.net>
+# Changed by Spidey 08/06
+prompt_cyan_setup () {
+  PS1="%{$fg_cyan$bg_cyan$bold_color%}$char_333$char_262$char_261$char_260%{$fg_white$bg_cyan$bold_color%}%n@%m%{$reset_color$fg_cyan$bg_grey%}$char_333$char_262$char_261$char_260%{$fg_white$bg_grey$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%{$fg_cyan$bg_grey$bold_color%}%~/%{$reset_color%} "
+  PS2="%{$fg_cyan$bg_grey%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_cyan_setup "$@"
Index: Functions/Prompts/prompt_elite2_setup
===================================================================
RCS file: prompt_elite2_setup
diff -N prompt_elite2_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_elite2_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,17 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+# Created by icetrey <trey@imagin.net>
+# Added by Spidey 08/06
+prompt_elite2_setup () {
+  local GRAD1=`tty|cut -d/ -f3`
+  local COLOR1="%{$reset_color$fg_cyan%}"
+  local COLOR2="%{$bold_color$fg_cyan%}"
+  local COLOR3="%{$bold_color$fg_grey%}"
+  local COLOR4="%{$reset_color%}"
+  PS1="$COLOR3Ú$COLOR1Ä$COLOR2($COLOR1%n$COLOR3@$COLOR1%m$COLOR2)$COLOR1Ä$COLOR2($COLOR1%!$COLOR3/$COLOR1$GRAD1$COLOR2)$COLOR1Ä$COLOR2($COLOR1%D{%I:%M%P}$COLOR3:$COLOR1%D{%m/%d/%y}$COLOR2)$COLOR1Ä$COLOR3-$COLOR4$prompt_newline$COLOR3À$COLOR1Ä$COLOR2($COLOR1%#$COLOR3:$COLOR1%~$COLOR2)$COLOR1Ä$COLOR3-$COLOR4 " 
+  PS2="$COLOR2Ä$COLOR1Ä$COLOR3-$COLOR4 "
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_elite2_setup "$@"
Index: Functions/Prompts/prompt_elite_setup
===================================================================
RCS file: prompt_elite_setup
diff -N prompt_elite_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_elite_setup	Mon Oct  4 17:49:04 1999
@@ -0,0 +1,18 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 332 304 304 371 371 371 372 300 304 304 371 372; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Created by KrON from windowmaker on IRC
+# Changed by Spidey 08/06
+prompt_elite_setup () {
+  PS1="%{$fg_red%}$char_332$char_304%{$fg_blue%}(%{$fg_red%}%n%{$fg_blue%}@%{$fg_red%}%m%{$fg_blue%})%{$fg_red%}-%{$fg_blue%}(%{$fg_red%}%D{%I:%M%P}%{$fg_blue%}-:-%{$fg_red%}%D{%m}%{$fg_blue$fg_red%}/%D{%d}%{$fg_blue%})%{$fg_red%}$char_304-%{$fg_blue]%}$char_371%{$fg_red%}-$char_371$char_371%{$fg_blue%}$char_372$prompt_newline%{$fg_red%}$char_300$char_304%{$fg_blue%}(%{$fg_red%}%1~%{$fg_blue%})%{$fg_red%}$char_304$char_371%{$fg_blue%}$char_372%{$reset_color%}"
+  PS2="> "
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_elite_setup "$@"
Index: Functions/Prompts/prompt_fire_setup
===================================================================
RCS file: prompt_fire_setup
diff -N prompt_fire_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_fire_setup	Mon Oct  4 17:53:08 1999
@@ -0,0 +1,28 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 260 261 262 333; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Inspired by Raster (Carsten Haitzler of Red Hat Advanced Development Labs)
+# Created by BadlandZ
+# Changed by Spidey 08/06
+prompt_fire_setup () {
+  local GRAD1='%{$char_333$char_262$char_261$char_260%}'
+  local GRAD2='%{$char_260$char_261$char_262$char_333%}'
+  local COLOR1='%{$bold_color$fg_yellow$bg_yellow%}'
+  local COLOR2='%{$bold_color$fg_white$bg_yellow%}'
+  local COLOR3='%{$reset_color$fg_red$bg_yellow%}'
+  local COLOR4='%{$reset_color$fg_red$bg_grey%}'
+  local COLOR5='%{$bold_color$fg_yellow$bg_grey%}'
+  local COLOR6='%{$bold_color$fg_white$bg_grey%}'
+  local GRAD0='%{$reset_color%}'
+    PS1=$COLOR1$GRAD1$COLOR2'%n@%m'$COLOR3$GRAD2$COLOR4$GRAD1$COLOR6' %D{%a %b %d} %D{%I:%M:%S%P} '$NONE'$prompt_newline'$COLOR5'%~/'$GRAD0' '
+    PS2=$COLOR1$GRAD1$COLOR3$GRAD2$COLOR4$GRAD1$COLOR5'>'$GRAD0' '
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_fire_setup "$@"
Index: Functions/Prompts/prompt_green_setup
===================================================================
RCS file: prompt_green_setup
diff -N prompt_green_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_green_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,18 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 333 262 261 260 333 262 261 260; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Created by Jim Foltz <aa204@acorn.net>
+# Changed by Spidey 08/06
+prompt_green_setup () {
+  PS1="%{$fg_green$bg_green$bold_color%}$char_333$char_262$char_261$char_260%{$fg_white$bg_green$bold_color%}%n@%m%{$reset_color$fg_green$bg_grey%}$char_333$char_262$char_261$char_260%{$fg_white$bg_grey$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%{$fg_green$bg_grey$bold_color%}%~/%{$reset_color%} "
+  PS2="%{$fg_green$bg_grey%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_green_setup "$@"
Index: Functions/Prompts/prompt_magenta_setup
===================================================================
RCS file: prompt_magenta_setup
diff -N prompt_magenta_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_magenta_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,18 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 333 262 261 260 333 262 261 260; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Created by Jim Foltz <aa204@acorn.net>
+# Changed by Spidey 08/06
+prompt_magenta_setup () {
+  PS1="%{$fg_magenta$bg_magenta$bold_color%}$char_333$char_262$char_261$char_260%{$fg_white$bg_magenta$bold_color%}%n@%m%{$reset_color$fg_magenta$bg_grey%}$char_333$char_262$char_261$char_260%{$fg_white$bg_grey$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%{$fg_magenta$bg_grey$bold_color%}%~/%{$reset_color%} "
+  PS2="%{$fg_magenta$bg_grey%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_magenta_setup "$@"
Index: Functions/Prompts/prompt_off_setup
===================================================================
RCS file: prompt_off_setup
diff -N prompt_off_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_off_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,11 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+# Very simple prompt
+prompt_off_setup () {
+  PS1="%# "
+  PS2="> "
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_off_setup "$@"
Index: Functions/Prompts/prompt_red_setup
===================================================================
RCS file: prompt_red_setup
diff -N prompt_red_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_red_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,18 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 333 262 261 260 333 262 261 260; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Created by Jim Foltz <aa204@acorn.net>
+# Changed by Spidey 08/06
+prompt_red_setup () {
+  PS1="%{$fg_red$bg_red$bold_color%}$char_333$char_262$char_261$char_260%{$fg_white$bg_red$bold_color%}%n@%m%{$reset_color$fg_red$bg_grey%}$char_333$char_262$char_261$char_260%{$fg_white$bg_grey$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%{$fg_red$bg_grey$bold_color%}%~/%{$reset_color%} "
+  PS2="%{$fg_red$bg_grey%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_red_setup "$@"
Index: Functions/Prompts/prompt_redhat_setup
===================================================================
RCS file: prompt_redhat_setup
diff -N prompt_redhat_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_redhat_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,13 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+# Red Hat Default Prompt
+# Styled like the default prompt in Red Hat 5.1
+#
+prompt_redhat_setup () {
+  PS1="[%n@%m %1~]\\$ "
+  PS2="> "
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_redhat_setup "$@"
Index: Functions/Prompts/prompt_suse_setup
===================================================================
RCS file: prompt_suse_setup
diff -N prompt_suse_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_suse_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,13 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+# SuSE Default Prompt
+# Styled like the default prompt in SuSE 5.2
+#
+prompt_suse_setup () {
+  PS1="%n@%m:%~/ > "
+  PS2="> "
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_suse_setup "$@"
Index: Functions/Prompts/prompt_white_setup
===================================================================
RCS file: prompt_white_setup
diff -N prompt_white_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_white_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,18 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 333 262 261 260 333 262 261 260; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Created by Jim Foltz <aa204@acorn.net>
+# Changed by Spidey 08/06
+prompt_white_setup () {
+  PS1="%{$fg_white$bg_white$bold_color%}$char_333$char_262$char_261$char_260%{$fg_white$bg_white$bold_color%}%n@%m%{$reset_color$fg_white$bg_grey%}$char_333$char_262$char_261$char_260%{$fg_white$bg_grey$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%{$fg_white$bg_grey$bold_color%}%~/%{$reset_color%} "
+  PS2="%{$fg_white$bg_grey%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_white_setup "$@"
Index: Functions/Prompts/prompt_yellow_setup
===================================================================
RCS file: prompt_yellow_setup
diff -N prompt_yellow_setup
--- /dev/null	Tue May  5 21:32:27 1998
+++ prompt_yellow_setup	Mon Oct  4 17:42:43 1999
@@ -0,0 +1,18 @@
+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
+
+for code in 333 262 261 260 333 262 261 260 333 262 261 260; do
+  local varname=char_$code
+  : ${(P)varname=$(echo -n "\\0$code")}
+done
+
+# Created by Jim Foltz <aa204@acorn.net>
+# Changed by Spidey 08/06
+prompt_yellow_setup () {
+  PS1="%{$fg_yellow$bg_yellow$bold_color%}$char_333$char_262$char_261$char_260%{$fg_white$bg_yellow$bold_color%}%n@%m%{$reset_color$fg_yellow$bg_grey%}$char_333$char_262$char_261$char_260%{$fg_white$bg_grey$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%{$fg_yellow$bg_grey$bold_color%}%~/%{$reset_color%} "
+  PS2="%{$fg_yellow$bg_grey%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
+
+  precmd () { }
+  preexec () { }
+}
+
+prompt_yellow_setup "$@"
Index: Functions/Prompts/promptinit
===================================================================
RCS file: promptinit
diff -N promptinit
--- /dev/null	Tue May  5 21:32:27 1998
+++ promptinit	Mon Oct  4 18:46:50 1999
@@ -0,0 +1,107 @@
+# zsh prompt themes extension
+#
+# Load with `autoload -U promptinit; promptinit'.
+
+prompt_themes=()
+typeset -gU prompt_themes
+typeset -g prompt_theme
+
+promptinit () {
+  emulate -L zsh
+  local ppath='' name
+
+  # Autoload all prompt_*_setup functions in fpath
+  for theme in $fpath/prompt_*_setup(N); do
+    if [[ $theme == */prompt_(#b)(*)_setup ]]; then
+      name="$match[1]"
+      if [[ -r "$theme" ]]; then
+        prompt_themes=($name $prompt_themes)
+        autoload -U prompt_${name}_setup
+      else
+        print "Couldn't find theme $theme" 
+      fi
+    else
+      print "eh?"
+    fi
+  done
+
+  # Color definitions come in handy
+  autoload -U colors
+  colors
+
+  # Variables common to all prompt styles
+  prompt_newline=$(echo -ne "\n%{\r%}")
+}
+
+prompt () {
+  local opt preview theme usage old_theme
+
+  usage='Usage: prompt <options>
+Options:
+    -l              List currently available prompt themes
+    -p [<themes>]   Preview given themes (defaults to all)
+    -h [<theme>]    Display help (for given theme)
+    -s <theme>      Set and save theme
+    <theme>         Switch to new theme immediately (changes not saved)'
+
+  getopts "hlps" opt
+  case "$opt" in
+    h) if [[ -n "$2" && -n $prompt_themes[(r)$2] ]]; then
+         if functions prompt_$2_help >/dev/null; then
+	   print "Help for $2 theme:\n"
+           prompt_$2_help
+         else
+           print "No help available for $2 theme"
+         fi
+       else
+         print "$usage"
+       fi
+       ;;
+    l) print Currently available prompt themes:
+       print $prompt_themes
+       return
+       ;;
+    p) if (( ! $+prompt_theme )); then
+         print "Cannot preview; current prompt is non-themeable and would"
+	 print "be destroyed."
+	 return
+       fi
+       preview=( $prompt_themes )
+       [[ -n "$2" && -n $prompt_themes[(r)$2] ]] && preview=( $*[2,-1] )
+       for theme in $preview; do
+         [[ $theme == $prompt_theme[1] ]] && continue
+         print "\nTheme: $theme"
+         prompt_${theme}_setup
+	 precmd
+	 print -n -P "${PS1}"
+	 preexec
+	 print "command arg1 arg2 ... argn"
+       done
+       print
+       prompt_${prompt_theme}_setup
+       ;;
+    s) print "Set and save not yet implemented.  Please ensure your ~/.zshrc"
+       print "contains something similar to the following:\n"
+       print "  autoload -U promptinit"
+       print "  promptinit"
+       print "  prompt $*[2,-1]"
+       ;;
+    *) if [[ -z "$1" || -z $prompt_themes[(r)$1] ]]; then
+         print "$usage"
+         return
+       fi
+       prompt_$1_setup "$*[2,-1]"
+       prompt_theme=( $* )
+
+       # Avoid screwing up the environment listing
+       PSZZZZ=$reset_color
+       RPSZZZZ=$reset_color
+       PROMPTZZZZ=$reset_color
+       RPROMPTZZZZ=$reset_color
+       promptzzzz=$reset_color
+       ;;
+  esac
+}
+
+promptinit "$@"
+
Index: Misc/bash2zshprompt
===================================================================
RCS file: bash2zshprompt
diff -N bash2zshprompt
--- /dev/null	Tue May  5 21:32:27 1998
+++ bash2zshprompt	Mon Oct  4 17:35:14 1999
@@ -0,0 +1,100 @@
+#!/usr/bin/perl -w
+#
+# exceedingly ugly hack to convert bashprompt themes to zshprompt themes
+# (bashprompt is at http://bash.current.nu/)
+#
+# Adam Spiers <adam@spiers.net>
+
+use strict;
+
+my @colours = qw/grey red green yellow blue magenta cyan white/;
+
+my @codes = ();
+my %bold;
+my $out = '';
+
+print "# Converted to zsh prompt theme by bash2zshprompt, written by <adam\@spiers.net>\n";
+
+my $seen_fn = 0;
+my $seen_fn_end = 0;
+while (<>) {
+  # Ugh
+  if (! $seen_fn) {
+    s/^\s*function (\w+) {\s*$/prompt_$1_setup () {\n/ and $seen_fn = $1;
+  }
+  # UGH
+  elsif (! $seen_fn_end && $seen_fn) {
+    s/^\s*/  /;
+    s/^\s*}\s*$/\n  precmd () { }\n  preexec () { }\n}\n/ and $seen_fn_end++;
+  }
+
+  s/\\\[/%{/g;
+  s/\\\]/%}/g;
+
+  s/\\033/\\e/g;
+  s/\\e\[([0-9;]+)m/split_codes($1)/eg;
+  s/\\e\[((\d?)(\d))m/color()/eg;
+
+  s/(?<!\\)\\u/%n/g;
+  s/(?<!\\)\\h/%m/g;
+  s/(?<!\\)\\t/%t/g;
+  s/(?<!\\)\\d/%D{%a %b %d}/g;
+  s/(?<!\\)\\?\$\(date\s+\+([^)]+)\)/%D{$1}/g;
+  s/(?<!\\)\\!/%!/g;
+  s/(?<!\\)\\#/%!/g; # hmmm
+  s/(?<!\\)\\n/\$prompt_newline/g;
+  s/(?<!\\)\\s/\$SHELL/g;
+  s/(?<!\\)\\w/%~/g;
+  s/(?<!\\)\\W/%1~/g;
+  s/(?<!\\)\\\$(?!\()/%\#/g;
+
+  s/(?<!\\)\\0?(\d{3})/push @codes, $1; "\$char_$1"/eg;
+
+  s/%}%{//g;
+
+  $out .= $_;
+}
+
+# Must be a better way of doing this
+print <<EOF if @codes;
+
+for code in @codes; do
+  local varname=char_\$code
+  : \${(P)varname=\$(echo -n "\\\\0\$code")}
+done
+
+EOF
+
+print $out;
+
+print qq!\nprompt_${seen_fn}_setup "\$@"\n! if $seen_fn;
+
+exit 0;
+
+sub color {
+  my @p = ($1, $2, $3);
+
+  my $fgbg = (($p[1] eq '3') ? 'fg' :
+              ($p[1] eq '4') ? 'bg' :
+              '???');
+
+  $bold{$fgbg} ||= '';
+
+  if ($p[0] =~ /^0?0$/) {
+    $bold{$fgbg} = '';
+    return '$reset_color';
+  }
+  
+  if ($p[0] =~ /^0?1$/) {
+    $bold{$fgbg} = 'bold_';
+    return '$bold_color';
+  }
+
+  return '$' .
+         "${fgbg}_$bold{$fgbg}" .
+         $colours[$p[2]];
+}
+
+sub split_codes {
+  join '', (map { "\\e\[${_}m" } (split m!;!, $_[0]));
+}


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-04 18:40 PATCH: prompt fun Adam Spiers
@ 1999-10-04 23:14 ` Bart Schaefer
  1999-10-04 23:36   ` Adam Spiers
  1999-10-05 11:31 ` Zefram
  1999-10-11 13:19 ` Andrej Borsenkow
  2 siblings, 1 reply; 18+ messages in thread
From: Bart Schaefer @ 1999-10-04 23:14 UTC (permalink / raw)
  To: zsh workers mailing list

On Oct 4,  7:40pm, Adam Spiers wrote:
> Subject: PATCH: prompt fun
> Here's a more light-hearted addition, which I've finally got round to
> turning into a releasable form -- themeable prompts.

This is cool, but it's the kind of thing that makes me repeat my suggestion
that things like this (and most of the more esoteric bits of the completion
system) should be packaged and supported separately from the shell itself.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-04 23:14 ` Bart Schaefer
@ 1999-10-04 23:36   ` Adam Spiers
  1999-10-05  1:48     ` Mike Fletcher
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Spiers @ 1999-10-04 23:36 UTC (permalink / raw)
  To: zsh workers mailing list

Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> On Oct 4,  7:40pm, Adam Spiers wrote:
> > Subject: PATCH: prompt fun
> > Here's a more light-hearted addition, which I've finally got round to
> > turning into a releasable form -- themeable prompts.
> 
> This is cool, but it's the kind of thing that makes me repeat my suggestion
> that things like this (and most of the more esoteric bits of the completion
> system) should be packaged and supported separately from the shell itself.

Yes, I've been thinking about these issues myself, although I always
tend to come down on the side in favour of packaging it all together.
I really like the idea of one `super-shell' which has all the good
stuff bundled with it.  Why?  Hmm.  I suppose because:

  - separate packages for one shell is quite fiddly and very likely to
    put people off (I've had enormous problems persuading highly
    intelligent, open-minded friends that even changing /from/ /tcsh/
    is worth the hassle), and so it seems important that the install
    path is made as smooth as possible.

  - zsh's main characteristic, for me, is that it's jam-packed with
    loads of great extra features.  I suspect that many people view it
    in that light, and download it because they want all those extras,
    rather than because they want a standard UNIX shell with a
    slightly different flavour.  Hence, it seems rather perverse to
    download and install zsh and then have to download and install
    other packages before you have all the bonus goodies.  [As an
    aside along the same argument, it seems a shame that most of zsh's
    bells and whistles aren't enabled by default, but I suppose there
    are strong backwards compatability arguments for this, and that
    individual distributions can enable them.  We've already seen this
    happening with the new completion system and Mandrake Linux, in
    fact.]

  - Improvements to (say) the new completion system very often go
    hand-in-hand with improvements/bugfixes to the C source, so
    splitting up this parallel development would probably cause more
    a lot more problems than it would solve.

  - zsh is hardly bloatware, and shows no danger of becoming even
    remotely close IMO.

However, there are obviously cons to the single package argument too,
which is probably shown up at its most absurd when k3wl_d0oD ANSI PS1
strings end up inside the main source tree.  I'm not sure what the
best answer is, but my instincts would say a compromise - include a
few nice prompts catering for a wide range of tastes, and then leave
the rest to the IRC kiddies (hmm, that's me I guess) to work on.  That
was the approach I tried to take with this prompt patch.

Thoughts?


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-04 23:36   ` Adam Spiers
@ 1999-10-05  1:48     ` Mike Fletcher
  0 siblings, 0 replies; 18+ messages in thread
From: Mike Fletcher @ 1999-10-05  1:48 UTC (permalink / raw)
  To: Adam Spiers; +Cc: zsh workers mailing list

>>>>> "Adam" == Adam Spiers <adam@thelonious.new.ox.ac.uk> writes:

    Adam> However, there are obviously cons to the single package
    Adam> argument too, which is probably shown up at its most absurd
    Adam> when k3wl_d0oD ANSI PS1 strings end up inside the main
    Adam> source tree.  I'm not sure what the best answer is, but my
    Adam> instincts would say a compromise - include a few nice
    Adam> prompts catering for a wide range of tastes, and then leave
    Adam> the rest to the IRC kiddies (hmm, that's me I guess) to work
    Adam> on.  That was the approach I tried to take with this prompt
    Adam> patch.

        What if there were some well defined mechanism for packaging a 
(for lack of a better term) zsh add-on.  Something sort of similar to
the CPAN.pm module for perl (for those not familiar with perl, CPAN is 
the Comprehensive Perl Archive Network and CPAN.pm is a module that
will automagically download, compile, and install additional perl
modules).  This hypothetical program could be pointed at an
apropriately structured http/ftp site (part of the hypothetical
Comprehensive Zsh ARchive, or CZAR :) and told to grab and install J.
Random Hax0r's k-R4d shell prompts or the most up to date zftp module
source.

        Or maybe that's overkill. :)

        At the minimum, if there's going to be separately packaged
components something like the glib/gtk+/gnome x-config scripts would
be nice (again for those not familiar, these packages ship with a
shell script that is installed in $(installdir)/bin that can be run to 
get compile and link options suitable for linking against the library
in question).  After market zsh addins could use zsh-config to find
the location of the Functions directory, or headers for compiling
loadable modules against, or what not.

        Just some random thoughts.

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch@phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
678 443-6239(w)       |  scary questions." -- Jules                =(___)=
                      |                                               U


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-04 18:40 PATCH: prompt fun Adam Spiers
  1999-10-04 23:14 ` Bart Schaefer
@ 1999-10-05 11:31 ` Zefram
  1999-10-06 20:58   ` Adam Spiers
  1999-10-11 13:19 ` Andrej Borsenkow
  2 siblings, 1 reply; 18+ messages in thread
From: Zefram @ 1999-10-05 11:31 UTC (permalink / raw)
  To: adam; +Cc: zsh-workers

Adam Spiers wrote:
>+fg_magenta="$(echo -n '\e[35m')"

  fg_magenta=$'\e[35m'

and so on.

>+++ prompt_yellow_setup	Mon Oct  4 17:42:43 1999
>@@ -0,0 +1,18 @@
>+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
>+# Created by Jim Foltz <aa204@acorn.net>
>+# Changed by Spidey 08/06

What's the copyright on these?

-zefram


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-05 11:31 ` Zefram
@ 1999-10-06 20:58   ` Adam Spiers
  1999-10-07 10:43     ` Zefram
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Spiers @ 1999-10-06 20:58 UTC (permalink / raw)
  To: zsh-workers

Zefram (zefram@fysh.org) wrote:
> Adam Spiers wrote:
> >+fg_magenta="$(echo -n '\e[35m')"
> 
>   fg_magenta=$'\e[35m'
> 
> and so on.

Ah, nice; thanks.

> >+++ prompt_yellow_setup	Mon Oct  4 17:42:43 1999
> >@@ -0,0 +1,18 @@
> >+# Converted to zsh prompt theme by bash2zshprompt, written by <adam@spiers.net>
> >+# Created by Jim Foltz <aa204@acorn.net>
> >+# Changed by Spidey 08/06
> 
> What's the copyright on these?

The website says nothing about copyright or licensing whatsoever.
freshmeat reckons it's GPLed.  I just mailed the list to ask.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-06 20:58   ` Adam Spiers
@ 1999-10-07 10:43     ` Zefram
  1999-10-07 13:29       ` bashprompt license (was Re: PATCH: prompt fun) Adam Spiers
  1999-10-07 16:45       ` PATCH: prompt fun Clint Adams
  0 siblings, 2 replies; 18+ messages in thread
From: Zefram @ 1999-10-07 10:43 UTC (permalink / raw)
  To: adam; +Cc: zsh-workers

Adam Spiers wrote:
>The website says nothing about copyright or licensing whatsoever.
>freshmeat reckons it's GPLed.  I just mailed the list to ask.

If the code is GPLed, it can't be used in zsh.  The zsh license is
marginally inconsistent with the GPL.  (It has almost the same effect
as the GPL in itself; it's just that the GPL requires redistribution
under the GPL.)

-zefram


^ permalink raw reply	[flat|nested] 18+ messages in thread

* bashprompt license (was Re: PATCH: prompt fun)
  1999-10-07 10:43     ` Zefram
@ 1999-10-07 13:29       ` Adam Spiers
  1999-10-07 14:19         ` Bart Schaefer
  1999-10-07 16:45       ` PATCH: prompt fun Clint Adams
  1 sibling, 1 reply; 18+ messages in thread
From: Adam Spiers @ 1999-10-07 13:29 UTC (permalink / raw)
  To: zsh-workers

Zefram (zefram@fysh.org) wrote:
> Adam Spiers wrote:
> >The website says nothing about copyright or licensing whatsoever.
> >freshmeat reckons it's GPLed.  I just mailed the list to ask.
> 
> If the code is GPLed, it can't be used in zsh.  The zsh license is
> marginally inconsistent with the GPL.  (It has almost the same effect
> as the GPL in itself; it's just that the GPL requires redistribution
> under the GPL.)

Just got email from the bashprompt guy saying that there's no license
on it at all and we're free to use it in any way we wish.  He also
said that if it made it easier for us to choose a license for it, he'd
put it under that (provided it was in the spirit of free software of
course).


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: bashprompt license (was Re: PATCH: prompt fun)
  1999-10-07 13:29       ` bashprompt license (was Re: PATCH: prompt fun) Adam Spiers
@ 1999-10-07 14:19         ` Bart Schaefer
  1999-10-07 15:25           ` Oliver Kiddle
  0 siblings, 1 reply; 18+ messages in thread
From: Bart Schaefer @ 1999-10-07 14:19 UTC (permalink / raw)
  To: zsh-workers

On Oct 7,  2:29pm, Adam Spiers wrote:
} Subject: bashprompt license (was Re: PATCH: prompt fun)
}
} Just got email from the bashprompt guy saying that there's no license
} on it at all and we're free to use it in any way we wish.

That should be fine as is, then; make a note of that somewhere (maybe
add a Functions/README.prompts file?).  If they ever do get under a GPL
style license, all we have to do is stop copying them into the dist and
make people grab & convert them with the perl program.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: bashprompt license (was Re: PATCH: prompt fun)
  1999-10-07 14:19         ` Bart Schaefer
@ 1999-10-07 15:25           ` Oliver Kiddle
  0 siblings, 0 replies; 18+ messages in thread
From: Oliver Kiddle @ 1999-10-07 15:25 UTC (permalink / raw)
  To: Zsh workers

Bart Schaefer wrote:

> That should be fine as is, then; make a note of that somewhere (maybe
> add a Functions/README.prompts file?).  If they ever do get under a GPL
> style license, all we have to do is stop copying them into the dist and
> make people grab & convert them with the perl program.

If we've been supplied with them now by the author (and copyright owner) without the GPL license then we can't be affected by any future change of license that the author chooses to distribute them under. The only thing we couldn't do is incorporate changes that have only been distributed to us under the GPL. I would however agree that it would be wise to include a README to clarify that what we have isn't GPL encumbered.

Oliver Kiddle


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-07 10:43     ` Zefram
  1999-10-07 13:29       ` bashprompt license (was Re: PATCH: prompt fun) Adam Spiers
@ 1999-10-07 16:45       ` Clint Adams
  1999-10-07 16:49         ` Zefram
  1 sibling, 1 reply; 18+ messages in thread
From: Clint Adams @ 1999-10-07 16:45 UTC (permalink / raw)
  To: Zefram; +Cc: adam, zsh-workers

> If the code is GPLed, it can't be used in zsh.  The zsh license is
> marginally inconsistent with the GPL.  (It has almost the same effect
> as the GPL in itself; it's just that the GPL requires redistribution
> under the GPL.)

Are you referring to the license in Makefile.in following
# Copyright (c) 1995-1997 Richard Coleman
or something else?


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-07 16:45       ` PATCH: prompt fun Clint Adams
@ 1999-10-07 16:49         ` Zefram
  1999-10-07 17:03           ` Clint Adams
  0 siblings, 1 reply; 18+ messages in thread
From: Zefram @ 1999-10-07 16:49 UTC (permalink / raw)
  To: Clint Adams; +Cc: zefram, adam, zsh-workers

Clint Adams wrote:
>Are you referring to the license in Makefile.in following
># Copyright (c) 1995-1997 Richard Coleman

Yes, that's the zsh license.

-zefram


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-07 16:49         ` Zefram
@ 1999-10-07 17:03           ` Clint Adams
  1999-10-07 17:06             ` Zefram
  0 siblings, 1 reply; 18+ messages in thread
From: Clint Adams @ 1999-10-07 17:03 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> Yes, that's the zsh license.

So the authors of such additions could easily put their code under
the GPL with a special provision to allow inclusion by zsh.

Shouldn't the copyright be updated?


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-07 17:03           ` Clint Adams
@ 1999-10-07 17:06             ` Zefram
  0 siblings, 0 replies; 18+ messages in thread
From: Zefram @ 1999-10-07 17:06 UTC (permalink / raw)
  To: Clint Adams; +Cc: zefram, zsh-workers

Clint Adams wrote:
>So the authors of such additions could easily put their code under
>the GPL with a special provision to allow inclusion by zsh.

It's simpler than that.  If they distribute the files under the zsh
license, or anything allowing redistribution under the zsh license (such
as making it completely public domain), then we can distribute the files
with zsh under the zsh license.  This doesn't stop them also distributing
the same files under the GPL or any other license.  (Perl, for example,
is simultaneously distributed under the Artistic license and the GPL.)

-zefram


^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: PATCH: prompt fun
  1999-10-04 18:40 PATCH: prompt fun Adam Spiers
  1999-10-04 23:14 ` Bart Schaefer
  1999-10-05 11:31 ` Zefram
@ 1999-10-11 13:19 ` Andrej Borsenkow
  1999-10-11 16:39   ` Bart Schaefer
  2 siblings, 1 reply; 18+ messages in thread
From: Andrej Borsenkow @ 1999-10-11 13:19 UTC (permalink / raw)
  To: Adam Spiers, zsh workers mailing list

>
> Index: Completion/User/_prompt
> ===================================================================
> RCS file: _prompt
> diff -N _prompt
> --- /dev/null	Tue May  5 21:32:27 1998
> +++ _prompt	Mon Oct  4 18:04:35 1999

and so on

I cannot apply this patch. It creates lots of files in top-level directory. Even
with Tanaka's --use-index-line patch for patch. This is consistent - in
non-POSIX mode patch selects file name with the least number of slashes. And in
POSIX mode it won't create files.

There are more and more people using CVS on this list ... may be, we should come
up with a single patch format? This includes -p0/-p1 problem as well :-)

/andrej


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-11 13:19 ` Andrej Borsenkow
@ 1999-10-11 16:39   ` Bart Schaefer
  1999-10-11 21:30     ` Adam Spiers
  0 siblings, 1 reply; 18+ messages in thread
From: Bart Schaefer @ 1999-10-11 16:39 UTC (permalink / raw)
  To: zsh workers mailing list

On Oct 11,  5:19pm, Andrej Borsenkow wrote:
} Subject: RE: PATCH: prompt fun
}
} I cannot apply this patch. It creates lots of files in top-level directory.
[...]
} non-POSIX mode patch selects file name with the least number of slashes.
} And in POSIX mode it won't create files.

Run the "cvs diff" output through this:

	sed -e '/^RCS/,/^---/d' -e '/^\+\+\+/d'

That will strip all file name lines other than the Index: line, forcing the
patch to apply correctly in non-POSIX mode, and it should work for both
context and unified diffs.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-11 16:39   ` Bart Schaefer
@ 1999-10-11 21:30     ` Adam Spiers
  1999-10-11 22:47       ` Bart Schaefer
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Spiers @ 1999-10-11 21:30 UTC (permalink / raw)
  To: zsh workers mailing list

Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> On Oct 11,  5:19pm, Andrej Borsenkow wrote:
> } Subject: RE: PATCH: prompt fun
> }
> } I cannot apply this patch. It creates lots of files in top-level directory.
> [...]
> } non-POSIX mode patch selects file name with the least number of slashes.
> } And in POSIX mode it won't create files.
> 
> Run the "cvs diff" output through this:
> 
> 	sed -e '/^RCS/,/^---/d' -e '/^\+\+\+/d'
> 
> That will strip all file name lines other than the Index: line, forcing the
> patch to apply correctly in non-POSIX mode, and it should work for both
> context and unified diffs.

Will do from now on ...

What if a line within the hunk begins with `--' or `++' though?


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: PATCH: prompt fun
  1999-10-11 21:30     ` Adam Spiers
@ 1999-10-11 22:47       ` Bart Schaefer
  0 siblings, 0 replies; 18+ messages in thread
From: Bart Schaefer @ 1999-10-11 22:47 UTC (permalink / raw)
  To: Adam Spiers; +Cc: zsh workers mailing list

On Mon, 11 Oct 1999, Adam Spiers wrote:

> Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> > 
> > Run the "cvs diff" output through this:
> > 
> > 	sed -e '/^RCS/,/^---/d' -e '/^\+\+\+/d'
> 
> What if a line within the hunk begins with `--' or `++' though?

Removed lines beginning with "--" shouldn't be a problem, as there won't
be more than one line beginning with "RCS" for any file, and there must be
a line beginning with "---" above all hunks for each file in either diff
format.

Added lines beginning with "++" would cause patch to fail with a warning
about a malformed diff.  I think that's probably a pretty rare occurrence
(since we're almost exclusively patching shell script and C source), but
you could make the pattern more detailed if you're concerned:

    -e '/^\+\+\+ .* [0-9]+:[0-9]+:[0-9]+/d'

That forces there to be a space after the "+++" and something that looks
like a time on the line as well.  Get as precise as you like ...


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~1999-10-11 22:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-04 18:40 PATCH: prompt fun Adam Spiers
1999-10-04 23:14 ` Bart Schaefer
1999-10-04 23:36   ` Adam Spiers
1999-10-05  1:48     ` Mike Fletcher
1999-10-05 11:31 ` Zefram
1999-10-06 20:58   ` Adam Spiers
1999-10-07 10:43     ` Zefram
1999-10-07 13:29       ` bashprompt license (was Re: PATCH: prompt fun) Adam Spiers
1999-10-07 14:19         ` Bart Schaefer
1999-10-07 15:25           ` Oliver Kiddle
1999-10-07 16:45       ` PATCH: prompt fun Clint Adams
1999-10-07 16:49         ` Zefram
1999-10-07 17:03           ` Clint Adams
1999-10-07 17:06             ` Zefram
1999-10-11 13:19 ` Andrej Borsenkow
1999-10-11 16:39   ` Bart Schaefer
1999-10-11 21:30     ` Adam Spiers
1999-10-11 22:47       ` Bart Schaefer

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).