zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Dave Yost <Dave@Yost.com>
Cc: zsh-workers@zsh.org
Subject: Re: shell script that replaces the command line
Date: Fri, 13 Jun 2014 15:02:56 -0700	[thread overview]
Message-ID: <140613150256.ZM5818@torch.brasslantern.com> (raw)
In-Reply-To: <8E27557A-CD91-4AE6-81F6-B4D8E1F6F513@yost.com>

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.


  reply	other threads:[~2014-06-13 22:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 23:07 Dave Yost
2014-06-13  6:40 ` Bart Schaefer
2014-06-13  7:22   ` Dave Yost
2014-06-13 21:34   ` Dave Yost
2014-06-13 22:02     ` Bart Schaefer [this message]
2014-06-17  4:31       ` Dave Yost
2014-06-14  9:45     ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=140613150256.ZM5818@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=Dave@Yost.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).