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

Re: PATCH: 3.1.6-test-2: _parameters



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@xxxxxxxxxxxxxxxxxxxxxxx



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