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

[PATCH]: prompt -c never tells : "Current prompt is not a theme"



Hi
% autoload -U promptinit
% prompt -c
Current prompt theme is:


instead of 
% prompt -c
Current prompt is not a theme.

(As I have not set a prompt theme yet)

This is because in Functions/Prompt/promptinit (function set_prompt):

if (( $+prompt_theme )); then
    [...]
else
    print "Current prompt is not a theme."
fi

But as prompt_theme is set when promptinit loads:
typeset -gU prompt_themes

$+prompt_theme always returns 1 (even when prompt_theme is empty)
and else branch is never reached. May be -n $prompt_theme would be 
better ?

Here is a patch :

arno.

diff -Nur zsh-4.3.2/Functions/Prompts/promptinit zsh-4.3.2~/Functions/Prompts/promptinit
--- zsh-4.3.2/Functions/Prompts/promptinit	2005-05-16 12:17:09.000000000 +0200
+++ zsh-4.3.2~/Functions/Prompts/promptinit	2006-09-18 20:44:30.000000000 +0200
@@ -91,7 +91,7 @@
       ;;
   esac
   case "$opt" in
-    c) if (( $+prompt_theme )); then
+    c) if [[ -n $prompt_theme ]]; then
          print -n "Current prompt theme"
          (( $#prompt_theme > 1 )) && print -n " with parameters"
          print " is:\n  $prompt_theme"

Attachment: signature.asc
Description: Digital signature



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