From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 712 invoked from network); 12 Jun 1998 16:02:30 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 12 Jun 1998 16:02:30 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id LAA00115; Fri, 12 Jun 1998 11:54:14 -0400 (EDT) Resent-Date: Fri, 12 Jun 1998 11:54:14 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980612085458.ZM21980@candle.brasslantern.com> Date: Fri, 12 Jun 1998 08:54:58 -0700 In-Reply-To: <199806120937.KAA10006@taos.demon.co.uk> Comments: In reply to Zefram "Re: PATCH: pass name ($0) and zmult ($1) to user-defined widgets" (Jun 12, 10:37am) References: <199806120937.KAA10006@taos.demon.co.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: Zefram , zsh-workers@math.gatech.edu Subject: Re: PATCH: pass name ($0) and zmult ($1) to user-defined widgets MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"F4WD1.0.k1.byKWr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4103 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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