From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1927 invoked by alias); 13 Jun 2014 22:03:00 -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: 32777 Received: (qmail 6534 invoked from network); 13 Jun 2014 22:02:47 -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,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140613150256.ZM5818@torch.brasslantern.com> Date: Fri, 13 Jun 2014 15:02:56 -0700 In-reply-to: <8E27557A-CD91-4AE6-81F6-B4D8E1F6F513@yost.com> Comments: In reply to Dave Yost "Re: shell script that replaces the command line" (Jun 13, 2:34pm) References: <5804CF24-1E69-4FD3-832C-4B642B010F86@yost.com> <140612234011.ZM4768@torch.brasslantern.com> <8E27557A-CD91-4AE6-81F6-B4D8E1F6F513@yost.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Dave Yost Subject: Re: shell script that replaces the command line Cc: zsh-workers@zsh.org MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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? Not from outside a widget, no. Only widget functions have access to the current editor state. 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. What part of the flow am I not seeing? 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". example_d() { local foo="echo this is the command to edit" vared -e -h -p "Do your editing: " foo && eval $foo } There are a bunch of options to vared to manipulate the state in which the editor starts/runs.