On Wed, Oct 29, 2008 at 04:42:07PM +0900, Kazuhiro NISHIYAMA wrote: > some _*_caching_policy (_perl_modules_caching_policy, _apt_caching_policy, > _debs_caching_policy, etc.) set oldp. > I think it should be local. > > There is the same problem in a man page of zshcompsys, > > _cache_invalid cache_identifier > This function returns status zero if the completions cache cor- > responding to the given cache identifier needs rebuilding. It > determines this by looking up the cache-policy style for the > current context. This should provide a function name which is > run with the full path to the relevant cache file as the only > argument. > > Example: > > _example_caching_policy () { > # rebuild if cache is more than a week old > oldp=( "$1"(Nmw+1) ) > (( $#oldp )) > } > > It should be include a following line: > local oldp
Thanks. Index: Completion/Darwin/Command/_fink =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Darwin/Command/_fink,v retrieving revision 1.1 diff -u -r1.1 _fink --- Completion/Darwin/Command/_fink 12 Nov 2004 11:47:42 -0000 1.1 +++ Completion/Darwin/Command/_fink 2 Nov 2008 14:06:30 -0000 @@ -55,6 +55,7 @@ } _finkpkgs_caching_policy(){ + local -a oldp oldp=( "$1"(Nmw+1) ) (( $#oldp )) || [[ /sw/var/cache/apt/pkgcache.bin -nt "$1" ]] || Index: Completion/Darwin/Type/_retrieve_mac_apps =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Darwin/Type/_retrieve_mac_apps,v retrieving revision 1.3 diff -u -r1.3 _retrieve_mac_apps --- Completion/Darwin/Type/_retrieve_mac_apps 11 Jul 2008 19:12:23 -0000 1.3 +++ Completion/Darwin/Type/_retrieve_mac_apps 2 Nov 2008 14:06:30 -0000 @@ -4,9 +4,10 @@ # Used by _mac_applications and _mac_files_for_application. _mac_apps_caching_policy () { - # Rebuild if cache is more than a day old - oldp=( "$1"(Nmw+1) ) - (( $#oldp )) + # Rebuild if cache is more than a day old + local -a oldp + oldp=( "$1"(Nmw+1) ) + (( $#oldp )) } Index: Completion/Debian/Command/_apt =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Debian/Command/_apt,v retrieving revision 1.14 diff -u -r1.14 _apt --- Completion/Debian/Command/_apt 28 Dec 2007 02:35:42 -0000 1.14 +++ Completion/Debian/Command/_apt 2 Nov 2008 14:06:32 -0000 @@ -571,14 +571,14 @@ _tags apt-releases && compadd -a _apt_releases } - _apt_caching_policy () { - # rebuild if cache is more than a week old - oldp=( "$1"(mw+1) ) - (( $#oldp )) && return 0 +_apt_caching_policy () { + local -a oldp - [[ /var/cache/apt/pkgcache.bin -nt "$1" || - /var/lib/dpkg/available -nt "$1" ]] - } + oldp=( "$1"(mw+1) ) + (( $#oldp )) && return 0 + [[ /var/cache/apt/pkgcache.bin -nt "$1" || + /var/lib/dpkg/available -nt "$1" ]] +} _apt "$@" Index: Completion/Debian/Type/_deb_packages =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Debian/Type/_deb_packages,v retrieving revision 1.7 diff -u -r1.7 _deb_packages --- Completion/Debian/Type/_deb_packages 6 Jul 2007 23:55:10 -0000 1.7 +++ Completion/Debian/Type/_deb_packages 2 Nov 2008 14:06:32 -0000 @@ -108,13 +108,14 @@ _tags packages && compadd "[EMAIL PROTECTED]" - "${(@P)cachevar}" } - _debs_caching_policy () { - # rebuild if cache is more than a week old - oldp=( "$1"(mw+1) ) - (( $#oldp )) && return 0 +_debs_caching_policy () { + # rebuild if cache is more than a week old + local -a oldp + oldp=( "$1"(mw+1) ) + (( $#oldp )) && return 0 - [[ /var/cache/apt/pkgcache.bin -nt "$1" || - /var/lib/dpkg/available -nt "$1" ]] - } + [[ /var/cache/apt/pkgcache.bin -nt "$1" || + /var/lib/dpkg/available -nt "$1" ]] +} _deb_packages "$@" Index: Completion/Redhat/Command/_rpm =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Redhat/Command/_rpm,v retrieving revision 1.9 diff -u -r1.9 _rpm --- Completion/Redhat/Command/_rpm 5 Jun 2008 16:34:00 -0000 1.9 +++ Completion/Redhat/Command/_rpm 2 Nov 2008 14:06:32 -0000 @@ -314,6 +314,7 @@ _rpms_caching_policy () { # rebuild if cache is more than a week old + local -a oldp oldp=( "$1"(mw+1) ) (( $#oldp )) && return 0 Index: Completion/Redhat/Command/_yum =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Redhat/Command/_yum,v retrieving revision 1.2 diff -u -r1.2 _yum --- Completion/Redhat/Command/_yum 19 Dec 2005 20:24:21 -0000 1.2 +++ Completion/Redhat/Command/_yum 2 Nov 2008 14:06:32 -0000 @@ -274,21 +274,22 @@ _yum_caching_policy() { - local _yumrepomds + local _yumrepomds + local -a oldp - # rebuild if cache is more than a week old - oldp=( "$1"(mw+1) ) - (( $#oldp )) && return 0 + # rebuild if cache is more than a week old + oldp=( "$1"(mw+1) ) + (( $#oldp )) && return 0 - _yumrepomds=( /var/cache/yum/**/repomd.xml ) + _yumrepomds=( /var/cache/yum/**/repomd.xml ) - if (( $#_yumrepomds )); then - for repo in $_yumrepomds; do - [[ "$repo" -nt "$1" ]] && return 0 - done - fi + if (( $#_yumrepomds )); then + for repo in $_yumrepomds; do + [[ "$repo" -nt "$1" ]] && return 0 + done + fi - return 1 + return 1 } _yum "$@" Index: Completion/Unix/Command/_bogofilter =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_bogofilter,v retrieving revision 1.6 diff -u -r1.6 _bogofilter --- Completion/Unix/Command/_bogofilter 8 Jun 2005 05:33:47 -0000 1.6 +++ Completion/Unix/Command/_bogofilter 2 Nov 2008 14:06:33 -0000 @@ -3,6 +3,7 @@ local expl ret bogotokens _bogoutil_caching_policy () { + local -a oldp # rebuild if cache is more than a week old oldp=( "$1"(mw+1) ) Index: Completion/Unix/Type/_path_commands =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_commands,v retrieving revision 1.5 diff -u -r1.5 _path_commands --- Completion/Unix/Type/_path_commands 3 Mar 2008 01:29:17 -0000 1.5 +++ Completion/Unix/Type/_path_commands 2 Nov 2008 14:06:34 -0000 @@ -3,8 +3,8 @@ (( $+functions[_path_commands_caching_policy] )) || _path_commands_caching_policy() { -local oldp file -typeset -a dbfiles +local file +local -a oldp dbfiles # rebuild if cache is more than a week old oldp=( "$1"(Nmw+1) ) Index: Completion/Unix/Type/_perl_modules =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_perl_modules,v retrieving revision 1.6 diff -u -r1.6 _perl_modules --- Completion/Unix/Type/_perl_modules 15 Oct 2008 06:17:39 -0000 1.6 +++ Completion/Unix/Type/_perl_modules 2 Nov 2008 14:06:34 -0000 @@ -132,6 +132,7 @@ _perl_modules_caching_policy () { local _perllocals + local -a oldp # rebuild if cache is more than a week old oldp=( "$1"(mw+1) ) Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.217 diff -u -r1.217 compsys.yo --- Doc/Zsh/compsys.yo 10 Oct 2008 10:02:04 -0000 1.217 +++ Doc/Zsh/compsys.yo 2 Nov 2008 14:06:46 -0000 @@ -3906,6 +3906,7 @@ example(_example_caching_policy () { # rebuild if cache is more than a week old + local -a oldp oldp=( "$1"(Nmw+1) ) (( $#oldp )) }) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]