zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Hong Xu <hong@topbug.net>
Cc: Bart Schaefer <schaefer@brasslantern.com>, Zsh Users <zsh-users@zsh.org>
Subject: Re: ZLE_LINE_ABORTED: how to restore the last non-blank aborted line?
Date: Thu, 29 Sep 2016 09:50:59 +0200	[thread overview]
Message-ID: <CAHYJk3QpDBcn6kTyYWd58A1sO1JyHSeFHMV4J5zj7vW1TXeVyg@mail.gmail.com> (raw)
In-Reply-To: <e5f293ed-a4a8-a2e2-0d25-1156144534bd@topbug.net>

On Thu, Sep 29, 2016 at 9:32 AM, Hong Xu <hong@topbug.net> wrote:
> On 09/29/2016 12:12 AM, Bart Schaefer wrote:
>> On Sep 27,  9:11pm, Hong Xu wrote:
>> }
>> } ZLE_LINE_ABORTED would turn empty if ^C is pressed on an empty line
>> } disregarding what it was. This is annoying since sometimes auto
>> } completion stuck and more than one ^C is used to cancel that.
>> }
>> } Is there any way to preserve it in this case in zsh?
>>
>> Can you give a more specific example?  Normally any buffer preceding
>> the line on which the abort occurred is already in the history and can
>> be recalled with up-line-or-history et al.; ZLE_LINE_ABORTED is only
>> needed to capture lines that haven't yet been added to history.
>>
>
> Sure. For example,
>
>     emacs path/to/some/file
>
> Now assume that the tab completion stucks at this point and the user
> accidentally presses two ^C to cancel that. Now, ZLE_LINE_ABORTED is
> empty but the user would prefer to restore the line "emacs
> path/to/some/file".

You can have your zle-line-init hook record the value of
$ZLE_LINE_ABORTED in $HONG_XU_LINE_ABORTED and only do so if
$ZLE_LINE_ABORTED is non-empty.

-- 
Mikael Magnusson


      reply	other threads:[~2016-09-29  7:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28  4:11 Hong Xu
2016-09-29  7:12 ` Bart Schaefer
2016-09-29  7:32   ` Hong Xu
2016-09-29  7:50     ` Mikael Magnusson [this message]

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=CAHYJk3QpDBcn6kTyYWd58A1sO1JyHSeFHMV4J5zj7vW1TXeVyg@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=hong@topbug.net \
    --cc=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).