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

Re: PATCH: vcs_info: Set NO_warn_create_global option

On Feb 21,  3:53pm, Frank Terbeck wrote:
} zstyle -e ':vcs_info:git:*' \
}     check-for-changes 'estyle-cfc && reply=( true ) || reply=( false )'
} That however, welcomes me with this nice warning:
} VCS_INFO_get_data_git:49: array parameter reply created globally in function

} So, there are three options:
}  a) Get the big hammer and just disable `warn_create_global' in
}     vcs_info.
}  b) Use a smaller hammer, and create a wrapper function around zstyle
}     for vcs_info, that disables the option locally.
}  c) Disable `warn_create_global' in code executed by "zstyle -e". Or
}     make `reply' and `REPLY' special in that case. Or whatever makes the
}     most sense.

There's another option

b.5) Write the style like this:

zstyle -e ':vcs_info:git:*' \
    check-for-changes 'typeset -g reply; \
                       estyle-cfc && reply=( true ) || reply=( false )'

Also, rather than (c) I might suggest

d) Suppress warn_create_global for the parameters "reply" and "REPLY"
   at all times.  In fact it probably ought to be suppressed for STTY
   and a few others in the "Parameters Used By The Shell" section of
   the manual.

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