zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Dave Yost <Dave@yost.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: accept-line question
Date: Thu, 2 Apr 2015 22:58:33 +0200	[thread overview]
Message-ID: <CAHYJk3RYjYE6n__RO-Vrw41iRxrHQ-qbo_wcvGOHYQq0wtcVQw@mail.gmail.com> (raw)
In-Reply-To: <E00A4521-8A4E-486C-BB2E-5D8D80639156@yost.com>

On Thu, Apr 2, 2015 at 7:12 PM, Dave Yost <Dave@yost.com> wrote:
> Sorry, that email was flawed. Let me try again.
>
> Below, after sourcing a script, I type ^a then ^b.
> The ^a works as expected, but not the ^b
>
> There must be something more I have to do besides “accept-line”. But what?
>
> 0 Thu 9:59:38 yost DaveBook ~
> 206 Z% cat accept-line-test.zsh
> function xxx {
>   BUFFER="$1"
>   zle -R
>   zle accept-line
> }
>
> function x1 {
>   xxx echo\ 1
> }
>
> function x2 {
>   xxx echo\ 2
>   xxx echo\ 3
> }
>
> zle -N x1
> zle -N x2
>
> bindkey ^a x1
> bindkey ^b x2
> 0 Thu 9:59:47 yost DaveBook ~
> 207 Z% source accept-line-test.zsh
> 0 Thu 9:59:54 yost DaveBook ~
> 208 Z% echo 1
> 1
> 0 Thu 9:59:55 yost DaveBook ~
> 209 Z% echo 3
> 3
> 0 Thu 9:59:59 yost DaveBook ~
> 210 Z%
>
> The output I want from ^b is
>
> 0 Wed 0:30:03 yost DaveBook ~
> 240 Z% echo 2
> 2
> 0 Wed 0:30:04 yost DaveBook ~
> 241 Z% echo 3
> 3
> 0 Wed 0:30:04 yost DaveBook ~
> 242 Z%
>
> Extra credit:
>
> Is there a way to write a function x3 that calls x2, such that I can issue x3 from the command line get the result above instead of the result below?
>
> 0 Thu 10:04:32 yost DaveBook ~
> 216 Z% x2
> xxx:zle:3: widgets can only be called when ZLE is active
> xxx:zle:3: widgets can only be called when ZLE is active
> 1 Thu 10:05:55 yost DaveBook ~
> 217 Z%

AFAICT, Bart's answer still applies to the above, so just read that again.

-- 
Mikael Magnusson


  parent reply	other threads:[~2015-04-02 20:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <FF62FDC6-BDD8-4BF3-AD44-F36E834D3B4F@yost.com>
2015-04-01 15:39 ` Bart Schaefer
     [not found] ` <E00A4521-8A4E-486C-BB2E-5D8D80639156@yost.com>
2015-04-02 20:58   ` Mikael Magnusson [this message]
2015-04-02 21:30     ` Bart Schaefer
2015-04-02 21:50   ` Dave Yost
2015-04-02 22:40     ` Bart Schaefer
2015-04-02 23:19       ` 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=CAHYJk3RYjYE6n__RO-Vrw41iRxrHQ-qbo_wcvGOHYQq0wtcVQw@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=Dave@yost.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).