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

Re: [PATCH] Add option like tcsh's dextract



On 2023-08-05 16:48:07, Bart Schaefer wrote:
On Fri, Aug 4, 2023 at 9:47 AM Tim Eliseo <tre-zsh@xxxxxxxxxxxxxx> wrote:
As my sample workaround script illustrates [...]
achieving the original tcsh behavior
without a builtin option is non-trivial.
# The chdir/cd builtin, with one argument in [+|-]n form and with
# the auto_pushd option set, has the desired stack extract behavior,

I believe Mikael's assertion is that the extra nontrivial checks in
your sample workaround are not needed?  Where are you observing (or
where is Mikael failing to observe) a difference?

What Mikael said was “it seems that the same thing can be accomplished with setopt auto_pushd and using cd instead of pushd”. Yes, stack extract (as opposed to roll) behavior will happen using cd with a +/- argument and with auto_pushd set, a fact I exploit in my workaround script, but that does not make cd with auto_pushd set a suitable alternative to pushd if one desires stack extract behavior because:

• cd doesn’t print the directory stack afterwards

• cd behaves differently than pushd with no arguments (go to home instead of swap the top two)

• With auto_pushd set, there is no longer a command to change directory without pushing the current (i.e. replace the top stack directory)

My script works around this and implements a pushd replacement with extraction, and also has to deal with the complexity of other conditions like command options, pushd_silent, and interactive/non-interactive mode. One thing not possible to do correctly is output “pushd” instead of “chdir” in error messages.

I wrote this script as a first attempt to implement the behavior I desired (which was to duplicate tcsh’s dextract option). I now regret even posting it, as it seems to have caused more confusion.

BUT THERE’S A BETTER WAY! The patch in 51958 implements this new option (pushd stack extraction instead of rolling) very cleanly, without introducing any backward compatibility issues, and includes updates to documentation and a test case. I spent significant time trying to get this right, and feel it is a valuable (albeit small) addition to the zsh codebase which will help some other users making the transition from tcsh.

I have to say that, as a new contributor, I’m not feeling particularly welcomed. Do the zsh maintainers have a process for deciding to accept contributions? I tried to be polite and patient, and got criticized for it. I asked for a second look, and then got asked what *I* didn’t understand. What more do I need to do to move this process forward?

Thanks for your consideration.

Tim





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