zsh-users
 help / color / mirror / code / Atom feed
* zsh-mime-handler case insentive ?
@ 2008-11-20 15:45 Baptiste Daroussin
  2008-11-20 15:52 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Baptiste Daroussin @ 2008-11-20 15:45 UTC (permalink / raw)
  To: zsh-users

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 ?

regards,
Bapt


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: zsh-mime-handler case insentive ?
  2008-11-20 15:45 zsh-mime-handler case insentive ? Baptiste Daroussin
@ 2008-11-20 15:52 ` Peter Stephenson
  2008-11-20 16:50   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2008-11-20 15:52 UTC (permalink / raw)
  To: zsh-users

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.

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: zsh-mime-handler case insentive ?
  2008-11-20 15:52 ` Peter Stephenson
@ 2008-11-20 16:50   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2008-11-20 16:50 UTC (permalink / raw)
  To: zsh-users

On Thu, 20 Nov 2008 15:52:08 +0000
Peter Stephenson <pws@csr.com> 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@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-20 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-20 15:45 zsh-mime-handler case insentive ? Baptiste Daroussin
2008-11-20 15:52 ` Peter Stephenson
2008-11-20 16:50   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).