* ZLE_LINE_ABORTED: how to restore the last non-blank aborted line?
@ 2016-09-28 4:11 Hong Xu
2016-09-29 7:12 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Hong Xu @ 2016-09-28 4:11 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1.1: Type: text/plain, Size: 425 bytes --]
Hi all,
While ZLE_LINE_ABORTED is useful for preserving the last aborted line,
but I think the real interest is the last aborted non-blank line --
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? Thanks!
Hong
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ZLE_LINE_ABORTED: how to restore the last non-blank aborted line?
2016-09-28 4:11 ZLE_LINE_ABORTED: how to restore the last non-blank aborted line? Hong Xu
@ 2016-09-29 7:12 ` Bart Schaefer
2016-09-29 7:32 ` Hong Xu
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2016-09-29 7:12 UTC (permalink / raw)
To: Hong Xu, zsh-users
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ZLE_LINE_ABORTED: how to restore the last non-blank aborted line?
2016-09-29 7:12 ` Bart Schaefer
@ 2016-09-29 7:32 ` Hong Xu
2016-09-29 7:50 ` Mikael Magnusson
0 siblings, 1 reply; 4+ messages in thread
From: Hong Xu @ 2016-09-29 7:32 UTC (permalink / raw)
To: Bart Schaefer, zsh-users
[-- Attachment #1.1: Type: text/plain, Size: 941 bytes --]
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".
Hong
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ZLE_LINE_ABORTED: how to restore the last non-blank aborted line?
2016-09-29 7:32 ` Hong Xu
@ 2016-09-29 7:50 ` Mikael Magnusson
0 siblings, 0 replies; 4+ messages in thread
From: Mikael Magnusson @ 2016-09-29 7:50 UTC (permalink / raw)
To: Hong Xu; +Cc: Bart Schaefer, Zsh Users
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-29 7:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-28 4:11 ZLE_LINE_ABORTED: how to restore the last non-blank aborted line? Hong Xu
2016-09-29 7:12 ` Bart Schaefer
2016-09-29 7:32 ` Hong Xu
2016-09-29 7:50 ` Mikael Magnusson
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).