Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [zsh] Re: dirstack history: loving zsh, crashing zsh...
- X-seq: zsh-users 9996
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh User <zsh-users@xxxxxxxxxx>
- Subject: Re: [zsh] Re: dirstack history: loving zsh, crashing zsh...
- Date: Mon, 06 Mar 2006 08:51:36 -0800
- In-reply-to: <20060306130139.GA9256@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20060302175252.GA31734@xxxxxxxxxx> <060305011947.ZM7258@xxxxxxxxxxxxxxxxxxxxxx> <20060306130139.GA9256@xxxxxxxxxx>
On Mar 6, 2:01pm, Francisco Borges wrote:
}
} it won't stop that accumulation of repeated directories at .zdirs
} (essentially since "dirs" always include the CWD).
If that's the only issue, then don't use "dirs" at all; instead use
"print $dirstack" which *won't* include the current directory.
} > dirstack=( ${(u)$(< ~/.zdirs)} )
}
} But the "u" parameter solves it indeed! Thank you very much for pointing
} it.
One other thing that just occurred to me is that a single line of
output is unreliable when a directory name may contains whitespace.
You should use:
print -l $dirstack > ~/.zdirs
and
dirstack=( ${(uf)"$(< ~/.zdirs)"} )
} > } OR you guys are now going to say: "Don't you know you're not supposed
} > } to use typeset with dirstack!!"
} >
} > You aren't
}
} Is there any reason for why?
We're having a discussion about that over on zsh-workers right now. My
position is that $dirstack is just a view on an internal data structure
that cannot be held responsible for the flags set on the parameter, and
therefore for consistency the parameter should not be allowed to have
flags that conflict with that internal structure (it happens to be a
linked list).
} I assumed I could treat dirstack as any other array since, well,
} the *manual* says dirstack is "a normal array".
I think "normal array" just means it's not an "associative array".
The only way to impose consistency with "typeset -U dirstack" on the
underlying internal structure would be to add
chpwd() { dirstack=( ${(u)dirstack} ) }
Messages sorted by:
Reverse Date,
Date,
Thread,
Author