From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6944 invoked from network); 23 Jun 2008 13:31:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Jun 2008 13:31:13 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 65001 invoked from network); 23 Jun 2008 13:31:06 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Jun 2008 13:31:06 -0000 Received: (qmail 6496 invoked by alias); 23 Jun 2008 13:31:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25236 Received: (qmail 6483 invoked from network); 23 Jun 2008 13:31:03 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 23 Jun 2008 13:31:03 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 2246680524FD for ; Mon, 23 Jun 2008 15:30:53 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly13g.srv.mailcontrol.com (MailControl) with ESMTP id m5NDUIoS027242 for ; Mon, 23 Jun 2008 14:30:50 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Mon, 23 Jun 2008 14:30:34 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id m5NDUYBp006749 for ; Mon, 23 Jun 2008 14:30:34 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id m5NDUYgg006746 for ; Mon, 23 Jun 2008 14:30:34 +0100 X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: list handled MIME types by suffix X-Mailer: MH-E 8.0.3; nmh 1.3-RC1; GNU Emacs 22.1.1 Date: Mon, 23 Jun 2008 14:30:34 +0100 Message-ID: <6745.1214227834@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 23 Jun 2008 13:30:35.0011 (UTC) FILETIME=[5110FD30:01C8D535] X-Scanned-By: MailControl A-08-50-03 (www.mailcontrol.com) on 10.71.0.123 X-Virus-Scanned: ClamAV 0.92.1/7538/Mon Jun 23 13:26:48 2008 on bifrost X-Virus-Status: Clean This is a small enhancement for "zsh-mime-setup -l" to take arguments. I thought about expanding completion for suffix aliases in verbose mode to show what handler would be executed, but unfortunately completion for suffix aliases disappaers into _path_files, from which no one has ever returned. Possibly I can persuade _list_files to do something clever (since I wrote that for the purpose of a software trick called "code reusability" that the completion system doesn't generally implement). Index: Doc/Zsh/contrib.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/contrib.yo,v retrieving revision 1.80 diff -u -r1.80 contrib.yo --- Doc/Zsh/contrib.yo 13 Jun 2008 13:57:04 -0000 1.80 +++ Doc/Zsh/contrib.yo 23 Jun 2008 13:24:52 -0000 @@ -1504,7 +1504,7 @@ startitem() findex(zsh-mime-setup) findex(zsh-mime-handler) -xitem(tt(zsh-mime-setup [-flv])) +xitem(tt(zsh-mime-setup) [ tt(-fv) ] [ tt(-l) [ var(suffix ...) ] ]) item(tt(zsh-mime-handler))( These two functions use the files tt(~/.mime.types) and tt(/etc/mime.types), which associate types and extensions, as well as tt(~/.mailcap) and @@ -1525,8 +1525,14 @@ mapping between suffixes and executable files unless the option tt(-f) is given. Note, however, that this does not override existing suffix aliases assigned to handlers other than tt(zsh-mime-handler). + Calling tt(zsh-mime-setup) with the option tt(-l) lists the existing -mappings without altering them. Calling tt(zsh-mime-setup) with the option +mappings without altering them. Suffixes to list (which may contain +pattern characters that should be quoted from immediate interpretation +on the command line) may be given as additional arguments, otherwise +all suffixes are listed. + +Calling tt(zsh-mime-setup) with the option tt(-v) causes verbose output to be shown during the setup operation. The system respects the tt(mailcap) flags tt(needsterminal) and Index: Functions/MIME/zsh-mime-setup =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/MIME/zsh-mime-setup,v retrieving revision 1.5 diff -u -r1.5 zsh-mime-setup --- Functions/MIME/zsh-mime-setup 19 Feb 2006 21:20:43 -0000 1.5 +++ Functions/MIME/zsh-mime-setup 23 Jun 2008 13:24:52 -0000 @@ -37,7 +37,13 @@ # so we don't need to search styles for suffixes that aren't # handled. Yet. local list_word - for suffix in ${(ko)zsh_mime_handlers}; do + local -a handlers + if (( $# )); then + handlers=(${(k)zsh_mime_handlers[(I)${(j.|.)*}]}) + else + handlers=(${(k)zsh_mime_handlers}) + fi + for suffix in ${(o)handlers}; do zstyle -s ":mime:.$suffix:" handler list_word || list_word=${zsh_mime_handlers[$suffix]} print ${(r.10.)suffix}$list_word -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070