zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Zefram <zefram@tao.co.uk>, zsh-workers@math.gatech.edu
Subject: Re: PATCH: pass name ($0) and zmult ($1) to user-defined widgets
Date: Fri, 12 Jun 1998 08:54:58 -0700	[thread overview]
Message-ID: <980612085458.ZM21980@candle.brasslantern.com> (raw)
In-Reply-To: <199806120937.KAA10006@taos.demon.co.uk>

On Jun 12, 10:37am, Zefram wrote:
} Subject: Re: PATCH: pass name ($0) and zmult ($1) to user-defined widgets
}
} Bart Schaefer wrote:
} >User-defined widgets should be able to change their behavior or repeat
} >their action when given a digit-argument.
} 
} Yes.  But that should not be done via positional parameters.  I have
} deliberately avoided passing arguments in positional parameters, so
} that one widget can reliably call another without having to fiddle with
} the parameters.

It seems useful to me to follow the Emacs model where the digit-argument
is an optional parameter to the function.

Further, I think the "have one widget call another" model in zsh is a bit
bent as it is.  Your plan is to have all widgets, built-in or otherwise,
be on equal footing; I think that should mean that they're all callable
as shell functions, and we should do away with "zle widget-name".  It's
much easer to "fiddle with the parameters" than it is to save and restore
a bunch of shared variables.

"zle widget-name" could be replaced by "execute-named-command widget-name"
if every widget acted like a shell function.

As another example, right now it's completely impossible for a user-defined
widget to initiate a history search; "zle history-search-backward" just
causes the shell to prompt the user for input, but the widget may already
have a string it wants to search for.  "history-search-backward string" is
the natural way to perform that action.

Where the shared variables are useful is for persistent state; the history
list and current position in it, the editor buffer itself and the position
of the cursor and mark(s), etc.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


      reply	other threads:[~1998-06-12 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-12  8:38 Bart Schaefer
1998-06-12  9:37 ` Zefram
1998-06-12 15:54   ` Bart Schaefer [this message]

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=980612085458.ZM21980@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zefram@tao.co.uk \
    --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).