zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Cannot use LBUFFER+= nor print -zr from zsh/sched call
Date: Tue, 13 Sep 2016 18:47:02 -0700	[thread overview]
Message-ID: <160913184702.ZM30221@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVC8e4MaA1BN5GY_Lfx746LwXmNZ60kxwP5A0RmXDjEVJA@mail.gmail.com>

On Sep 13,  7:29pm, Sebastian Gniazdowski wrote:
}
} Nice trick with print -S, thanks. I had in mind the
} execute-without-simulating-input and plan to include it as option. Am
} quite afraid to run things without people's eyes.

I find this statement puzzling, because if you do an accept-line from
inside the convey-handler, you're still potentially executing before
anyone sees the commands.  Making them visible during/after they've
executed isn't especially helpful if they're doing something they
shouldn't.

However, you can certainly accomplish displaying what's being done
without having to poke it into the editor buffer.  Minimally, you
can do (again using "sched -o")

    for histent in "$commands[@]"; do
      # sched -o will clean up zle for us, so fake a prompt ...
      print -Prn -- "$PS1"
      # ... show the command we're about to run ...
      print -r -- "$histent"
      # ... put it in the history ...
      print -Sr -- "$histent"
      # ... and then run it
      eval "$histent"
    done

This has to vary a little depending on the format of $commands (the
above presumes it's an array of one command per element) but you get
the idea.


  reply	other threads:[~2016-09-14  1:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-11  9:28 Sebastian Gniazdowski
2016-09-11 10:35 ` Sebastian Gniazdowski
2016-09-12  1:13   ` Bart Schaefer
2016-09-12 15:06     ` Bart Schaefer
2016-09-12 15:24       ` Sebastian Gniazdowski
2016-09-12 17:34         ` Bart Schaefer
2016-09-13 15:44           ` Sebastian Gniazdowski
2016-09-13 16:55             ` Bart Schaefer
2016-09-13 17:29               ` Sebastian Gniazdowski
2016-09-14  1:47                 ` Bart Schaefer [this message]
2016-09-14  5:13                   ` Sebastian Gniazdowski
2016-09-12  0:58 ` Bart Schaefer
2016-09-12  8:49   ` Peter Stephenson

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=160913184702.ZM30221@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).