Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Tilde expansion and completion again



On Thu, 4 Nov 2004, DervishD wrote:

>     This is short: why aren't PWD and OLDPWD stored in $nameddirs
> until a 'cd' command is issued?

Peter told you the workaround, but he didn't answer "why".

The effect of autonamedirs is that the parameter becomes a named directory 
when a string beginning with a slash is assigned to it.

In the cases of PWD, OLDPWD, and nearly all other variables "known to the 
shell" their values have already been assigned long before autonamedirs 
can become set in your rc files.  Therefore they don't become nameddirs 
until the _next_ time they are assigned (which for PWD and OLDPWD is upon 
the next "cd"), or when nameddirs are forcibly rebuilt with "hash -d".

> Why aren't the rest of parameters whose value starts with a slash stored 
> directly in $nameddirs withouth the need to call 'hash -d'?

Because it's not the job of the "setopt" command to track down and tickle 
all possible side effects of the options that you've told it to change.
And if you think about it, you wouldn't want it to even if it could.



Messages sorted by: Reverse Date, Date, Thread, Author