Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] typeset reply array
- X-seq: zsh-workers 25068
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: [PATCH] typeset reply array
- Date: Sun, 18 May 2008 20:23:26 +0100
- In-reply-to: <20080518181735.1191bd8a@pws-pc>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1211026277-27464-1-git-send-email-madduck@xxxxxxxxxx> <1211026277-27464-2-git-send-email-madduck@xxxxxxxxxx> <1211025324-25630-1-git-send-email-madduck@xxxxxxxxxx> <20080518053301.GA8521@xxxxxxxx> <20080518181735.1191bd8a@pws-pc>
On Sun, 18 May 2008 18:17:35 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> Commonly used but non-global parameters such as "reply" could, and
> probably should, be made local to the top-level of completion at around
> the point where the options get set. This would save them appearing in
> the user's own space, which was the whole point of warncreateglobal in
> the first place.
>
> A "typeset -g" for variables that *should* be global makes perfect
> sense. The "-g" should definitely be present even if the code isn't
> inside a function (although the compinit stuff is), since we shouldn't
> make that assumption.
This does that. It's the same basic principle as the original patch,
but should be safe.
Index: Completion/compinit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/compinit,v
retrieving revision 1.20
diff -u -r1.20 compinit
--- Completion/compinit 12 Apr 2008 16:32:43 -0000 1.20
+++ Completion/compinit 18 May 2008 19:23:01 -0000
@@ -118,6 +118,7 @@
typeset -gA _lastcomp
# Remember dumpfile.
+typeset -g _comp_dumpfile
if [[ -n $_i_dumpfile ]]; then
# Explicitly supplied dumpfile.
_comp_dumpfile="$_i_dumpfile"
@@ -127,6 +128,7 @@
# The standard options set in completion functions.
+typeset -ga _comp_options
_comp_options=(
bareglobqual
extendedglob
@@ -158,14 +160,18 @@
# have a valid stdin descriptor (zle closes it before calling widgets)
# and don't get confused by user's ZERR trap handlers.
+typeset -g _comp_setup
_comp_setup='setopt localoptions localtraps ${_comp_options[@]};
local IFS=$'\'\ \\t\\r\\n\\0\''
exec </dev/null;
- trap - ZERR'
+ trap - ZERR
+ local -a reply
+ local REPLY'
# These can hold names of functions that are to be called before/after all
# matches have been generated.
+typeset -ga compprefuncs comppostfuncs
compprefuncs=()
comppostfuncs=()
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author