zshrc: Amending the previous patches slightly
[grml-etc-core.git] / etc / zsh / zshrc
index bd54c2b..577c63f 100644 (file)
@@ -867,17 +867,9 @@ done
 
 # autoload zsh modules when they are referenced
 if is4 ; then
-    tmpargs=(
-        a   stat
-        a   zpty
-        ap  mapfile
-    )
-
-    while (( ${#tmpargs} > 0 )) ; do
-        zmodload -${tmpargs[1]} zsh/${tmpargs[2]} ${tmpargs[2]}
-        shift 2 tmpargs
-    done
-    unset tmpargs
+    zmodload -a  zsh/stat    zstat
+    zmodload -a  zsh/zpty    zpty
+    zmodload -ap zsh/mapfile mapfile
 fi
 
 if is4 && zrcautoload insert-files && zle -N insert-files ; then
@@ -3522,17 +3514,25 @@ regcheck() {
     pcre_match $2 && echo "regex matches" || echo "regex does not match"
 }
 
+#f5# List files which have been accessed within the last {\it n} days, {\it n} defaults to 1
+accessed() {
+    emulate -L zsh
+    print -l -- *(a-${1:-1})
+}
+
 #f5# List files which have been changed within the last {\it n} days, {\it n} defaults to 1
 changed() {
     emulate -L zsh
-    print -l *(c-${1:1})
+    print -l -- *(c-${1:-1})
 }
 
 #f5# List files which have been modified within the last {\it n} days, {\it n} defaults to 1
-new() {
+modified() {
     emulate -L zsh
-    print -l *(m-${1:1})
+    print -l -- *(m-${1:-1})
 }
+# modified() was named new() in earlier versions, add an alias for backwards compatibility
+check_com new || alias new=modified
 
 #f5# Grep in history
 greph() {