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

Re: pushdcycle and pushdignoredups



On Nov 2,  1:56am, Zoltan Hidvegi wrote:
} Subject: Re: pushdcycle and pushdignoredups
}
} Bart wrote:
} > As far as I can tell, the patch already works exactly as it should
} 
} Well, examining it again I confess that there seems to be no problem with
} that patch.  But is it really necessary?  Isn't Functions/pushd enough for
} those who prefer the old behaviour?

I don't have a strong opinion on that; others can speak up (Peter?).  I
note for your consideration that a function solution can't be put under
the control of the "emulate" command for purposes of other functions that
want to use "pushd" in a specific way.

(Aside:  Isn't there a bug in Functions/pushd ?  It says:

	setopt localoptions
	emulate -R zsh

but "emulate -R zsh" will unsetopt localoptions again.)

} Generally I do not like to add a
} feature which can be achieved using existing shell tools.  Since this
} particular case adds so little extra code I am convicable that this feature
} may be worth those extra few bytes but where is the border?

One place (though not the only one) where I'd draw a line is at adding a
new builtin.  When the existing-tools solution requires that a builtin be
redefined, as in this case, I'm a bit more inclined to add the feature so
that scripts and functions can use it without having to become dependent
on other scripts or functions.

(Aside #2:  Does anybody wish there were an equivalent of "localoptions"
that applied to functions and aliases, so that autoloads could blow away
all the possible screwy redefinitions of builtins from their environment,
yet have them magically restored when the function exits?)

Except for the magic ~1 ~2 etc. syntax, the entire functionality of the
directory stack and pushd/popd/dirs can be achieved with "echo", "cd" and
array assignment.  Down that road lies the "rc" shell, but we long ago
turned away from that.

} Also the number of options in zsh is already large enough to frighten an
} average user.

Which is why we changed `setopt` output to hide most of them most of the
time, right?

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



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