1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

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
This commit is contained in:
Peter Stephenson 2008-11-20 18:12:31 +00:00
parent 689df35c94
commit 33b846810c
5 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2008-11-20 Peter Stephenson <pws@csr.com>
* 26075: Functions/Calendar/calendar_parse: update repeated events
until they're in the future.
* users/13464: Functions/MIME/zsh-mime-handler,
Functions/MIME/zsh-mime-setup: allow suffixes specified as
lower case to match upper case variants.
2008-11-18 Peter Stephenson <pws@csr.com>
* 26065: Config/version.mk: update to 4.3.9-dev-1 because of

View file

@ -1887,6 +1887,10 @@ user.
The system works by setting up suffix aliases with `tt(alias -s)'.
Suffix aliases already installed by the user will not be overwritten.
For suffixes defined in lower case, upper case variants will also
automatically be handled (e.g. tt(PDF) is automatically handled if
handling for the suffix tt(pdf) is defined), but not vice versa.
Repeated calls to tt(zsh-mime-setup) do not override the existing
mapping between suffixes and executable files unless the option tt(-f)
is given. Note, however, that this does not override existing suffix

View file

@ -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:]]#}"

View file

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

View file

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