zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: prompt theme system improvements
@ 1999-11-18 14:53 Adam Spiers
  1999-11-18 15:43 ` Adam Spiers
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Adam Spiers @ 1999-11-18 14:53 UTC (permalink / raw)
  To: zsh workers mailing list

OK, finally here's a patch to the prompt system which vastly improves
it.  After applying the patch, you should remove the following from
Functions/Prompts:

  prompt_{white,red,green,yellow,blue,cyan,magenta,combo}_setup

if the patch didn't succeed in getting rid of them.  (The patch was
made for copies of Tanaka's CVS archive, by the way.)

To get a very quick feeling of the changes, fire up a black background
terminal, preferably with the `nexus' or `vga' font or similar, type
`prompt -p' and gasp in horror at the tasteless colour combinations.


Changes in full gory detail:
----------------------------

  - Colours are now all in assoc arrays.

  - `prompt -c' shows current theme (with parameters if any).

  - All the {red,green,blue,...} themes merged into one fully
    colour-scheme-able `fade' theme.

  - `combo' theme converted to colour-scheme-able `bigfade' theme.

  - `adam1', `fire', `elite' and `elite2' made colour-scheme-able.

  - Added some more help texts for individual themes.

  - Mentioned that dark backgrounds work best in help texts.
  
  - If a theme defines a prompt_$themename_preview function, when that
    theme is being previewed, that function gets invoked rather than
    the normal previewing, which allows a colour-scheme-able theme to
    show more than one colour scheme for its preview.

  - Previewing semantics changed:
      + If no words specified after `-p', preview all themes.
      + If words specified after `-p', treat each word as a theme plus
        its arguments, and preview it accordingly.

  - Use of $'' instead of $(echo -n "") hack wherever possible.

  - Needless use of $(echo "") elsewhere removed.

  - Added zefram's prompt.

  - Fixed bug in Oliver's prompt; it doesn't work if you don't set up
    anything relating to it.  The guilty line is:

      local pcol="$'\e['${1:-${pcolour[${HOST:=`hostname`}]:-33}}m"

    If pcolour is non-existent or not declared as associative, the
    ${pcolour}[${HOST:=`hostname`}] bit barfs if ${HOST:=`hostname`}
    contains a `.' in it, which is quite likely.  So you need check
    the value of ${(t)pcolour} before doing this assignment.  This
    applies to tcolour too, of course.

  - There is now a pseudo-theme called `random'.  It defaults to
    picking randomly from all available themes (but without any
    supplied parameters to any), but if you give it arguments, each
    argument word will be treated as a theme with arguments.  For
    example:

      % prompt random "elite2 green" "elite2 blue" fire

    The `random' theme does not work in preview mode.

  - Other improvements I can't remember.


Known bugs:
-----------

  - I notice that the _prompt completion function no longer works,
    presumably through one of the many changes to arguments.  I'll try
    to fix this unless someone gets there first.

  - Some of the colours are tasteless.  Beauty is in the eye of the
    beholder ...  Contributions from graphic designers/artists welcome :-)

  - It would be nice to be able control the `bold-ness' of the colours
    provided as theme provided.

  - precmd and preexec still get stomped on.  I think the solution to
    this is to use Bart's addprecmd to add a hook to them both which
    calls prompt_pre{cmd,exec} respectively the first time promptinit
    is run, and then subsequent theme changes can alter these hook
    functions without messing up the original pre{cmd,exec}.  Does
    that sound reasonable?


Unknown bugs: 
-------------

  - There are many changes here, so there may be a few problems
    created.  Please test!

Adam

begin 664 promptpatch.gz
M'XL(""P2-#@"`W!R;VUP='!A=&-H`.Q=[W;;MI+_?/44B"Q=V95IBQ3M.*J=
M.DG3)KMMDI-TMV?7UG$HB9)X(Y&Z)&7'<95GNQ_Z%/=I=@8`21`$*>J/F_1L
M>QI+`F8&F`'PPV`PE`;.<$BTN?^*:!_)-\_^^]TW],UG<CCVIO;AQ.M;$VM@
M38/#3\'X\(>YVP\=SPT.?W:"_F'?FWA^0`Z]69A?7=$TC2AK_O;+>$Y>>==$
M/R&ZV=$?=723Z(\>/:HTF\T<EG=6R%C:1#<ZYL/.T2/&<GY.-'W_^"%IZOLG
M1^3\O$)VR)MY2(+0<@>6/R!/7KU[2:@8^#NP`^*XQ':O'=]SI[8;DB%4V%9P
M2^:!7=$JQ+<#.[RB#&>UQJ5]T9HV*J3G309BH8Z%V-8/GF^/?&_N#N"S-AQ=
MC7S[EM&TD1.+?'O`2W1>`D2VR\L,7G9K3R;>#2]L\\+>9&[S(I,73:T1]-OB
MI4>\M']K10*/>='-V`DCYH=81DM=[XHJD_2S]6W<TZ@R[C'4Z5*=T'>H-:1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F`L_YL@N<B<<,098O>G9%AI`P:R)*C;3DZ:OM@6WS_&=H8S;A()TD[\%C;
M&DN-:DR6^+OOZKO;M]BW;_BQ9I_[@\K6+E$)#U2*DP.SLCM'@]N1[QVE%GG.
MA:^%WPDZ'1!]S>-$1\B`KC,P`,7%KP[:,`@`82@-/IR8JN,"X4\OSE]_>,]L
M&(E!AKFL1</24$%\%T1^U3-@\4K^6M>U6H<_P-M'O8XZHUS=*[X0>[GP50#J
MFTRM-NXJLF)D%42B8TP+K6XYE#WV8I'%L&-&>81RS(`,"G:4+N(\2^F^=@*'
M2&@J<3Y>?(&?GAYHYI$0/Z`@TJ&,C3+J1S]?T$&''`))383ITHQ#K(9PXFJ/
M\K;(M6I3Y&XMYM%8_:D1NCH=5.)WIBJ3-Y:TXJZ^YA?7N"C;#CO@E<J%<;1Z
KL=:Q7HFZL?+7M0LAO`A])+H7H6*2&N6'O`@]:XTBBQ2I_`\D6KQ<K:``````
`
end


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

* Re: PATCH: prompt theme system improvements
  1999-11-18 14:53 PATCH: prompt theme system improvements Adam Spiers
@ 1999-11-18 15:43 ` Adam Spiers
  1999-11-18 17:51 ` Bart Schaefer
  1999-11-19 11:42 ` Oliver Kiddle
  2 siblings, 0 replies; 10+ messages in thread
From: Adam Spiers @ 1999-11-18 15:43 UTC (permalink / raw)
  To: zsh workers mailing list

Adam Spiers, on thelonious (adam@thelonious.new.ox.ac.uk) wrote:
> OK, finally here's a patch to the prompt system which vastly improves
> it.

I forgot Misc/bash2zshprompt.  Doh.

Index: Misc/bash2zshprompt
===================================================================
RCS file: /projects/zsh/zsh/Misc/bash2zshprompt,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 bash2zshprompt
--- Misc/bash2zshprompt	1999/10/15 13:07:14	1.1.1.3
+++ Misc/bash2zshprompt	1999/11/18 15:42:04
@@ -10,7 +10,7 @@
 my @colours = qw/grey red green yellow blue magenta cyan white/;
 
 my @codes = ();
-my %bold;
+my %boldp;
 my $out = '';
 
 print "# Converted to zsh prompt theme by bash2zshprompt, written by <adam\@spiers.net>\n";
@@ -80,21 +80,22 @@
               ($p[1] eq '4') ? 'bg' :
               '???');
 
-  $bold{$fgbg} ||= '';
+  $boldp{$fgbg} ||= '';
 
   if ($p[0] =~ /^0?0$/) {
-    $bold{$fgbg} = '';
+    $boldp{$fgbg} = '';
     return '$reset_color';
   }
   
   if ($p[0] =~ /^0?1$/) {
-    $bold{$fgbg} = 'bold_';
+    $boldp{$fgbg} = 'bold_';
     return '$bold_color';
   }
 
   return '$' .
-         "${fgbg}_$bold{$fgbg}" .
-         $colours[$p[2]];
+         "${fgbg}$boldp{$fgbg}\[" .
+         $colours[$p[2]] .
+         ']';
 }
 
 sub split_codes {


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

* Re: PATCH: prompt theme system improvements
  1999-11-18 14:53 PATCH: prompt theme system improvements Adam Spiers
  1999-11-18 15:43 ` Adam Spiers
@ 1999-11-18 17:51 ` Bart Schaefer
  1999-11-19  1:51   ` Adam Spiers
  1999-11-19 11:42 ` Oliver Kiddle
  2 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 1999-11-18 17:51 UTC (permalink / raw)
  To: Adam Spiers, zsh workers mailing list

On Nov 18,  2:53pm, Adam Spiers wrote:
} Subject: PATCH: prompt theme system improvements
}
} OK, finally here's a patch to the prompt system which vastly improves
} it.

I was just fooling with this, and after running

	prompt -p

I get the message

	set_prompt: command not found: prompt__setup [71]

and I'm left with the "adam1 theme" prompt, which happens to be the last
one previewed.

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


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

* Re: PATCH: prompt theme system improvements
  1999-11-18 17:51 ` Bart Schaefer
@ 1999-11-19  1:51   ` Adam Spiers
  1999-11-19 10:29     ` Tanaka Akira
  0 siblings, 1 reply; 10+ messages in thread
From: Adam Spiers @ 1999-11-19  1:51 UTC (permalink / raw)
  To: zsh workers mailing list

Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> On Nov 18,  2:53pm, Adam Spiers wrote:
> } Subject: PATCH: prompt theme system improvements
> }
> } OK, finally here's a patch to the prompt system which vastly improves
> } it.
> 
> I was just fooling with this, and after running
> 
> 	prompt -p
> 
> I get the message
> 
> 	set_prompt: command not found: prompt__setup [71]

Doh.  The

    p) if (( ! $+prompt_theme )); then
         print "Cannot preview; current prompt is non-themeable and would"
         print "be destroyed."
         return
       fi

bit should have caught this, but I'd already declared prompt_theme so
the test went wrong.

However, it's pretty bad that you can't preview any themes until
you're using one, so this patch changes that, and restores PS[1-4],
RPS1 and pre{cmd,exec} to their original values after the preview if
$prompt_theme wasn't set.

It also fixes some other bugs I found.

N.B. I forgot to mention that that last patch added the following files:

  Functions/Prompts/prompt_bigfade_setup
  Functions/Prompts/prompt_fade_setup
  Functions/Prompts/prompt_zefram_setup

Tanaka, can you please add them to the CVS repository?  Sorry!  The
following patch also fixes the relevant .distfiles.

Index: Functions/Prompts/.distfiles
===================================================================
RCS file: /projects/zsh/zsh/Functions/Prompts/.distfiles,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 .distfiles
--- Functions/Prompts/.distfiles	1999/11/03 09:06:29	1.1.1.2
+++ Functions/Prompts/.distfiles	1999/11/19 01:46:15
@@ -1,9 +1,8 @@
 DISTFILES_SRC='
     .distfiles
-    prompt_elite2_setup prompt_red_setup prompt_adam1_setup
+    prompt_elite2_setup prompt_adam1_setup prompt_fade_setup
     prompt_elite_setup prompt_redhat_setup prompt_adam2_setup
-    prompt_fire_setup prompt_suse_setup prompt_blue_setup
-    prompt_green_setup prompt_white_setup prompt_combo_setup
-    prompt_magenta_setup prompt_yellow_setup prompt_cyan_setup
-    prompt_oliver_setup prompt_off_setup promptinit
+    prompt_fire_setup prompt_suse_setup prompt_bigfade_setup
+    prompt_oliver_setup prompt_off_setup prompt_zefram_setup
+    promptinit
 '
Index: Functions/Prompts/prompt_adam2_setup
===================================================================
RCS file: /projects/zsh/zsh/Functions/Prompts/prompt_adam2_setup,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 prompt_adam2_setup
--- Functions/Prompts/prompt_adam2_setup	1999/11/18 15:15:27	1.1.1.3
+++ Functions/Prompts/prompt_adam2_setup	1999/11/19 01:46:16
@@ -46,20 +46,17 @@
   # This is a cute hack.  Well I like it, anyway.
   prompt_gfx_bbox_to_mbox=$(print -n "%{\e[A\r$fg_bold[$prompt_adam2_color1]${prompt_gfx_mlc}$fg_no_bold[$prompt_adam2_color1]${prompt_gfx_hyphen}\e[B%}")
 
-  prompt_l_paren=$'%{$fg_bold[grey]%}('
-  prompt_r_paren=$'%{$fg_bold[grey]%})'
+  prompt_l_paren="%{$fg_bold[grey]%}("
+  prompt_r_paren="%{$fg_bold[grey]%})"
 
-  prompt_l_bracket=$'%{$fg_bold[grey]%}['
-  prompt_r_bracket=$'%{$fg_bold[grey]%}]'
-
   prompt_machine="%{$fg_no_bold[$prompt_adam2_color3]%}%n%{$fg_bold[$prompt_adam2_color3]%}@%{$fg_no_bold[$prompt_adam2_color3]%}%m"
 
   prompt_padding_text=`perl -e "print qq{${prompt_gfx_hyphen}} x 200"`
 
   prompt_line_1a="$prompt_gfx_tbox$prompt_l_paren%{$fg_bold[$prompt_adam2_color2]%}%~$prompt_r_paren%{$fg_no_bold[$prompt_adam2_color1]%}"
-  prompt_line_1a_no_color=$(echo "$prompt_line_1a" | perl -pe "s/%{.*?%}//g")
+  prompt_line_1a_no_color=$(echo "$prompt_line_1a" | perl -pe 's/%{.*?%}//g')
   prompt_line_1b="$prompt_l_paren$prompt_machine$prompt_r_paren%{$fg_no_bold[$prompt_adam2_color1]%}${prompt_gfx_hyphen}"
-  prompt_line_1b_no_color=$(echo "$prompt_line_1b" | perl -pe "s/%{.*?%}//g")
+  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]%}"
 
Index: Functions/Prompts/prompt_fire_setup
===================================================================
RCS file: /projects/zsh/zsh/Functions/Prompts/prompt_fire_setup,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 prompt_fire_setup
--- Functions/Prompts/prompt_fire_setup	1999/11/18 15:15:27	1.1.1.3
+++ Functions/Prompts/prompt_fire_setup	1999/11/19 01:46:16
@@ -43,7 +43,7 @@
   local COLOR6="%{$bold_color$fg[$date]$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' '
+  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 () { setopt promptsubst }
Index: Functions/Prompts/promptinit
===================================================================
RCS file: /projects/zsh/zsh/Functions/Prompts/promptinit,v
retrieving revision 1.1.1.8
diff -u -r1.1.1.8 promptinit
--- Functions/Prompts/promptinit	1999/11/18 15:15:27	1.1.1.8
+++ Functions/Prompts/promptinit	1999/11/19 01:46:28
@@ -81,10 +81,11 @@
        print $prompt_themes
        return
        ;;
-    p) if (( ! $+prompt_theme )); then
-         print "Cannot preview; current prompt is non-themeable and would"
-         print "be destroyed."
-         return
+    p) if [[ -z "$prompt_theme[1]" ]]; then
+         # Not using a prompt theme; save settings
+         prompt_non_theme=( "$PS1" "$PS2" "$PS3" "$PS4" "$RPS1" )
+         prompt_old_precmd="$(functions precmd)"
+         prompt_old_preexec="$(functions preexec)"
        fi
        preview=( $prompt_themes )
        (( $#* > 1 )) && preview=( "$@[2,-1]" )
@@ -97,10 +98,10 @@
          fi
          print
 
-	 # The next line is a bit ugly.  It (perhaps unnecessarily)
-	 # runs the prompt theme setup function to ensure that if
-	 # the theme has a _preview function that it's been autoloaded.
-	 prompt_${theme_args[1]}_setup
+         # The next line is a bit ugly.  It (perhaps unnecessarily)
+         # runs the prompt theme setup function to ensure that if
+         # the theme has a _preview function that it's been autoloaded.
+         prompt_${theme_args[1]}_setup
 
          if functions prompt_${theme_args[1]}_preview >&/dev/null; then
            prompt_${theme_args[1]}_preview "${(@)theme_args[2,-1]}"
@@ -109,7 +110,25 @@
          fi
        done
        print
-       prompt_${prompt_theme[1]}_setup "${(@)prompt_theme[2,-1]}"
+       if [[ -z "$prompt_theme[1]" ]]; then
+         PS1="$prompt_non_theme[1]"
+         PS2="$prompt_non_theme[2]"
+         PS3="$prompt_non_theme[3]"
+         PS4="$prompt_non_theme[4]"
+         RPS1="$prompt_non_theme[5]"
+         if [[ -z "$prompt_old_precmd" ]]; then
+           precmd () { }
+         else
+           eval "$prompt_old_precmd"
+         fi
+         if [[ -z "$prompt_old_preexec" ]]; then
+           preexec () { }
+         else
+           eval "$prompt_old_preexec"
+         fi
+       else
+         prompt_${prompt_theme[1]}_setup "${(@)prompt_theme[2,-1]}"
+       fi
        ;;
     s) print "Set and save not yet implemented.  Please ensure your ~/.zshrc"
        print "contains something similar to the following:\n"
@@ -118,12 +137,12 @@
        print "  prompt $*[2,-1]"
        ;;
     *) if [[ "$1" == 'random' ]]; then
-	 local random_themes
-	 if (( $#* == 1 )); then
-	   random_themes=( $prompt_themes )
-	 else
-	   random_themes=( "$@[2,-1]" )
-	 fi
+         local random_themes
+         if (( $#* == 1 )); then
+           random_themes=( $prompt_themes )
+         else
+           random_themes=( "$@[2,-1]" )
+         fi
          local i=$(( ( $RANDOM % $#random_themes ) + 1 ))
          argv=( "${=random_themes[$i]}" )
        fi


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

* Re: PATCH: prompt theme system improvements
  1999-11-19  1:51   ` Adam Spiers
@ 1999-11-19 10:29     ` Tanaka Akira
  0 siblings, 0 replies; 10+ messages in thread
From: Tanaka Akira @ 1999-11-19 10:29 UTC (permalink / raw)
  To: zsh workers mailing list

In article <19991119015143.A29956@thelonious.new.ox.ac.uk>,
  Adam Spiers <adam@thelonious.new.ox.ac.uk> writes:

> N.B. I forgot to mention that that last patch added the following files:
> 
>   Functions/Prompts/prompt_bigfade_setup
>   Functions/Prompts/prompt_fade_setup
>   Functions/Prompts/prompt_zefram_setup
> 
> Tanaka, can you please add them to the CVS repository?  Sorry!  The
> following patch also fixes the relevant .distfiles.

Usually, my script adds new files automatically.  So I don't need such
notices.  However, file removing/moving/reverting requires some manual
work and sometimes I forget them...

In reality, I have a directory which contains latest zsh and is *not*
maintained by cvs.  The directory is updated by patches from
zsh-workers and zsh-users and the repository is updated by `cvs
import' for each patch.  So, new files are automatically appeared on
main trunc when a patch create these files.  When some files are
removed, `cvs rm' is needed.  When some files are moved, these files
must be moved manually and `cvs import' is needed.  Sometimes I omit
the `cvs import' because it'll be executed with next patch, though.
When some files are reverted, `cvs add' and `cvs admin -b1.1.1' is
needed.
-- 
Tanaka Akira


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

* Re: PATCH: prompt theme system improvements
  1999-11-18 14:53 PATCH: prompt theme system improvements Adam Spiers
  1999-11-18 15:43 ` Adam Spiers
  1999-11-18 17:51 ` Bart Schaefer
@ 1999-11-19 11:42 ` Oliver Kiddle
  2 siblings, 0 replies; 10+ messages in thread
From: Oliver Kiddle @ 1999-11-19 11:42 UTC (permalink / raw)
  To: Adam Spiers; +Cc: Zsh workers

Adam Spiers wrote:

> Changes in full gory detail:
> ----------------------------
> 
>   - Colours are now all in assoc arrays.

This is much better. We should maybe add the 'gray' spelling aswell as 'grey' to the associative arrays so people have the choice. I'd also put the other attributes in an associative array so instead of $boldcolor, we have $color_attr[reset, bold, underline, standout] etc.

>   - `adam1', `fire', `elite' and `elite2' made colour-scheme-able.

I've patched the 'oliver' prompt to use the colour names aswell patch follows.
 
>   - Fixed bug in Oliver's prompt; it doesn't work if you don't set up

Thanks.

> Known bugs:
> -----------
> 
>   - I notice that the _prompt completion function no longer works,
>     presumably through one of the many changes to arguments.  I'll try
>     to fix this unless someone gets there first.

I suppose that we should allow the different prompts to specify completion for their parameters. Only trouble is that we can't get at any functions in the prompt until they have been setup.

>   - Some of the colours are tasteless.  Beauty is in the eye of the
>     beholder ...  Contributions from graphic designers/artists welcome :-)

I'd also say that it isn't exactly wise that the majority of the example prompts require a strange font.

>   - It would be nice to be able control the `bold-ness' of the colours
>     provided as theme provided.

I've done this with the 'oliver' prompt in the patch below - precede the colours with the word 'bold'.

>   - precmd and preexec still get stomped on.  I think the solution to
>     this is to use Bart's addprecmd to add a hook to them both which
>     calls prompt_pre{cmd,exec} respectively the first time promptinit
>     is run, and then subsequent theme changes can alter these hook
>     functions without messing up the original pre{cmd,exec}.  Does
>     that sound reasonable?

That sounds like the best solution.

I also think it would be sensible for promptinit to save the original PS2 and PS3 and set them back to the originals before changing prompt. This means that any prompts which don't set them will use the original settings instead of those set by the last theme. 

The patch below makes a few of your prompts use prompt_opts insead of precmd. I've added 'true' to the end of the prompt function because it was returning an exit code of one half the time. It should probably return set_prompt's return code and set_prompt should return sensible exit codes and send its error messages to stderr but I haven't done this.
The typeset -g prompt_theme line echos the value of prompt_theme if it is set so I redirected it to /dev/null. I also updated my prompt with some other changes.

With respect to colour themes. It would be good to have a single way for defining colours across zsh. ZLS_COLOURS may be compatible with GNU ls but it isn't exactly the most readable way. One possible way would be to use an associative array for colours where the keys specify the context and the values specify the attributes. So for example, you might define:
zsh_colours[ls_directories]="bold blue on white"
zsh_colours[prompt_currentdir]="underlined green"
If different prompt themes use the same context words, you could share colour selections across prompts. It might also lead to a mechanism for defining the colours for different types of completion matches in the lists - not just for files.

Oliver Kiddle

diff -u Prompts.old/prompt_off_setup Prompts/prompt_off_setup
--- Prompts.old/prompt_off_setup	Thu Nov 18 16:15:57 1999
+++ Prompts/prompt_off_setup	Fri Nov 19 10:40:35 1999
@@ -4,7 +4,8 @@
   PS1="%# "
   PS2="> "
 
-  precmd () { setopt promptsubst }
+  prompt_opts=( cr percent )
+  precmd () { }
   preexec () { }
 }
 
diff -u Prompts.old/prompt_oliver_setup Prompts/prompt_oliver_setup
--- Prompts.old/prompt_oliver_setup	Thu Nov 18 17:40:39 1999
+++ Prompts/prompt_oliver_setup	Fri Nov 19 10:11:22 1999
@@ -9,7 +9,8 @@
 The colour of the prompt depends on two associative arrays -
 $pcolour and $tcolour. Each array is indexed by the name of the
 local host. Alternatively, the colour can be set with parameters
-to prompt.
+to prompt. To specify colours, use English words like 'yellow',
+optionally preceded by 'bold'.
 
 The hostname and username are also included unless they are in the
 $normal_hosts or $normal_users array.
@@ -17,21 +18,23 @@
 }
 
 prompt_oliver_setup() {
-  prompt_opts=( percent )
+  prompt_opts=( cr subst percent )
 
   [[ "${(t)pcolour}" != assoc* ]] && typeset -Ag pcolour
   [[ "${(t)tcolour}" != assoc* ]] && typeset -Ag tcolour
-  local pcol=$'\e['${1:-${pcolour[${HOST:=`hostname`}]:-33}}m
-  local tcol=$'\e['${2:-${tcolour[$HOST]:-37}}m
+  local pcol=${1:-${pcolour[${HOST:=`hostname`}]:-yellow}}
+  local pcolr=$fg[${pcol#bold}]
+  [[ $pcol = bold* ]] && pcolr=$bold_color$pcolr
+  
+  local tcol=${2:-${tcolour[$HOST]:-white}}
+  local tcolr=$reset_color$fg[${tcol#bold}]
+  [[ $tcol = bold* ]] && tcolr=$tcolr$bold_color
+  
   local a host="%M:" user="%n "
-  for a in $normal_hosts; do
-    [[ $HOST == $a ]] && host=""
-  done
-  for a in root $normal_users; do
-    [[ ${USER:-`whoami`} == $a ]] && user=""
-  done
+  [[ $HOST == (${(j(|))~normal_hosts}) ]] && host=""
+  [[ ${USER:-`whoami`} == (root|${(j(|))~normal_users}) ]] && user=""
 
-  PS1="%{$pcol%}$user$host%~ [%h%0(?..:%?)]%# %{$tcol%}"
+  PS1="%{$pcolr%}$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline. )[%h%0(?..:%?)]%# %{$tcolr%}"
 }
 
 prompt_oliver_setup "$@"
diff -u Prompts.old/prompt_redhat_setup Prompts/prompt_redhat_setup
--- Prompts.old/prompt_redhat_setup	Fri Oct 15 10:38:21 1999
+++ Prompts/prompt_redhat_setup	Fri Nov 19 10:36:25 1999
@@ -6,7 +6,8 @@
   PS1="[%n@%m %1~]\\$ "
   PS2="> "
 
-  precmd () { setopt promptsubst }
+  prompt_opts=( cr percent )
+  precmd () { }
   preexec () { }
 }
 
diff -u Prompts.old/prompt_suse_setup Prompts/prompt_suse_setup
--- Prompts.old/prompt_suse_setup	Thu Nov 18 16:15:57 1999
+++ Prompts/prompt_suse_setup	Fri Nov 19 10:32:17 1999
@@ -6,7 +6,8 @@
   PS1="%n@%m:%~/ > "
   PS2="> "
 
-  precmd () { setopt promptsubst }
+  prompt_opts=( cr percent )
+  precmd () { }
   preexec () { }
 }
 
diff -u Prompts.old/prompt_zefram_setup Prompts/prompt_zefram_setup
--- Prompts.old/prompt_zefram_setup	Thu Nov 18 16:15:57 1999
+++ Prompts/prompt_zefram_setup	Fri Nov 19 10:31:13 1999
@@ -10,7 +10,8 @@
   PS1='[%(2L.%L/.)'$ZSH_VERSION']%(?..%B{%v}%b)%n%(2v.%B@%b.@)%m:%B%~%b%(!.#.>) '
   PS2='%(4_:... :)%3_> '
 
-  precmd () { prompt_zefram_precmd; setopt promptsubst }
+  prompt_opts=( cr subst percent )
+  precmd () { prompt_zefram_precmd }
   preexec () { }
 }
 
diff -u Prompts.old/promptinit Prompts/promptinit
--- Prompts.old/promptinit	Thu Nov 18 16:15:57 1999
+++ Prompts/promptinit	Fri Nov 19 10:58:51 1999
@@ -8,12 +8,12 @@
 
 prompt_themes=()
 typeset -gU prompt_themes
-typeset -g prompt_theme
+typeset -g prompt_theme >/dev/null
 
 promptinit () {
   emulate -L zsh
   setopt extendedglob
-  local ppath='' name
+  local ppath='' name theme
 
   # Autoload all prompt_*_setup functions in fpath
   for theme in $^fpath/prompt_*_setup(N); do
@@ -151,6 +151,8 @@
  
   (( $#prompt_opts )) &&
       setopt noprompt{bang,cr,percent,subst} prompt${^prompt_opts[@]}
+
+  true
 }
 
 prompt_preview_theme () {


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

* Re: PATCH: prompt theme system improvements
@ 1999-11-19 12:01 Sven Wischnowsky
  0 siblings, 0 replies; 10+ messages in thread
From: Sven Wischnowsky @ 1999-11-19 12:01 UTC (permalink / raw)
  To: zsh-workers


Oliver Kiddle wrote:

> ...
> 
> With respect to colour themes. It would be good to have a single way
> for defining colours across zsh. ZLS_COLOURS may be compatible with
> GNU ls but it isn't exactly the most readable way.

Ah. See? I suggested then when I first started participating in the
coloured-completion-lists discussion.

> One possible way would be to use an associative array for colours where the keys specify the context and the values specify the attributes. So for example, you might define:
> zsh_colours[ls_directories]="bold blue on white"
> zsh_colours[prompt_currentdir]="underlined green"

Ick. Maybe we should keep the parameter side more standard and just
use `bold:blue:white' or `bold:fg=blue:bg=white' or something. And
then add a function that uses a mini-language... err, wait, where have 
I heard that before.

I have almost given up dreaming about it, but: stuff like this always
reminds how nice it would be to generalise some of the completion-setup 
stuff to a more general package system. And then allow something like: 
`zstyle 'prompt:...:foreground' bold blue'.

> If different prompt themes use the same context words, you could share colour selections across prompts. It might also lead to a mechanism for defining the colours for different types of completion matches in the lists - not just for files.

...which complist currently can't do because it uses ZLS_* only for
files. But I have already asked: should we change it to allow using
pattern-capabilities for normal matches, too? The only problem I have
with that is that I would like to be able to give such specs per group 
of matches added. And that would require changes to compadd which
doesn't (and, in my opinion, shouldn't) know about complist. Hrm.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: PATCH: prompt theme system improvements
@ 1999-11-19 11:01 Sven Wischnowsky
  0 siblings, 0 replies; 10+ messages in thread
From: Sven Wischnowsky @ 1999-11-19 11:01 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> And this is my consistency checker between .distfiles and CVS/Entries.
> Currently, this reports only one problem: _funcall is forgotten.

I see... I hope I remember that in the future.

Bye
 Sven

diff -u oldcompletion/Core/.distfiles Completion/Core/.distfiles
--- oldcompletion/Core/.distfiles	Fri Nov 19 11:59:53 1999
+++ Completion/Core/.distfiles	Fri Nov 19 12:00:16 1999
@@ -1,7 +1,7 @@
 DISTFILES_SRC='
     .distfiles
     _alternative _approximate _compalso _complete _correct _description
-    _expand _files _list _main_complete _match _menu _multi_parts
+    _expand _files _funcall _list _main_complete _match _menu _multi_parts
     _message _normal _oldlist _options _parameters _path_files _requested
     _sep_parts _set_options _sort_tags _style _tags _unset_options _wanted
     compdump compinit compinstall

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: PATCH: prompt theme system improvements
  1999-11-19 10:34 Sven Wischnowsky
@ 1999-11-19 10:55 ` Tanaka Akira
  0 siblings, 0 replies; 10+ messages in thread
From: Tanaka Akira @ 1999-11-19 10:55 UTC (permalink / raw)
  To: zsh-workers

In article <199911191034.LAA02428@beta.informatik.hu-berlin.de>,
  Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

> while we're at it... does the automatic updating of .distfiles work?
> Or do you need patches like the one below which Sven constantly keeps
> forgetting to build?

.distfiles are handled as usual files.  So it is not updated
automatically.  I don't plan automatic update for .distfiles.  But if
patches for .distfiles are posted as well as for other files, it is
useful to check consistency of the repository.  Also, package makers
need up-to-date .distfiles, I think.

And this is my consistency checker between .distfiles and CVS/Entries.
Currently, this reports only one problem: _funcall is forgotten.

#!/bin/sh

tmp1=/tmp/z-cd-distfiles.$$
tmp2=/tmp/z-cd-cvs.$$
trap  'rm -f $tmp1 $tmp2' 0 1 2 3 15

find . -name .distfiles -print |sort |
while read f; do
d="`dirname $f`"
. $f

GENERATED_SRC=
case "$d" in
".") GENERATED_SRC='
  META-FAQ config.h.in configure stamp-h.in' ;;
"./Doc") GENERATED_SRC='
  version.yo zsh.1 zsh.texi zshall.1 zshbuiltins.1 zshcompctl.1
  zshcompsys.1 zshcompwid.1 zshexpn.1 zshmisc.1 zshmodules.1
  zshoptions.1 zshparam.1 zshzftpsys.1 zshzle.1';;
"./Etc") GENERATED_SRC='
  FAQ';;
*) GENERATED_SRC= ;;
esac

echo $DISTFILES_SRC|awk '{for(i=1;i<=NF;i++)print $i}'|sort>$tmp1
(
  echo $GENERATED_SRC|awk '{for(i=1;i<=NF;i++)print $i}'
  awk -F/ '/^\// {print $2}' $d/CVS/Entries
)|sort>$tmp2
diff -u -L "$f" -L "$d/CVS/Entries" $tmp1 $tmp2
done
-- 
Tanaka Akira


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

* Re: PATCH: prompt theme system improvements
@ 1999-11-19 10:34 Sven Wischnowsky
  1999-11-19 10:55 ` Tanaka Akira
  0 siblings, 1 reply; 10+ messages in thread
From: Sven Wischnowsky @ 1999-11-19 10:34 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> ...
> 
> Usually, my script adds new files automatically.  So I don't need such
> notices.  However, file removing/moving/reverting requires some manual
> work and sometimes I forget them...

while we're at it... does the automatic updating of .distfiles work?
Or do you need patches like the one below which Sven constantly keeps
forgetting to build?

Bye
 Sven

diff -u oldcompletion/Builtins/.distfiles Completion/Builtins/.distfiles
--- oldcompletion/Builtins/.distfiles	Fri Nov 19 09:55:55 1999
+++ Completion/Builtins/.distfiles	Fri Nov 19 11:32:28 1999
@@ -4,4 +4,5 @@
     _compdef _disable _echotc _enable _fc _fg_jobs _functions _hash _kill
     _limits _nothing _pids _popd _sched _set _setopt _source _stat _trap
     _unhash _unsetopt _vars _vars_eq _wait _which _zftp _zle _zmodload
+    _signals
 '

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

end of thread, other threads:[~1999-11-19 12:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-18 14:53 PATCH: prompt theme system improvements Adam Spiers
1999-11-18 15:43 ` Adam Spiers
1999-11-18 17:51 ` Bart Schaefer
1999-11-19  1:51   ` Adam Spiers
1999-11-19 10:29     ` Tanaka Akira
1999-11-19 11:42 ` Oliver Kiddle
1999-11-19 10:34 Sven Wischnowsky
1999-11-19 10:55 ` Tanaka Akira
1999-11-19 11:01 Sven Wischnowsky
1999-11-19 12:01 Sven Wischnowsky

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