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

Re: pushd



On Oct 16,  9:42am, Zefram wrote:
} Subject: Re: pushd
}
} >+    {"pushdcycle",	 	0,    0,    OPT_ALL},
} 
} I think this should have OPT_EMULATE too.

Probably right, unless what you're trying to emulate is zsh 2.x. :-)

(Baroque idea:  Have `emulate' take a version number and set the options
to behave like that version of zsh.  No, I'm not serious.)

There are two remaining pushd oddities:

(1) pushd with no args on an empty dirstack acts like pushdtohome, even
    when pushdtohome is not set.

Perhaps the code in my patch:

        if (func == BIN_POPD && !nextnode(firstnode(dirstack))) {
            zwarnnam(nam, "directory stack empty", NULL, 0);
            return NULL;
        }

Should instead read:

        if ((func == BIN_POPD || (func == BIN_PUSHD && unset(PUSHDTOHOME))) &&
            !nextnode(firstnode(dirstack))) {
            zwarnnam(nam, "directory stack empty", NULL, 0);
            return NULL;
        }

(2) pushd to a dirstack element that names a nonexistent directory has
    inconsistent behavior, and can put the current directory into the
    stack multiple times:

zagzig% dirs
/usr/src/local/zsh/zsh-3.0.1-test3 /tmp/remthis /tmp
zagzig% rmdir /tmp/remthis
zagzig% pushd +1
pushd: no such file or directory: /tmp/remthis
zagzig% dirs
/usr/src/local/zsh/zsh-3.0.1-test3 /tmp/remthis /tmp
zagzig% pushd
pushd: no such file or directory: /tmp/remthis
zagzig% dirs
/usr/src/local/zsh/zsh-3.0.1-test3 /usr/src/local/zsh/zsh-3.0.1-test3 /tmp

At the moment I've reached the limit of my comprehension of how all of
this works.  Too many functions seem to be freeing nodes from the stack
-- most notably, bin_cd() frees the top node if cd_get_dest() fails, but
I don't understand why.  I'm beginning to worry that even the patches I
sent yesterday don't work as they should (or rather, that they work only
because both zsfree() and getlinknode() ignore null pointers).


-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



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