From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3873 invoked from network); 25 Sep 2008 14:47:13 -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; 25 Sep 2008 14:47:13 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 42980 invoked from network); 25 Sep 2008 14:47:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Sep 2008 14:47:09 -0000 Received: (qmail 15129 invoked by alias); 25 Sep 2008 14:47:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25745 Received: (qmail 15112 invoked from network); 25 Sep 2008 14:47:04 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 25 Sep 2008 14:47:04 -0000 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id 71E7A80307AB for ; Thu, 25 Sep 2008 16:46:56 +0200 (CEST) Received: by nf-out-0910.google.com with SMTP id g13so192296nfb.11 for ; Thu, 25 Sep 2008 07:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=hKlf15xlzA6JyQJIZs8/VBhycrDJVPEgDbw8WbapoXQ=; b=r7jJSXZJ1y5H+vFBJCgWTX6NRz9KlMWSnhc/AsALgZ2+07YOtLQnOxgqoti2WL0GVp VD35nha0DicuzKQTRcQQ1qOne35NIAqRY1hHeMAnWThuRzEEu+0EfXvv+zzjiuH7u04R ZmuKFkCoHNK9WpYxlvTR23Rdhtxw7Qz0CAe9M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=T4B5MLcvcdEoiDDIz89XoGxZ/U/iFkzS73AVbnKJRZzNx5Wf5mDVlW+lH+cyvlx2Wz tZrIkVyrql0DITUyOueXgOehqKW5NI1ElvjOrggQIZI58FaWtVQBKQfd/lnLCTGLN/vN nYGLqbfQBte5R+zgMKrznyy4hDxtAnBx7uufs= Received: by 10.210.45.14 with SMTP id s14mr2125645ebs.177.1222354015935; Thu, 25 Sep 2008 07:46:55 -0700 (PDT) Received: by 10.210.19.20 with HTTP; Thu, 25 Sep 2008 07:46:55 -0700 (PDT) Message-ID: <237967ef0809250746n1d25d9b4ybc8101505a8f8c00@mail.gmail.com> Date: Thu, 25 Sep 2008 16:46:55 +0200 From: "Mikael Magnusson" To: "Peter Stephenson" Subject: Re: PATCH: dynamic named directories Cc: "Zsh hackers list" In-Reply-To: <15726.1222353125@csr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <15726.1222353125@csr.com> X-Virus-Scanned: ClamAV 0.92.1/8332/Thu Sep 25 14:55:49 2008 on bifrost X-Virus-Status: Clean I'll proof read the docs a bit (ie i'll read them, i can't read without proof reading anyway) *does that*, okay, only one comment. 2008/9/25 Peter Stephenson : > Problem: six feet deep in WiFi and UWB bugs to fix. Solution: do > something else entirely. > > This morning I had a brainwave/brainstorm that turned out to be easy to > implement and test without interfering with the rest of the shell, which > is the sort of feature I like. I'm sure you'll tell me if it's a stupid > idea. > > It's based on the way I use an Emacs function suite called "bufname" > that a colleague and I wrote a few years ago. I have lots of parallel > directory hierarchies with slightly different names at different levels, > so normal static directory naming isn't really flexible enough. > > Now you can use ~[] and gets passed down to a function > zsh_directory_name, which either parses it and picks an appropriate > directory or refuses. (If the function isn't defined this syntax is > treated the way it always was, which typically wasn't all that useful.) > There's also a mechanism for going the other way. See documentation and > examples. > > Much of the patch is actually another simplification to doshfunc() which > was obvious when I worked out what the third argument was for. It > should mean any PM_* flags applicable to functions (such as PM_TAGGED) > are handled more consistently. > > Index: Doc/Zsh/expn.yo > =================================================================== > RCS file: /cvsroot/zsh/zsh/Doc/Zsh/expn.yo,v > retrieving revision 1.91 > diff -u -r1.91 expn.yo > --- Doc/Zsh/expn.yo 16 Jun 2008 16:39:18 -0000 1.91 > +++ Doc/Zsh/expn.yo 25 Sep 2008 12:39:43 -0000 > @@ -1308,8 +1308,73 @@ > option exchanges the effects of `tt(~PLUS())' and `tt(~-)' where they are > followed by a number. > > -cindex(directories, named) > -cindex(named directories) > +subsect(Dynamic named directories) > +cindex(directories, named, dynamic) > +cindex(named directories, dynamicic) > +cindex(dynamic named directories) > + > +The feature described here is only available if the shell function > +tt(zsh_directory_name) exists. > + > +A `tt(~)' followed by a string var(namstr) in unquoted square brackets is > +treated specially as a dynamic directory name. Note that the first > +unquoted closing square bracket always terminates var(namstr). The shell > +function is passed two arguments: the string tt(n) (for name) and > +var(namstr). It should either set the array tt(reply) to a single element > +which is the directory corresponding to the name and return status zero > +(executing an assignment as the last statement is usually sufficient), or > +it should return status non-zero. In the former case the element of reply the what element of reply? i guess the first? -- Mikael Magnusson