about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-11-20 18:12:31 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-11-20 18:12:31 +0000
commit33b846810cf4e8d29e38b25246e676438ae5a1bf (patch)
tree3be08ff77a511ade6a314472e6273838408fac91 /Functions
parent689df35c948b4c6e841fb278c5932bff4c0cee68 (diff)
downloadzsh-33b846810cf4e8d29e38b25246e676438ae5a1bf.tar.gz
zsh-33b846810cf4e8d29e38b25246e676438ae5a1bf.tar.xz
zsh-33b846810cf4e8d29e38b25246e676438ae5a1bf.zip
users/13464: allow MIME suffixes to match upper case variants
26075: fix repeated calendar events so that the next event is always in the
future
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Calendar/calendar_parse12
-rw-r--r--Functions/MIME/zsh-mime-handler2
-rw-r--r--Functions/MIME/zsh-mime-setup3
3 files changed, 16 insertions, 1 deletions
diff --git a/Functions/Calendar/calendar_parse b/Functions/Calendar/calendar_parse
index f856a4f77..e53e97516 100644
--- a/Functions/Calendar/calendar_parse
+++ b/Functions/Calendar/calendar_parse
@@ -28,6 +28,7 @@ setopt extendedglob
 
 local REPLY REPLY2
 local -a match mbegin mend
+integer now
 
 autoload -U calendar_scandate
 
@@ -70,6 +71,17 @@ while (( changed )); do
       reply[rpttime]=$REPLY
       reply[rptstr]=${match[2]%%"$REPLY2"}
       reply[text2]="${match[1]}${REPLY2##[[:space:]]#}"
+      (( now = EPOCHSECONDS ))
+      while (( ${reply[rpttime]} < now )); do
+	# let's hope the original appointment wasn't in 44 B.C.
+	if calendar_scandate -a -R ${reply[rpttime]} ${reply[rptstr]}; then
+	  if (( REPLY <= ${reply[rpttime]} )); then
+	    # pathological case
+	    break;
+	  fi
+	  reply[rpttime]=$REPLY
+	fi
+      done
     else
       # Just remove the keyword for further parsing
       reply[text2]="${match[1]}${match[2]##[[:space:]]#}"
diff --git a/Functions/MIME/zsh-mime-handler b/Functions/MIME/zsh-mime-handler
index 9b604c422..4f7bc1eb5 100644
--- a/Functions/MIME/zsh-mime-handler
+++ b/Functions/MIME/zsh-mime-handler
@@ -44,7 +44,7 @@ local suffix context
 local -a match mbegin mend
 
 [[ $1 = (#b)*.([^.]##) ]] || return 1
-suffix=$match[1]
+suffix=${(L)match[1]}
 context=":mime:.${suffix}:"
 
 local handler flags no_sh no_bg
diff --git a/Functions/MIME/zsh-mime-setup b/Functions/MIME/zsh-mime-setup
index 0e3a29e56..59693b09a 100644
--- a/Functions/MIME/zsh-mime-setup
+++ b/Functions/MIME/zsh-mime-setup
@@ -327,6 +327,8 @@ zstyle -L | while read line; do
     suffix=$match[1]
     # Make sure there is a suffix alias set up for this.
     alias -s $suffix >&/dev/null || alias -s $suffix=zsh-mime-handler
+    # Also for upper case variant
+    alias -s ${(U)suffix} >&/dev/null || alias -s ${(U)suffix}=zsh-mime-handler
   fi
 done
 
@@ -364,6 +366,7 @@ for suffix line in ${(kv)suffix_type_map}; do
     # Install the zsh handler as an alias, but never override
     # existing suffix handling.
     alias -s $suffix >&/dev/null || alias -s $suffix=zsh-mime-handler
+    alias -s ${(U)suffix} >&/dev/null || alias -s ${(U)suffix}=zsh-mime-handler
 
     zsh_mime_handlers[$suffix]=$line2
     zsh_mime_flags[$suffix]=$type_flags_map[$type]