From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17252 invoked from network); 28 Aug 2009 11:47:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) 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.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Aug 2009 11:47:06 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 86460 invoked from network); 28 Aug 2009 11:46:56 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Aug 2009 11:46:56 -0000 Received: (qmail 14987 invoked by alias); 28 Aug 2009 11:46:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27233 Received: (qmail 14958 invoked from network); 28 Aug 2009 11:46:45 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 28 Aug 2009 11:46:45 -0000 Received: from queueout04-winn.ispmail.ntl.com (queueout04-winn.ispmail.ntl.com [81.103.221.58]) by bifrost.dotsrc.org (Postfix) with ESMTP id 1626B80450D5 for ; Fri, 28 Aug 2009 13:46:28 +0200 (CEST) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090827203742.TYVI6742.mtaout01-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Thu, 27 Aug 2009 21:37:42 +0100 Received: from pws-pc ([82.6.98.90]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090827203741.LDYB13254.aamtaout01-winn.ispmail.ntl.com@pws-pc> for ; Thu, 27 Aug 2009 21:37:41 +0100 Date: Thu, 27 Aug 2009 21:37:31 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: 'loop' vs 'loop=device' in _mount Message-ID: <20090827213731.28833f55@pws-pc> In-Reply-To: References: X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=Jqnwxg4g0N8A:10 a=YQfN4TnuAAAA:8 a=NLZqzBF-AAAA:8 a=t4-2jYNMiFxhp5pyPO8A:9 a=w9-4oPnRVdWoEcsr3yQA:7 a=rPEp6RjqovkG67Vt7-Yyj32ABkYA:4 a=bxnOgZBHIjQA:10 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.94.2/9756/Fri Aug 28 12:43:25 2009 on bifrost X-Virus-Status: Clean On Wed, 26 Aug 2009 18:03:32 -0400 (EDT) "Benjamin R. Haskell" wrote: > When using completion for mount options, I often run into the annoyance > that the 'loop' option prompts for the loopback devide to use. Really, > though, one needn't specify any device in particular... Says the man-page > for 'mount': > > ''' > If no explicit loop device is mentioned (but just an option `-o loop' is > given), then mount will try to find some unused loop device and use that. > ''' > > I'll likely just patch my own completion script to change: > > Completion/Unix/Command/_mount, line 325: > - 'loop[use loopback device]:loopback device:_files' > + 'loop[use loopback device]' > > since I couldn't tell how to incorporate an '-o' option that accepts an > optional argument. It should be just a question of doubling the first colon, as follows (see the documentation for _values). However, I couldn't get the suffix (i.e. the "=") added to be removed when I typed ",", i.e. tried to add a new list option instead of an argument... until it finally occurred to me after an astonishing amount of looking in completely the wrong place that I hadn't told it when to remove it (patch to _values---so non-final optional arguments to values were always a bit inconvenient). The following should do more or less what you want; the behaviour is like that after "/" in file names, but the "," will cause the auto-remove behaviour of the "=", too. Index: Completion/Base/Utility/_values =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_values,v retrieving revision 1.11 diff -u -r1.11 _values --- Completion/Base/Utility/_values 13 Jan 2009 12:19:53 -0000 1.11 +++ Completion/Base/Utility/_values 27 Aug 2009 20:34:30 -0000 @@ -59,7 +59,7 @@ _describe "$descr" \ noargs "$sep[@]" -M 'r:|[_-]=* r:|=*' -- \ args -S "${argsep}" -M 'r:|[_-]=* r:|=*' -- \ - opts -qS "${argsep}" -M 'r:|[_-]=* r:|=*' + opts -qS "${argsep}" -r "${argsep}${sep} \\t\\n\\-" -M 'r:|[_-]=* r:|=*' curcontext="$oldcontext" Index: Completion/Unix/Command/_mount =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mount,v retrieving revision 1.29 diff -u -r1.29 _mount --- Completion/Unix/Command/_mount 4 Jun 2009 15:32:22 -0000 1.29 +++ Completion/Unix/Command/_mount 27 Aug 2009 20:34:31 -0000 @@ -322,7 +322,7 @@ '(nosuid)suid[use suid and sgid bits]' '(async)sync[do I/O synchronously]' 'dirsync[perform directory updates synchronously]' - 'loop[use loopback device]:loopback device:_files' + 'loop[use loopback device]::loopback device:_files' 'encryption[enable encryption]:cypher' 'keybits[set number of bits in encryption key]:key size:(64 128 160 192 256)' 'offset[specify data start for loopback mount]:offset (bytes)' -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/