Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh-mime-handler case insentive ?
- X-seq: zsh-users 13464
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: zsh-mime-handler case insentive ?
- Date: Thu, 20 Nov 2008 16:50:13 +0000
- In-reply-to: <200811201552.mAKFq8JE001782@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <20081120154530.GC68204@xxxxxxxxxxx> <200811201552.mAKFq8JE001782@xxxxxxxxxxxxxx>
On Thu, 20 Nov 2008 15:52:08 +0000
Peter Stephenson <pws@xxxxxxx> wrote:
> Baptiste Daroussin wrote:
> > I use zsh-mime-handler all the time, I find that it case sensitive concerning
> > the mime type
> > for example in my .mailcap I have :
> > application/pdf;pdftotext %s -
> >
> > If I do ./bla.pdf it works, but if I do ./bla.PDF it doesn't work any clue on
> > that ?
>
> Yes, that's exactly how it works.
While I'm waiting for a compilation to finish (except I'm not any
more)... I presume handling upper case variants is always the right thing
to do? Mixed case variants are beyond the scope of the alias system at
present (without exhaustively adding them).
Index: Doc/Zsh/contrib.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/contrib.yo,v
retrieving revision 1.91
diff -u -r1.91 contrib.yo
--- Doc/Zsh/contrib.yo 26 Oct 2008 17:57:13 -0000 1.91
+++ Doc/Zsh/contrib.yo 20 Nov 2008 16:49:36 -0000
@@ -1887,6 +1887,10 @@
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
Index: Functions/MIME/zsh-mime-handler
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/MIME/zsh-mime-handler,v
retrieving revision 1.10
diff -u -r1.10 zsh-mime-handler
--- Functions/MIME/zsh-mime-handler 4 Jun 2007 12:07:36 -0000 1.10
+++ Functions/MIME/zsh-mime-handler 20 Nov 2008 16:49:36 -0000
@@ -44,7 +44,7 @@
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
Index: Functions/MIME/zsh-mime-setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/MIME/zsh-mime-setup,v
retrieving revision 1.6
diff -u -r1.6 zsh-mime-setup
--- Functions/MIME/zsh-mime-setup 23 Jun 2008 13:34:54 -0000 1.6
+++ Functions/MIME/zsh-mime-setup 20 Nov 2008 16:49:36 -0000
@@ -327,6 +327,8 @@
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 @@
# 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]
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author