From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id DAA24137 for ; Tue, 18 Jul 1995 03:20:48 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA10987 (5.65c/Gatech-10.0-IDA for ); Mon, 17 Jul 1995 13:20:36 -0400 Received: by math (5.x/SMI-SVR4) id AA16835; Mon, 17 Jul 1995 13:16:53 -0400 Resent-Date: Mon, 17 Jul 1995 18:17:51 +0100 (BST) Old-Return-Path: From: Zefram Message-Id: <27816.199507171717@stone.dcs.warwick.ac.uk> Subject: Re: Compctl fixes & a query To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Mon, 17 Jul 1995 18:17:51 +0100 (BST) In-Reply-To: <1813.9507171008@pyro.swan.ac.uk> from "P.Stephenson@swansea.ac.uk" at Jul 17, 95 11:08:18 am X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]5993.60 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-Id: <"ncK-Z2.0.z64.4if2m"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/223 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu >A.Main@dcs.warwick.ac.uk wrote: >> On a separate matter, does anyone ever use the numerical equals >> expansion? > >Yes, but tildes would be more in keeping with other syntax for >directories (~+ and ~- being sort of tied to the directory stack >anyway): also, there's no good reason for associating this behaviour >with the noequals option as is currently the case. If implemented >properly it would even allow trailing characters after a number to be >a separate directory name, since only a / or end of word would be a >separator, unlike the present case with =. That's the basic idea. ~whatever is a directory, but =whatever is a file. Also, there's no problem with ksh kompatibility, as ksh doesn't do this (though it does have ~+ and ~-). > At the moment, it >doesn't look like ~ works at all, i.e. even with `hash -d 1 dir', >so there aren't compatibility problems there (in fact there's a bug, >since the directory will appear as ~1 in the stack). Yes. The routine that looks up a name for a directory uses whatever's in the table, regardless of what characters are in the name (including /, *, etc.). The filename substitution routine will ignore a name that starts with any non-alphabetic character or contains anything other than alphanumerics, - or _. It also treats ~/whatever specially, not looking it up in the table. Similarly ~+ and ~-, which don't go into the table (otherwise your cwd would always appear as ~+ in the prompt, except when you're in / or ~). I'd like to fix the above consistency problems. This requires a couple of changes in behaviour: o hash mustn't accept names that include /, or begin with + or - (note that no such name would be a legal parameter name). This, in respect of /, would apply to command hashing too, but the PATH_DIRS option makes it make sense in that case. o As an alternative to the above, the routine that looks up a name for a given directory must ignore names starting with + and -, or containing a /. I'm not sure which of these two controls should be used. o The name lookup routine that looks up the meaning of a ~ expression must not treat ~/ specially, but must look it up in the normal way. It may only treat names starting with + and - specially. I think that, in the interests of consistency and name space preservation, it would be a good idea to use ~+n rather than ~n, as this reduces the number of characters that are treated specially. ~+n and ~-n can then be interpreted however pushd interprets +n and -n, depending on whether PUSHD_MINUS is set or not. What do people think of this? >We could possibly kludge = followed by a slash or space where > is not a command for the time being, but maybe going straight to >tildes is the right thing. It's *much* easier to change it straight to ~. >Now I've got my working directory called ~1, which I can't alter... hash -dr; rehash -d; hash -d 1 /; # there's always more than one way in Zsh. -zefram