* Re: PATCH: 3.1.6-test-2: _parameters
@ 1999-07-23 8:57 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-07-23 8:57 UTC (permalink / raw)
To: zsh-workers
Peter Stephenson wrote:
> This tidies up _parameters a bit. I'd have liked to use something like
>
> if zmodload -e parameter; then
> compadd "$@" - ${(k)parameters}
> return
> fi
>
> but then there's no way of getting rid of local parameters, which is a
> shame.
Huh. This was probably pure oversight. The patch below adds `-local'
for local parameters for $parameters and ${(t)foo}.
Then it changes _parameters.
And then it changes _normal -- I was planning to do this anyway.
Bye
Sven
diff -u os/subst.c Src/subst.c
--- os/subst.c Tue Jul 20 08:54:13 1999
+++ Src/subst.c Fri Jul 23 10:38:38 1999
@@ -1031,6 +1031,8 @@
case PM_HASHED: val = "association"; break;
}
val = dupstring(val);
+ if (v->pm->level)
+ val = dyncat(val, "-local");
if (f & PM_LEFT)
val = dyncat(val, "-left");
if (f & PM_RIGHT_B)
--- os/Module/parameter.c Fri Jul 23 10:53:32 1999
+++ Src/Modules/parameter.c Fri Jul 23 10:53:48 1999
@@ -91,6 +91,8 @@
}
DPUTS(!val, "BUG: type not handled in parameter");
val = dupstring(val);
+ if (pm->level)
+ val = dyncat(val, "-local");
if (f & PM_LEFT)
val = dyncat(val, "-left");
if (f & PM_RIGHT_B)
diff -u od/Zsh/expn.yo Doc/Zsh/expn.yo
--- od/Zsh/expn.yo Fri Jul 23 08:28:53 1999
+++ Doc/Zsh/expn.yo Fri Jul 23 10:39:36 1999
@@ -647,6 +647,9 @@
detail:
startitem()
+item(tt(local))(
+for local parameters
+)
item(tt(left))(
for left justified parameters
)
diff -u oc/Core/_normal Completion/Core/_normal
--- oc/Core/_normal Wed Jul 21 13:28:21 1999
+++ Completion/Core/_normal Fri Jul 23 10:51:13 1999
@@ -20,7 +20,11 @@
cmd2="${command:t}"
else
cmd1="$command"
- cmd2=$(whence -p $command)
+ if zmodload -e parameter; then
+ cmd2="$commands[$command]"
+ else
+ cmd2=$(whence -p $command)
+ fi
fi
# See if there are any matching pattern completions.
diff -u oc/Core/_parameters Completion/Core/_parameters
--- oc/Core/_parameters Fri Jul 23 10:40:26 1999
+++ Completion/Core/_parameters Fri Jul 23 10:45:22 1999
@@ -4,4 +4,8 @@
# extra options of compadd. It completes only non-local parameters. All
# arguments are given to compadd.
-compadd "$@" - ${${${(f)"$(typeset +)"}:#*local *}##* }
+if zmodload -e parameter; then
+ compadd "$@" - ${(k)parameters[(R)^*local*]}
+else
+ compadd "$@" - ${${${(f)"$(typeset +)"}:#*local *}##* }
+fi
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: 3.1.6-test-2: _parameters
@ 1999-07-23 9:22 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-07-23 9:22 UTC (permalink / raw)
To: zsh-workers
I wrote:
> Then it changes _parameters.
Urgh. I thought we had that in _main_complete, sorry.
Bye
Sven
diff -u oc/Core/_parameters Completion/Core/_parameters
--- oc/Core/_parameters Fri Jul 23 10:58:35 1999
+++ Completion/Core/_parameters Fri Jul 23 11:21:06 1999
@@ -5,6 +5,7 @@
# arguments are given to compadd.
if zmodload -e parameter; then
+ setopt localoptions extendedglob
compadd "$@" - ${(k)parameters[(R)^*local*]}
else
compadd "$@" - ${${${(f)"$(typeset +)"}:#*local *}##* }
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: 3.1.6-test-2: _parameters
@ 1999-07-23 9:18 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-07-23 9:18 UTC (permalink / raw)
To: zsh-workers
And the same for _main_complete.
I'm still thinking about adding some more special parameters to the
parameter module. Maybe, some day...
Bye
Sven
diff -u oc/Core/_main_complete Completion/Core/_main_complete
--- oc/Core/_main_complete Fri Jul 23 10:58:35 1999
+++ Completion/Core/_main_complete Fri Jul 23 11:14:51 1999
@@ -29,10 +29,15 @@
#
# local _set_options _unset_options
#
-# _set_options=("${(@f)$({ unsetopt kshoptionprint; setopt } 2>/dev/null)}")
-# _unset_options=("${(@f)$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)}")
+# if zmodload -e parameter; then
+# _set_options=(${(k)options[(R)on]})
+# _unset_options=(${(k)options[(R)off]})
+# else
+# _set_options=("${(@f)$({ unsetopt kshoptionprint; setopt } 2>/dev/null)}")
+# _unset_options=("${(@f)$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)}")
+# fi
#
-# This is needed because completion function may set options locally
+# This is needed because completion functions may set options locally
# which makes the output of setopt and unsetopt reflect a different
# state than the global one for which you are completing.
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* PATCH: 3.1.6-test-2: _parameters
@ 1999-07-23 7:58 Peter Stephenson
0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 1999-07-23 7:58 UTC (permalink / raw)
To: Zsh hackers list
This tidies up _parameters a bit. I'd have liked to use something like
if zmodload -e parameter; then
compadd "$@" - ${(k)parameters}
return
fi
but then there's no way of getting rid of local parameters, which is a
shame.
--- Completion/Core/_parameters~ Fri Jun 4 15:18:48 1999
+++ Completion/Core/_parameters Fri Jul 23 09:55:38 1999
@@ -4,4 +4,4 @@
# extra options of compadd. It completes only non-local parameters. All
# arguments are given to compadd.
-compadd "$@" - "${(@)${(@)${(@)${(@f)$(typeset)}:#*local *\=*}%%\=*}##* }"
+compadd "$@" - ${${${(f)"$(typeset +)"}:#*local *}##* }
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-07-23 9:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-23 8:57 PATCH: 3.1.6-test-2: _parameters Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
1999-07-23 9:22 Sven Wischnowsky
1999-07-23 9:18 Sven Wischnowsky
1999-07-23 7:58 Peter Stephenson
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).