From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8519 invoked by alias); 29 Sep 2016 07:57:39 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21990 Received: (qmail 22812 invoked from network); 29 Sep 2016 07:57:39 -0000 X-Qmail-Scanner-Diagnostics: from mail-qk0-f172.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.220.172):SA:0(0.0/5.0):. Processed in 0.148772 secs); 29 Sep 2016 07:57:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.220.172 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=TLv+cIeHzgNlfnRMKiHs5O12jJ+cVNkanZChxGcy1ng=; b=quJ/3TAeVZvL3F8NkUVxMh9C9vIeBEnlQl2ktsfMlPTA6B53WdlXVBFI5pgXu3feGU u8Itu0TbLlqCiHgbTOA83Gw78cP+WvnszCrl9zJLf4DerYO1xuNg8izW/+P6cpSIZtGD usCYjcok/oAHeiNYkqreOE26dqXVkL5cZdPPlGZUMGCgW520ZBHk2hZJgrB7Bar8spBm WD69RKAaSFTwd2zjVSq4/dxxWFWZEHxS5LRJxnBQo8ykYRMu8jCi4cAexT0cuNWUOoeJ 2Y982rt+3MhxvmWotr9YCVqVpd75Bo0UMQlW/MyDxDcWhbpYnJHsURVOcT4/nWAg6y+J 4qHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=TLv+cIeHzgNlfnRMKiHs5O12jJ+cVNkanZChxGcy1ng=; b=HOA8LWnF/YPNqUq0GWT0qLbp9qP1G0h/55ZKvLr8g2ltvkIduMEY//fKlv6o2TmkFR mnHe98dSDtgFC8xRCB48JwQT59A+12J0q9qt19wlHd557j52MVO4mp+cx/rYq9ao8unw hUWmY/r1I1r858dc+PE/zN7wnktpg79T7chwZ2/7T41LxAThDK7vFeEGbC8uKjB6edUS n8wpmmFNuGlDispR1q0Oo1/2JUSrewxCoYsAbqbwd0qnrHLyjPawQQYtaTVi+q+qDSeC Bc3N7HNEaeoHZFnFzguguKgqai9PamCDiqzouqlqfUtRgHRAXXSoHgtzUr71JkWDfvjv ynPA== X-Gm-Message-State: AA6/9Rnzf4/7Lmu0qQxC8QDNjON0er2crioVah59r7vtlEgIYL0KiqMQq9IipLFo38iEB11muX/TeB8IEAAEXw== X-Received: by 10.55.129.71 with SMTP id c68mr79692qkd.189.1475135459578; Thu, 29 Sep 2016 00:50:59 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <160929001257.ZM27763@torch.brasslantern.com> From: Mikael Magnusson Date: Thu, 29 Sep 2016 09:50:59 +0200 Message-ID: Subject: Re: ZLE_LINE_ABORTED: how to restore the last non-blank aborted line? To: Hong Xu Cc: Bart Schaefer , Zsh Users Content-Type: text/plain; charset=UTF-8 On Thu, Sep 29, 2016 at 9:32 AM, Hong Xu 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