zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH]: prompt -c never tells : "Current prompt is not a theme"
@ 2006-09-18 18:56 arno.
  0 siblings, 0 replies; only message in thread
From: arno. @ 2006-09-18 18:56 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-09-18 18:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-18 18:56 [PATCH]: prompt -c never tells : "Current prompt is not a theme" arno.

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