zshrc: not using 'for name0 name1 in a b c d ; ...' anymore
authorFrank Terbeck <ft@grml.org>
Mon, 22 Oct 2007 14:44:55 +0000 (16:44 +0200)
committerFrank Terbeck <ft@grml.org>
Mon, 22 Oct 2007 14:44:55 +0000 (16:44 +0200)
Replacing that contruct with something, that does not break older zshs.

etc/zsh/zshrc

index c740a02..ba0df24 100644 (file)
@@ -451,12 +451,20 @@ fi
          done
 
 # autoload zsh modules when they are referenced
-  is4 && for opt mod in a  stat    \
-                        a  zpty    \
-                        ap zprof   \
-                        ap mapfile ; do
-             zmodload -${opt} zsh/${mod} ${mod}
-         done ; unset opt mod
+  if is4 ; then
+    tmpargs=(
+      a   stat
+      a   zpty
+      ap  zprof
+      ap  mapfile
+    )
+
+    while (( ${#tmpargs} > 0 )) ; do
+      zmodload -${tmpargs[1]} zsh/${tmpargs[2]} ${tmpargs[2]}
+      shift 2 tmpargs
+    done
+    unset tmpargs
+  fi
 
   is4 && autoload -U insert-files && \
   zle -N insert-files && \