From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: unshift
Date: Mon, 1 Apr 2024 09:11:25 -0700 [thread overview]
Message-ID: <c7d35a3b-04ca-4466-a69a-5a4d55517773@eastlink.ca> (raw)
In-Reply-To: <CAN=4vMrdheVwmTYYUaoZF2mwRO_BLeV+yJU+iUzOUDnfc0cJiQ@mail.gmail.com>
On 2024-04-01 07:38, Roman Perepelitsa wrote:
> On Mon, Apr 1, 2024 at 3:52 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>> Can we unshift the positional params?
> That's an interesting challenge. A start:
Very interesting! Could it be official? Maybe not worth it's weight
but ...
=================================
>
> alias shift='emulate zsh -o typeset_silent -c "local -a _shift_a _shift_n"
> _shift_a+=("$@")
> _shift_n+=(-$#)
> shift'
>
> alias unshift='set -- "${(@)_shift_a[_shift_n[-1],-1]}"
> _shift_a[_shift_n[-1],-1]=()
> _shift_n[-1]=()'
>
> unshift undoes the last call to `shift [ -p ] [ n ]`. I think (not
> entirely sure) that it works with all options. Unfortunately, it does
> not work for `shift [ -p ] [ n ] name ...`.
>
> Roman.
>
next prev parent reply other threads:[~2024-04-01 16:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 13:52 unshift Ray Andrews
2024-04-01 13:54 ` unshift Mark J. Reed
2024-04-01 14:00 ` unshift Mark J. Reed
2024-04-01 14:23 ` unshift Ray Andrews
2024-04-01 16:03 ` unshift Stephane Chazelas
2024-04-01 14:38 ` unshift Roman Perepelitsa
2024-04-01 16:11 ` Ray Andrews [this message]
2024-04-01 16:20 ` unshift Roman Perepelitsa
2024-04-01 16:40 ` unshift Ray Andrews
2024-04-01 19:41 ` unshift Bart Schaefer
2024-04-01 22:52 ` unshift Ray Andrews
2024-04-01 16:03 ` unshift Bart Schaefer
2024-04-01 16:30 ` unshift Ray Andrews
2024-04-02 12:41 ` unshift Dennis Eriksen
2024-04-02 14:01 ` unshift Ray Andrews
2024-04-02 19:59 ` unshift Roman Perepelitsa
2024-04-02 20:24 ` unshift Ray Andrews
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7d35a3b-04ca-4466-a69a-5a4d55517773@eastlink.ca \
--to=rayandrews@eastlink.ca \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).