zsh-workers
 help / color / mirror / code / Atom feed
* User-defined zle widgets and built-in widget failure
@ 1998-06-09 17:09 Bart Schaefer
  1998-06-09 18:01 ` Zefram
  0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 1998-06-09 17:09 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~1998-06-10 18:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-09 17:09 User-defined zle widgets and built-in widget failure Bart Schaefer
1998-06-09 18:01 ` Zefram
1998-06-09 19:12   ` Bart Schaefer
1998-06-09 20:02     ` Zefram
1998-06-10  6:26       ` Variable namespaces, goals for ZLE, etc Bart Schaefer
1998-06-10 10:55         ` Zefram
1998-06-10 17:37           ` Bart Schaefer
1998-06-10 18:01             ` Zefram
1998-06-10 18:36               ` Bart Schaefer
1998-06-10 10:24       ` Associative arrays, structured namespaces Bruce Stephens
1998-06-10 10:44         ` Zefram
1998-06-10 12:07           ` Bruce Stephens
1998-06-10 12:28             ` Bruce Stephens

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).