Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function)
- X-seq: zsh-workers 48764
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function)
- Date: Sat, 1 May 2021 16:30:40 +0300
- Archived-at: <https://zsh.org/workers/48764>
- In-reply-to: <CAH+w=7bNWr6qO8M0uFXKebJzMp1_87TQY-Z4roJ+w5pPx7sHSQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <95CDA630-4EE5-4003-8D9C-CCCB9A47F109@gmail.com> <CAH+w=7bpkYktd4UN5DtUS45MMNdWYr7c-OG7DHOX21QXG4LMUA@mail.gmail.com> <4D587C0C-EB5F-4A58-A0AE-D45E43F432CD@gmail.com> <CAH+w=7bQLq43JChP7PmaqT_wHMwgs4Nk_-0grrtQXEhQJcfrbA@mail.gmail.com> <CAH+w=7ZCzG-BGZuU-rLoZJX=3zcA74NK+TNVDP-CWF-9b-BfrA@mail.gmail.com> <AEC92FEA-6216-4952-818E-9DC7C584698A@gmail.com> <20210421212717.GE21343@tarpaulin.shahaf.local2> <CAH+w=7bFfZucFRj9OZvzTnvxd+QUW7tZHAJiMLi+O0PNjz=wyA@mail.gmail.com> <214AC3E9-FFA5-4F39-A918-562682FE3A3B@gmail.com> <CAH+w=7ZSWhyogP=rn_O40Lc96jTnM4rAKkHaXLn5iOsS7F76Vg@mail.gmail.com> <CAHLkEDspzutwPTAqC7HqdAJDqF0FncsWH6NsHk5Z=bt+Jww8vg@mail.gmail.com> <CAH+w=7ZhNyZypwtMvgBcCkUwCLRzB1+XtccdYG14A1zVJsSTrg@mail.gmail.com> <CAH+w=7YTPm_5=8cPSydgte_Ti7UaihR4s+fOz0H97_4dZwCeiw@mail.gmail.com> <CAHLkEDu4Ac_gRWCuZs24GW84djZ1t7tyVKroAxXrtvWBqUVWqg@mail.gmail.com> <CAH+w=7ZDorYi2C+0ycysL=99nh_6Mw865H4kB6ZYaHmMZr9tNA@mail.gmail.com> <CAHLkEDtgMYYVdtHBiPDYbhdhwRH9Ha3T1ix+G_q_=-miNgo=PA@mail.gmail.com> <CAH+w=7ZYcM4Su47bPX4Yh2dRG3K69O72Y6HBYdhdfJqLFO-yeg@mail.gmail.com> <CAHLkEDt_-WZ4B8T0yh8g3OFASBa2nBsHsdDMc3xYVXGds7G5ag@mail.gmail.com> <CAH+w=7bNWr6qO8M0uFXKebJzMp1_87TQY-Z4roJ+w5pPx7sHSQ@mail.gmail.com>
OK, I give up. Someone else can finish this.
On Fri, Apr 30, 2021 at 11:25 PM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> I'm trying not to be a wet blanket here, but:
>
> You've accidentally included the doc for zrestart in the .yo patch.
>
> The -e option is never going to do anything useful, because send-break
> will kill the buffer to which the command has just been written. (I
> feel as though I've said this before about a different proposed
> widget. Hm.) If you wrote to the buffer before calling print -z that
> might make some sense, but more so at PS1 than PS2.
>
> Attempting to pass multiple commands, one per positional argument, and
> then eval them all at once with newlines between, strikes me as
> inviting all kinds of quoting problems, plus obscures the return
> status if some command in the middle of the list fails.
>
> It's not safe to use eval that way to assign to $ops[-v], the argument
> passed to -v might not be a simple variable name. E.g. if the user
> forgets the variable name, the first command they intended to execute
> will be stored there instead. Using a single well-known (documented)
> name instead of passing an argument would avoid this, and it's not as
> though you can have two execute-commands simultaneously that would
> introduce a conflict.
>
> Other things that occurred to me not directly related to this patch:
>
> There's nothing preventing the user from passing more "zle" commands
> to execute-commands which could arbitrarily mess up your print -z ...
> heck, execute-commands could even be caused to call itself
> recursively. This is not something you need to try to code around,
> but it could be documented as a misuse.
>
> Instead of throwing an error when there are no commands provided,
> execute-commands could invoke read-from-minibuffer to input a command
> to run, much like the builtin execute-named-cmd does for widget names.
> That could make execute-commands into a widget rather than just
> something callable from widgets.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author