zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: update prompt themes
Date: Sun, 18 May 2008 17:12:15 +0100	[thread overview]
Message-ID: <20080518171215.02a2f725@pws-pc> (raw)
In-Reply-To: <080517183510.ZM12224@torch.brasslantern.com>

On Sat, 17 May 2008 18:35:10 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> } -	functions[precmd]="${functions[precmd]//prompt_bart_precmd}"
> } +        precmd_functions[(r)prompt_*_precmd]=
> } +	precmd_functions=($precmd_functions)
> 
> I'm curious why the second assignment is necessary there.  Remove an
> empty element?  Couldn't you just do this?
> 
>     precmd_functions[(r)prompt_*_precmd]=()
> 
> Or perhaps better
> 
>     add-zsh-hook -D precmd 'prompt_*_precmd'

Yes, the latter is correct.  I missed that one when I updated to use
add-zsh-hook because it wasn't in the usual place.

> (Or do I misunderstand the -D option you added?)
> 
> }  	# Abuse the fg assoc to hold our selected colors ...
> } -	fg[%m]=$fg[${1:-red}]
> 
> Er, the fg assoc came from Functions/Misc/colors which you're no longer
> including, so it's no longer "abuse" to do this to the $fg that you've
> declared global in this same function.

Well, yes, but I didn't really want to fiddle too much with the
comments.

Index: Functions/Prompts/prompt_bart_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_bart_setup,v
retrieving revision 1.14
diff -u -r1.14 prompt_bart_setup
--- Functions/Prompts/prompt_bart_setup	17 May 2008 22:42:17 -0000	1.14
+++ Functions/Prompts/prompt_bart_setup	18 May 2008 16:10:39 -0000
@@ -151,8 +151,7 @@
     # A few extra niceties ...
     repeat 1 case "$1:l" in
       (off|disable)
-        precmd_functions[(r)prompt_*_precmd]=
-	precmd_functions=($precmd_functions)
+        add-zsh-hook -D precmd "prompt_*_precmd"
 	functions[TRAPWINCH]="${functions[TRAPWINCH]//prompt_bart_winch}"
 	[[ $prompt_theme[1] = bart ]] && PS1=${${(f)PS1}[-1]}
 	return 1
@@ -162,7 +161,10 @@
 	[[ $prompt_theme[1] = bart ]] && break
 	;&
       (*)
-	# Abuse the fg assoc to hold our selected colors ...
+	# Use the fg assoc to hold our selected colors ...
+	# This used to be provided by the function colors, but is now
+	# set directly from here.  There should be no clash if both
+	# are in use.
 	fg[%m]="%F{${1:-red}}"
 	fg[%h]="%F{${2:-blue}}"
 	fg[%~]="%F{${3:-default}}"


-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


      reply	other threads:[~2008-05-18 16:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-17 22:36 Peter Stephenson
2008-05-17 23:54 ` Bart Schaefer
2008-05-18  1:35 ` Bart Schaefer
2008-05-18 16:12   ` Peter Stephenson [this message]

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=20080518171215.02a2f725@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.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).