From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk
Subject: Re: [PATCH] typeset reply array
Date: Sun, 18 May 2008 20:23:26 +0100 [thread overview]
Message-ID: <20080518202326.1d2b3f3b@pws-pc> (raw)
In-Reply-To: <20080518181735.1191bd8a@pws-pc>
On Sun, 18 May 2008 18:17:35 +0100
Peter Stephenson <p.w.stephenson@ntlworld.com> 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@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
prev parent reply other threads:[~2008-05-18 19:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1211026277-27464-1-git-send-email-madduck@debian.org>
[not found] ` <1211026277-27464-2-git-send-email-madduck@debian.org>
[not found] ` <1211025324-25630-1-git-send-email-madduck@debian.org>
2008-05-18 5:33 ` Clint Adams
2008-05-18 16:40 ` Bart Schaefer
2008-05-18 16:49 ` martin f krafft
2008-05-18 17:17 ` Peter Stephenson
2008-05-18 19:23 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080518202326.1d2b3f3b@pws-pc \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).