From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27771 invoked by alias); 17 Jun 2014 04:31:48 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32782 Received: (qmail 3436 invoked from network); 17 Jun 2014 04:31:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=+Lce02S3SUdS9vvjilQn+5i2w9CR7mRZX8hnXtF5eDw=; b=s7Jg+spFY9eV1U4ZnxE7Ory/DwLWN8HyrOFYkXYLkzA12DDa5/KtPVYyxIA148DcX3 iWtHVdz7M4V9Bvey5IbfvfB47xmzjdjszR6wKS3Xl9gz54VCFbeWQuhIZDdRwWx1snrT P1//AWKOXQnF34Sdz4bVkmuGBmveyP8T1QhgOBxZZ8X5ZxIh5J7mhpjL3fMtKsQO3whp 4q3fR74jvnXQxRUYsXTCjEKAT+HC7viisYK+nVwtyDDufDSkgz0ke9bPoJ8/gtqE+n61 k+HOv6FlKMxhiISdQy+94tms5o6Mr47zyHLOCLDnxVjKocfvd7L0C30Gt8Bk4TpTijDa /a6w== X-Received: by 10.68.231.196 with SMTP id ti4mr29898274pbc.48.1402979498986; Mon, 16 Jun 2014 21:31:38 -0700 (PDT) Sender: Dave Yost Content-Type: multipart/alternative; boundary="Apple-Mail=_EFE5A638-1473-4435-96C3-28B29A6AC188" Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: shell script that replaces the command line From: Dave Yost In-Reply-To: <140613150256.ZM5818@torch.brasslantern.com> Date: Mon, 16 Jun 2014 21:31:35 -0700 Cc: zsh-workers@zsh.org Message-Id: References: <5804CF24-1E69-4FD3-832C-4B642B010F86@yost.com> <140612234011.ZM4768@torch.brasslantern.com> <8E27557A-CD91-4AE6-81F6-B4D8E1F6F513@yost.com> <140613150256.ZM5818@torch.brasslantern.com> To: Bart Schaefer X-Mailer: Apple Mail (2.1878.6) --Apple-Mail=_EFE5A638-1473-4435-96C3-28B29A6AC188 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Thanks. vared will do. http://yost.com/computers/d Dave On Fri 2014-06-13, at 03:02 PM, Bart Schaefer = wrote: > On Jun 13, 2:34pm, Dave Yost wrote: > } > } but there must be a way to replace the current command line rather > } than setting the contents of the next one, yes? >=20 > Not from outside a widget, no. Only widget functions have access to > the current editor state. >=20 > But I'm not clear on why you need to do so? In your original example, > the "d" function would just "print -z previously-backgrounded-command" > and then exit, at which point a new prompt would appear and pop the > buffer stack so you'd have "previously-backgrounded-command" sitting > there ready to edit. >=20 > What part of the flow am I not seeing? >=20 > If what you want is for "d" to present a line for editing, wait for = the > editor, and then continue execution after the editor returns, then = what > you want is to call the "vared" command from "d". >=20 > example_d() { > local foo=3D"echo this is the command to edit" > vared -e -h -p "Do your editing: " foo && eval $foo > } >=20 > There are a bunch of options to vared to manipulate the state in which > the editor starts/runs. --Apple-Mail=_EFE5A638-1473-4435-96C3-28B29A6AC188--