zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: promptinit
@ 1999-10-14 13:00 Sven Wischnowsky
  1999-10-14 13:46 ` Adam Spiers
  1999-10-15  8:43 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Sven Wischnowsky @ 1999-10-14 13:00 UTC (permalink / raw)
  To: zsh-workers


... or did I miss a patch?

Bye
 Sven

P.S.: Gee, some of the themes... if ever I want to become blind...

--- Functions/Prompts/promptinit.old	Thu Oct 14 14:56:56 1999
+++ Functions/Prompts/promptinit	Thu Oct 14 14:56:58 1999
@@ -12,7 +12,7 @@
   local ppath='' name
 
   # Autoload all prompt_*_setup functions in fpath
-  for theme in $fpath/prompt_*_setup(N); do
+  for theme in $^fpath/prompt_*_setup(N); do
     if [[ $theme == */prompt_(#b)(*)_setup ]]; then
       name="$match[1]"
       if [[ -r "$theme" ]]; then

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


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

* Re: PATCH: promptinit
  1999-10-14 13:00 PATCH: promptinit Sven Wischnowsky
@ 1999-10-14 13:46 ` Adam Spiers
  1999-10-15  8:43 ` Bart Schaefer
  1 sibling, 0 replies; 5+ messages in thread
From: Adam Spiers @ 1999-10-14 13:46 UTC (permalink / raw)
  To: zsh-workers

Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
> 
> ... or did I miss a patch?

Oops.  No, you didn't; I still haven't got used to what options are
set during scripts and functions.

> P.S.: Gee, some of the themes... if ever I want to become blind...

:-)  I know, I know ...  Don't worry though, I'll be merging several
into one colour-schemable prompt so that you can choose colours less
offensive to your own tastes.  I just included those as a starting
point so that people had something to play with.


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

* Re: PATCH: promptinit
  1999-10-14 13:00 PATCH: promptinit Sven Wischnowsky
  1999-10-14 13:46 ` Adam Spiers
@ 1999-10-15  8:43 ` Bart Schaefer
  1999-10-15 12:47   ` Adam Spiers
  1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 1999-10-15  8:43 UTC (permalink / raw)
  To: zsh-workers

On Oct 14,  3:00pm, Sven Wischnowsky wrote:
} Subject: PATCH: promptinit
}
} ... or did I miss a patch?

Here are some other misc. fixes ...  I don't know whether some of these
might be better handled by changing the perl prompt converter script ...

Also, I really don't like having my precmd stomped on, but I haven't yet
gotten around to fixing that.

Index: Functions/Prompts/prompt_adam2_setup
===================================================================
@@ -4,7 +4,7 @@
   cat <<'EOF'
 This prompt is color-theme-able.  You can invoke it thus:
 
-  prompt adam2 [ simple ] <color1> <color2> <color3>
+  prompt adam2 [ plain ] <color1> <color2> <color3>
 
 where the colors are for the hyphens, current directory, and user@host
 bits respectively.
@@ -70,7 +70,7 @@
 
   prompt_char="%(!.#.>)"
 
-  precmd () { prompt_adam2_precmd }
+  precmd () { prompt_adam2_precmd; setopt promptsubst }
   preexec () { prompt_adam2_preexec }
 }
 
Index: Functions/Prompts/prompt_fire_setup
===================================================================
@@ -21,7 +21,7 @@
     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 () { }
+  precmd () { setopt promptsubst }
   preexec () { }
 }
 
Index: Functions/Prompts/prompt_redhat_setup
===================================================================
@@ -6,7 +6,7 @@
   PS1="[%n@%m %1~]\\$ "
   PS2="> "
 
-  precmd () { }
+  precmd () { setopt promptsubst }
   preexec () { }
 }
 
Index: Functions/Prompts/promptinit
===================================================================
@@ -35,6 +35,7 @@
 }
 
 prompt () {
+  emulate -L zsh
   local opt preview theme usage old_theme
 
   usage='Usage: prompt <options>
@@ -91,7 +92,7 @@
          print "$usage"
          return
        fi
-       prompt_$1_setup "$*[2,-1]"
+       prompt_$1_setup $*[2,-1]
        prompt_theme=( $* )
 
        # Avoid screwing up the environment listing

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


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

* Re: PATCH: promptinit
  1999-10-15  8:43 ` Bart Schaefer
@ 1999-10-15 12:47   ` Adam Spiers
  1999-10-15 17:01     ` Stomping precmd (not) (Re: PATCH: promptinit) Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Spiers @ 1999-10-15 12:47 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> On Oct 14,  3:00pm, Sven Wischnowsky wrote:
> } Subject: PATCH: promptinit
> }
> } ... or did I miss a patch?
> 
> Here are some other misc. fixes ...

Thanks Bart, and sorry I couldn't get round to publishing fixes
myself; I've had a lot on recently.

> I don't know whether some of these
> might be better handled by changing the perl prompt converter script ...

No harm in adding the promptsubst setting I guess ...

> Also, I really don't like having my precmd stomped on, but I haven't yet
> gotten around to fixing that.

Yep ... bash2zshprompt is fundamentally flawed in that it tries to
semi-parse shell-script in a very simple way; hence any number of
things could probably go wrong.  However, it's an adequate, useful
starting point when converting prompts from bashprompt, as long as a
human checks the results and edits if necessary afterwards.

As I think I mentioned, I'll be cleaning up all the included prompt
themes when I get the chance.


Index: Misc/bash2zshprompt
===================================================================
RCS file: /usr/local/cvsroot/zsh/Misc/bash2zshprompt,v
retrieving revision 1.2
diff -u -r1.2 bash2zshprompt
--- Misc/bash2zshprompt	1999/10/06 18:27:12	1.2
+++ Misc/bash2zshprompt	1999/10/15 12:40:57
@@ -25,7 +25,7 @@
   # UGH
   elsif (! $seen_fn_end && $seen_fn) {
     s/^\s*/  /;
-    s/^\s*}\s*$/\n  precmd () { }\n  preexec () { }\n}\n/ and $seen_fn_end++;
+    s/^\s*}\s*$/\n  precmd () { setopt promptsubst }\n  preexec () { }\n}\n/ and $seen_fn_end++;
   }
 
   s/\\\[/%{/g;


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

* Stomping precmd (not) (Re: PATCH: promptinit)
  1999-10-15 12:47   ` Adam Spiers
@ 1999-10-15 17:01     ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 1999-10-15 17:01 UTC (permalink / raw)
  To: zsh-workers

On Oct 15,  1:47pm, Adam Spiers wrote:
} Subject: Re: PATCH: promptinit
}
} Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
} > Also, I really don't like having my precmd stomped on, but I haven't yet
} > gotten around to fixing that.
} 
} Yep ... bash2zshprompt is fundamentally flawed

Just a thought in passing:

    function addprecmd {
	if (($+precmd_hooks == 0)); then
	    eval function pre_addprecmd_precmd "$(functions precmd)"
	    precmd_hooks=(pre_addprecmd_precmd)
	    function precmd {
		local f
		for f in "${precmd_hooks[@]}"; do $f; done
	    }
	fi
	precmd_hooks[$#precmd_hooks+1]=("$@")
    }

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


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

end of thread, other threads:[~1999-10-15 17:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-14 13:00 PATCH: promptinit Sven Wischnowsky
1999-10-14 13:46 ` Adam Spiers
1999-10-15  8:43 ` Bart Schaefer
1999-10-15 12:47   ` Adam Spiers
1999-10-15 17:01     ` Stomping precmd (not) (Re: PATCH: promptinit) 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).