From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21462 invoked by alias); 3 Nov 2013 21:53:17 -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: 18089 Received: (qmail 3973 invoked from network); 3 Nov 2013 21:53:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vJhdhGDOIqrA7P5pKNl3HueSjnAcfM3H5HlhMmNu7vU=; b=YUc1t29CIMXoHrC79jBRA2wJ+ddtDRCkgaGt/hZoT6K+QtBnncNrjjVrdAtY1EEFxH hp67QbxBZeabS9XetagDxQV7k3NOtd11/MIYkLwNg/2s92j1csbL5REVs+Jd+4Z+pRP8 RVL1OUFWF05krpHNXP9/D01KFDIzQ91BlZFD+GEL+FhDH2F0wAXc++01I3AYRxNhPUsG QZn4MTsXLkJ6v/YGC+y6AoooPZjBlTyT+p+Dp4JMG8oxZV1CLQjEiCn9ZbRl2FzWzX5O 2rP/hyI3ptudL+b4UViamVI79QI4o+RxnbxrY2wZiDBzVOYWPPqlqDPTGcKG9G478i3M cN/w== MIME-Version: 1.0 X-Received: by 10.152.37.130 with SMTP id y2mr2701872laj.24.1383515587865; Sun, 03 Nov 2013 13:53:07 -0800 (PST) In-Reply-To: <131030083139.ZM8019@torch.brasslantern.com> References: <131030083139.ZM8019@torch.brasslantern.com> Date: Sun, 3 Nov 2013 19:53:07 -0200 Message-ID: Subject: Re: How to restart zle without invoking 'accept-line'? From: Thiago Padilha To: Bart Schaefer Cc: Zsh-Users List Content-Type: multipart/alternative; boundary=089e013d186627efba04ea4cd374 --089e013d186627efba04ea4cd374 Content-Type: text/plain; charset=UTF-8 Bart, thanks for your help I've tried to use the passthrough example from the keymap+widget tip you gave on the other thread: ```zsh autoload keymap+widget keymap+widget bindkey -N newkeymap main recursive-edit-and-accept() { local -a __accepted zle -N newkeymap+accept-line end-recursive-edit zle recursive-edit -K newkeymap || zle send-break if [[ ${__accepted[0]} != end-recursive-edit ]] then zle "${__accepted[@]}"; return else return 0 fi } zle -N recursive-edit-and-accept end-recursive-edit() { __accepted=($WIDGET ${=NUMERIC:+-n $NUMERIC} "$@") zle .accept-line return 0 } zle-line-init() { zle recursive-edit-and-accept } zle -N zle-line-init ``` This works when I press enter(accept-line) but for ctrl+c I still need to press two times to restart zle. If I bind 'recursive-edit-and-accept to a key and activate it outside zle-line-init, everything works as expected. It seems 'zle send-break' doesn't work when called from zle-line-init, maybe some protection added against the following case: ```zsh zle-line-init() { zle send-break } zle -N zle-line-init ``` Do you think its possible to work around this problem? I really would like to activate my widget automatically instead of pressing a key combination everytime. Thanks again On Wed, Oct 30, 2013 at 12:31 PM, Bart Schaefer wrote: > On Oct 30, 9:30am, Thiago Padilha wrote: > } > } This code propagates accept-line to the main zle widget(user presses > } enter), but how can I handle like ctrl+c which would normally cause zle > to > } restart without executing the command? > > For that specific case I believe this will do it: > > setopt localtraps > trap 'zle send-break' INT QUIT > > > There are really only three ways to restart ZLE: accept-line (and all the > variants), send-break, and push-line-or-edit. > --089e013d186627efba04ea4cd374--