From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-workers@math.gatech.edu
Subject: User-defined zle widgets and built-in widget failure
Date: Tue, 9 Jun 1998 10:09:02 -0700 [thread overview]
Message-ID: <980609100902.ZM6152@candle.brasslantern.com> (raw)
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
next reply other threads:[~1998-06-09 17:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-06-09 17:09 Bart Schaefer [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=980609100902.ZM6152@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).