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

Re: 'pushd +2' rotates rather than extracts

On Wed, Jun 16, 2004 at 10:13:13PM -0700, Bart Schaefer wrote:
> According to the documentation (man zshbuiltins):
>      The third form of pushd changes directory by rotating the
>      directory list.
> And then in Functions/Example/pushd, which unfortunately is not referenced 
> in the User Contributions section of the manual, one finds:
> # pushd function to emulate the old zsh behaviour.  With this function
> # pushd +/-n just lifts the selected element to the top of the stack
> # instead of just cycling the stack.

Hmm.  So it is intentional.  I can see how the zsh behavior could be
useful.  I guess I need try it out for a while, now that I realize
what it's doing, and see how I like it.  I have found that when zsh
does something different, it is usually (aways?) an improvement :-).

Although, since it is a deviation from the traditional way of handling
the directory stack, it might be a good idea to make it YAZO (Yet
Another Zsh Option :-)) to be able to switch to the old behavior.  If
anything, it would make it better documented for others who don't know
about it.  The zshoptions manual is often the first place I look when
I find something does not behave the way I expect.  I almost always
end up staying with the "improved" zsh behavior but it is often handy
to have that choice.

Also, just as a suggestion for improving the manual, just saying it
rotates the directory list was not really clear to me that this is
different from other shells.  Perhaps it would be good to add an
example similar to what Dave Yost wrote or to re-word it to clarify
that, unlike other shells, it rotates the entire stack to the top
rather than just the one entry.


Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.

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