about summary refs log tree commit diff
path: root/Functions/Misc/run-help
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-12-16 11:07:09 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-12-16 11:07:09 +0000
commit46bad169a8962ac75e64206b1034338f4e01b595 (patch)
tree91bbbacaf58c13ddd36271a25a82320a67458a8b /Functions/Misc/run-help
parentc4b72029cd7965cdd430eb4d44feb350d043912c (diff)
downloadzsh-46bad169a8962ac75e64206b1034338f4e01b595.tar.gz
zsh-46bad169a8962ac75e64206b1034338f4e01b595.tar.xz
zsh-46bad169a8962ac75e64206b1034338f4e01b595.zip
27492 based on Jörg Sommer: 27473: fix run-help alias problem.
Diffstat (limited to 'Functions/Misc/run-help')
-rw-r--r--Functions/Misc/run-help11
1 files changed, 8 insertions, 3 deletions
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index 837ce1ff0..6a1b3a418 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -49,6 +49,7 @@ if [[ $places = *"not found"* && $1 != ${(Q)1} ]]; then
   noalias=1
 fi
 
+{
 while ((i++ < $#places))
 do
     what=$places[$i]
@@ -56,7 +57,8 @@ do
     builtin print -r $what
     case $what in
     (*( is an alias)*)
-	[[ ${what[(w)6]:t} != ${what[(w)1]} ]] && run-help ${what[(w)6]:t}
+	[[ ${what[(w)6]:t} != ${what[(w)1]} ]] &&
+	  run_help_orig_cmd=${what[(w)1]} run-help ${what[(w)6]:t}
 	;;
     (*( is a * function))
 	case ${what[(w)1]} in
@@ -96,9 +98,9 @@ do
 		builtin print -z "$cmd_args"
 		cmd_args=( ${(z)cmd_args} )
 		# Discard environment assignments, etc.
-		while [[ $cmd_args[1] != $1 ]]
+		while [[ $cmd_args[1] != ${run_help_orig_cmd:-$1} ]]
 		do
-		    shift cmd_args
+		    shift cmd_args || return 1
 		done
 		eval "run-help-$1:t ${(q@)cmd_args[2,-1]}"
 	    else
@@ -115,3 +117,6 @@ do
 	[[ $what == [qQ] ]] && break
     fi
 done
+} always {
+  unset run_help_orig_cmd
+}