Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Cannot use LBUFFER+= nor print -zr from zsh/sched call
- X-seq: zsh-users 21893
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Cannot use LBUFFER+= nor print -zr from zsh/sched call
- Date: Tue, 13 Sep 2016 09:55:36 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=Wu4gAYHeZn597zP2dwtv5hJWkjcS2F8ugueNCHgp+ek=; b=t9rirc3vzRx6kU84NpV77T3QqfzH2SH3LbyWvD7Vg3DgIOzJ/6mWQOkqVYm0ZBy4sw 8vklivdcDL9n+NgTTVE6syTsPY3wBDeMcSeC5AZprpbRm380BpCONYAVeuT1HXyyXh5o 989SOK1vz1MM8d72Ls52/yBdYTKeICxSSnEhd7qQmFGk6IVesL01AH5s5pI/A/yhSJeX hmMqB+tk0lGgU0ZDKzM7eF/KNFRUafqTvX99D2Up/iwvl+nE0UOrryjSrHn8h9o7EzvY 5KQx8WfMhN9BtHNmspJAITcuJ+fS3sOCabRcJ2DCLFYK+MjqILKlw4oLGVM9YAJC3TTd lgrw==
- In-reply-to: <CAKc7PVD93+km9wvqGD-4BXbhwjB=Sex=tyDJvGSD0EqzQ7VXSA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCiy_phpQb=DTR-Td5ktDL2cDK=y_tUE3bTXVXVTm2AXA@mail.gmail.com> <CAKc7PVC1UVpC+oax4Wy+SWJamjpa-7xAk4NTuauA1BN1LhfcpQ@mail.gmail.com> <160911181347.ZM21403@torch.brasslantern.com> <160912080654.ZM24107@torch.brasslantern.com> <CAKc7PVD11E3zY64_afG0N3KHd8KRj7sgretaJ=9Ecrn5cfOzFg@mail.gmail.com> <160912103408.ZM25185@torch.brasslantern.com> <CAKc7PVD93+km9wvqGD-4BXbhwjB=Sex=tyDJvGSD0EqzQ7VXSA@mail.gmail.com>
On Sep 13, 5:44pm, Sebastian Gniazdowski wrote:
} Subject: Re: Cannot use LBUFFER+= nor print -zr from zsh/sched call
}
} The zle-via-widget method works:
} [...]
} Except it doesn't accept the buffer.
Ah. That's because triggering a sched event doesn't actually stop the
input read loop, so the accept-line won't be processed until the next
time there is actual input.
I suspect maybe the problem here is that you're going about this in
the wrong way to begin with. Why is it important that the commands
be fed to ZLE and executed as if typed?
If I understand your desired end state correctly, I'd implement it
more like the following:
__convey_from_somwhere() {
# Reschedule ourself ...
sched -o +2 __convey_from_somwhere
# Setup ...
local commands
__get_commands_from_somewhere
# Ok, now we have the commands to run. We want them recorded
# in the history as if they were user input, so first do that.
print -S "$commands"
# Now just run them. This assumes we're running from "sched -o"
# (see above) which will handle saving/restoring ZLE state for
# us in case any of these commands interact with the terminal.
eval "${(j.;.)commands"
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author