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

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



On 8/9/23, Tim Eliseo <tre-zsh@xxxxxxxxxxxxxx> wrote:
> 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.

This would all have been good information to include in the original
post, or as a followup to my initial mail which you never replied to,
where I was clearly not aware of these differences:
> in fact i
> was not aware that the list would be rolled with pushd because i have
> always been too lazy to type it instead of cd :).

> 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.

The mistake was including some details only in the comments of the
script and not in the mail, I did overlook some comments in it.

> 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?

Every time I've asked for more details you ignored me, which as I
pointed out earlier is not a good approach. I thought I very clearly
asked you in my first mail why just cd + autopushd was not enough, and
then you wouldn't even reply to my second request to answer my
question which surely put others off as well.

To summarize, when you send a mail with a patch, explain the patch and
why it's needed in the mail; if someone asks for clarifications or
seems to misunderstand you, rather than assume that they can't read,
assume that you were unclear, it is the safer assumption.

-- 
Mikael Magnusson




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