From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1177 invoked from network); 9 Jun 1998 17:14:33 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 Jun 1998 17:14:33 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id NAA12924; Tue, 9 Jun 1998 13:08:02 -0400 (EDT) Resent-Date: Tue, 9 Jun 1998 13:08:02 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980609100902.ZM6152@candle.brasslantern.com> Date: Tue, 9 Jun 1998 10:09:02 -0700 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@math.gatech.edu Subject: User-defined zle widgets and built-in widget failure MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"mlANw2.0.p93.olMVr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4064 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I'd like to write a widget that modifies BUFFER, calls a built-in widget, and then if that built-in widget fails, restores the previous BUFFER and CURSOR. Unfortunately, failure of "zle whatever" isn't detectable; "zle" always sets $? to zero. What I'd prefer is something like, whenever a feep() is emitted, then "zle" has a nonzero value, so you can write stuff like savebuffer=$BUFFER BUFFER=$searchstring CURSOR=$#searchstring zle history-beginning-search-backward || BUFFER=$savebuffer While I'm on the topic, it seems to me that the current/first/last history numbers would be useful bits of information for zle widgets. Then you could do things like histno=$HISTORYNUMBER zle history-beginning-search-backward [[ $histno != $HISTNUMBER ]] || BUFFER=$savebuffer -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com