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)



On Tue, Apr 27, 2021 at 12:40 AM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> I would think that occurs with "zle .push-line-or-edit" also?
>
> Anyway, no, there's no way to abort the current ZLE without $?
> becoming nonzero.  A lot of effort was put into preserving the value
> of $? across everything that comes in between the previous command
> ending (even if it ended by interrupting ZLE) and the next prompt
> being printed.
>
> I believe you'll see similar things with e.g. edit-command-line from
> the distribution, if it happens to take the branch that calls
> send-break.

In my patch, the last thing done before the widget exits is to set
$BUFFER and call zle .accept-line. The only return value the user will
see in that case is that of the executed command; not that of
.push-line-or-edit. I still prefer that version. Are there drawbacks
to that approach?




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