zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@tao.co.uk>
To: schaefer@brasslantern.com (Bart Schaefer)
Cc: zsh-workers@math.gatech.edu
Subject: Re: User-defined zle widgets and built-in widget failure
Date: Tue, 9 Jun 1998 19:01:58 +0100 (BST)	[thread overview]
Message-ID: <199806091801.TAA04656@taos.demon.co.uk> (raw)
In-Reply-To: <980609100902.ZM6152@candle.brasslantern.com> from "Bart Schaefer" at Jun 9, 98 10:09:02 am

Bart Schaefer wrote:
>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.

Failure internally is recorded by the feep flag.  If that is set at
the end of the main loop, a beep is emitted and the flag reset.  All we
need to do is make that flag visible to widgets.  Like a lot of other
ZLE things, this is one of the things I had a fairly concrete plan for
when my spare time suddenly disappeared last year.

The mechanism I planned is that each thingy will include a single-bit
flag, which can be tested and modified using the zle builtin.  Then all
you do to test for error is "if zle -F feep; ...", where the value of
"F" has yet to be determined.  Other thingies would have flags attached
similarly.  Or a more general possibility would be thingy array variables
accessible via thingy names, or possibly by more magic parameter names
(though I'd want to do a proper namespace separation, e.g., ${zle.feep}).

That reminds me, more generally I'd like to move the zsh-specific
parameter names to completely separate names that can't conflict
with POSIX parameter names.  If we have ${zsh.module_path} instead of
$module_path, then this can be available regardless of the name used to
invoke zsh.  What do people think?

-zefram


  reply	other threads:[~1998-06-09 18:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-09 17:09 Bart Schaefer
1998-06-09 18:01 ` Zefram [this message]
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=199806091801.TAA04656@taos.demon.co.uk \
    --to=zefram@tao.co.uk \
    --cc=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).