Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: dynamic named directories
- X-seq: zsh-workers 25745
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: "Peter Stephenson" <pws@xxxxxxx>
- Subject: Re: PATCH: dynamic named directories
- Date: Thu, 25 Sep 2008 16:46:55 +0200
- Cc: "Zsh hackers list" <zsh-workers@xxxxxxxxxx>
- 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=
- In-reply-to: <15726.1222353125@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <15726.1222353125@xxxxxxx>
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 <pws@xxxxxxx>:
> 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 ~[<stuff>] and <stuff> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author