Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: perl 5.22 causes warnings when zsh calls it



On Jun 28,  7:44pm, John wrote:
} Subject: perl 5.22 causes warnings when zsh calls it
}
} Using Arch Linux + grml-zsh-config and zsh version 5.0.8 with the
} latest release of perl (5.22.0) causes warning messages when zsh calls
} perl.

This is specific to using the adam1 prompt theme, but there's no reason
for any of the prompt themes to be calling perl.

Also looks like years ago somebody copied the adam2 help strings into
adam1 and never noticed that left this theme dissing itself.

Aside:  Damn, it's hard to get curly braces into a pattern in a parameter
substitution inside double quotes.


diff --git a/Functions/Prompts/prompt_adam1_setup b/Functions/Prompts/prompt_adam1_setup
index 034641f..aca0e59 100644
--- a/Functions/Prompts/prompt_adam1_setup
+++ b/Functions/Prompts/prompt_adam1_setup
@@ -14,8 +14,6 @@ This theme works best with a dark background.
 Recommended fonts for this theme: nexus or vga or similar.  If you
 don't have any of these, then specify the `plain' option to use 7-bit
 replacements for the 8-bit characters.
-
-And you probably thought adam1 was overkill.
 EOF
 }
 
@@ -27,8 +25,9 @@ prompt_adam1_setup () {
   base_prompt="%K{$prompt_adam1_color1}%n@%m%k "
   post_prompt="%b%f%k"
 
-  base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%(K{.*?}|k)//g")
-  post_prompt_no_color=$(echo "$post_prompt" | perl -pe "s/%(K{.*?}|k)//g")
+  setopt localoptions extendedglob
+  base_prompt_no_color="${base_prompt//(%K{[^\\\}]#\}|%k)/}"
+  post_prompt_no_color="${post_prompt//(%K{[^\\\}]#\}|%k)/}"
 
   add-zsh-hook precmd prompt_adam1_precmd
 }



Messages sorted by: Reverse Date, Date, Thread, Author