From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15630 invoked by alias); 22 Nov 2015 18:13:17 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37192 Received: (qmail 27669 invoked from network); 22 Nov 2015 18:13:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version:content-type; bh=LR3YyVMt/Tjrph9dbjEkiQGOXGEALOznscHoR0Mk438=; b=lvI94MDuCNkU2cKNrxjrcJZl2Tlcjt4ZNcuS0kM0vflg2Eh89lKxLzESv3IV/wrr76 CJElsE4RPpNM0Fe8Icrquaem7QXtlpvgOrIJszLQwcMBXl3973lrdHkujSVurj+s2wdd mUjC6VwpxzdFgAv43jVr1HzJtLrChBRZnNyFAth9VTPAVbV37AL+pEubsP32x9OG+tbL 4sNpgn8x8ekf2Kl7EMatG5FaWp+tQEQ3BC8hfJV1bMROBTW6e5H6FBJYqqUhlKvQCSEH IYiVHBOSkHexI5/1sYupfybY2FCB6dxCLwKsXJcEaiR/8gY6pxW6oRK8R8yg7j2ser3O 3d3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:to:subject:mime-version :content-type; bh=LR3YyVMt/Tjrph9dbjEkiQGOXGEALOznscHoR0Mk438=; b=SiLS5kte4sYDAc3uHg+DonLxkriXKY5LfwWdd5+aPyHe480n9XTvzfNc1Ec1DbeLai 1mS3d1rfvnRrPGua/7s6w4sys002Btq0ENacUdz5YMzOc8FQWv0DxSA2OBCRo02JG6nW sMkn2PTUGhGC9Onb12CEac7M1hrzkJtDbKyeFO3eop6q9CO3QMJuJC9x1N3rPVl2kvic 38GDHkXmni2c4Qb4PfJhziXpY96vv7YYwO+OKcnkAjuhXbFKU6Si+L7QJ42oTkdf484E f7xgfiCZem2Zuhb/0X2M2o8aiYaJmshREP5wZb3K1x8R3/lCo0wp22lA4uQEHMu0AvYQ 9ovw== X-Gm-Message-State: ALoCoQktj9YmyFJeLnMjyk+LAt+vLSjc/nZj6e4e4nzeDh2RJLLxoPhEk6POnLYHjsAx8PRtCKd5 X-Received: by 10.98.16.81 with SMTP id y78mr11441126pfi.158.1448215995000; Sun, 22 Nov 2015 10:13:15 -0800 (PST) From: Bart Schaefer Message-Id: <151122101321.ZM10240@torch.brasslantern.com> Date: Sun, 22 Nov 2015 10:13:21 -0800 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: WARN_CREATE_GLOBAL and prompt themes MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Maybe we also don't want to warn about zle_highlight ... but that would be some kind of ugly special case, I think. I got lazy with the adam prompts because they create about a dozen globals. diff --git a/Functions/Prompts/prompt_adam1_setup b/Functions/Prompts/prompt_adam1_setup index aca0e59..27a613c 100644 --- a/Functions/Prompts/prompt_adam1_setup +++ b/Functions/Prompts/prompt_adam1_setup @@ -18,6 +18,7 @@ EOF } prompt_adam1_setup () { + setopt localoptions nowarncreateglobal prompt_adam1_color1=${1:-'blue'} prompt_adam1_color2=${2:-'cyan'} prompt_adam1_color3=${3:-'green'} @@ -33,7 +34,7 @@ prompt_adam1_setup () { } prompt_adam1_precmd () { - setopt noxtrace localoptions + setopt localoptions noxtrace nowarncreateglobal local base_prompt_expanded_no_color base_prompt_etc local prompt_length space_left diff --git a/Functions/Prompts/prompt_adam2_setup b/Functions/Prompts/prompt_adam2_setup index 14603b4..b944511 100644 --- a/Functions/Prompts/prompt_adam2_setup +++ b/Functions/Prompts/prompt_adam2_setup @@ -20,6 +20,7 @@ EOF prompt_adam2_setup () { # Some can't be local + setopt localoptions nowarncreateglobal local prompt_gfx_tlc prompt_gfx_mlc prompt_gfx_blc if [[ $1 == '8bit' ]]; then @@ -73,7 +74,7 @@ prompt_adam2_setup () { } prompt_adam2_precmd() { - setopt noxtrace localoptions extendedglob + setopt localoptions extendedglob noxtrace nowarncreateglobal local prompt_line_1 prompt_adam2_choose_prompt diff --git a/Functions/Prompts/prompt_bart_setup b/Functions/Prompts/prompt_bart_setup index 22c0c03..cb032de 100644 --- a/Functions/Prompts/prompt_bart_setup +++ b/Functions/Prompts/prompt_bart_setup @@ -70,8 +70,8 @@ prompt_bart_help () { print -nP '\n%E' } -integer PSCOL=1 -typeset PSCMD= +integer -g PSCOL=1 +typeset -g PSCMD= prompt_bart_preexec () { setopt localoptions noxtrace noshwordsplit noksharrays unset @@ -106,7 +106,6 @@ prompt_bart_precmd () { psvar[8]='' # No padding until we compute it psvar[9]=() - typeset -g PSCOL # Reset the truncation widths for upcoming computations ((PSCOL == 1)) || { PSCOL=1 ; prompt_bart_ps1 } if [[ -o promptcr ]] diff --git a/Functions/Prompts/prompt_clint_setup b/Functions/Prompts/prompt_clint_setup index 822d390..876d304 100644 --- a/Functions/Prompts/prompt_clint_setup +++ b/Functions/Prompts/prompt_clint_setup @@ -38,12 +38,13 @@ prompt_clint_setup () { [[ -n "$WINDOW" ]] && p_win="$pc['\(']%F{$pcc[4]}$WINDOW$pc['\)']" p_userpwd="$pc['<']%F{$pcc[3]}%n@%m$p_win%F{$pcc[5]}:%F{$pcc[4]}%~$pc['>']" - p_vcs="%(2v.%U%2v%u.)" + local p_vcs="%(2v.%U%2v%u.)" p_shlvlhist="%fzsh%(2L./$SHLVL.) %B%h%b " p_rc="%(?..[%?%1v] )" p_end="%f%B%#%b " + typeset -ga zle_highlight zle_highlight[(r)default:*]=default:$pcc[2] prompt="$p_date$p_tty$p_plat$p_ver diff --git a/Functions/Prompts/prompt_oliver_setup b/Functions/Prompts/prompt_oliver_setup index 44d3f99..979411d 100644 --- a/Functions/Prompts/prompt_oliver_setup +++ b/Functions/Prompts/prompt_oliver_setup @@ -37,6 +37,8 @@ prompt_oliver_setup() { PS1="$pcolr$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline. )[%h%1(j.%%%j.)%0(?..:%?)]%# %b%f%k" RPS2='<%^' PS2='' + + typeset -ga zle_highlight zle_highlight[(r)default:*]=default:$tcolr } diff --git a/Functions/Prompts/prompt_special_chars b/Functions/Prompts/prompt_special_chars index a8da6c3..82a1f2d 100644 --- a/Functions/Prompts/prompt_special_chars +++ b/Functions/Prompts/prompt_special_chars @@ -19,6 +19,7 @@ if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *(UTF-8|utf8)* ]]; then schars[261]=$'\xe2\x96\x92' schars[260]=$'\xe2\x96\x91' else + local code for code in 300 304 332 333 371 372 262 261 260; do eval "schars[$code]=\$'\\$code'" done diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit index edf2d02..5872489 100644 --- a/Functions/Prompts/promptinit +++ b/Functions/Prompts/promptinit @@ -160,7 +160,7 @@ Use prompt -h for help on specific themes.' for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do add-zsh-hook -D "${hook}" "prompt_*_${hook}" done - set -A zle_highlight ${zle_highlight:#default:*} + typeset -ga zle_highlight=( ${zle_highlight:#default:*} ) (( ${#zle_highlight} )) || unset zle_highlight prompt_$1_setup "$@[2,-1]" && prompt_theme=( "$@" )