Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: pass name ($0) and zmult ($1) to user-defined widgets
- X-seq: zsh-workers 4103
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Zefram <zefram@xxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: PATCH: pass name ($0) and zmult ($1) to user-defined widgets
- Date: Fri, 12 Jun 1998 08:54:58 -0700
- In-reply-to: <199806120937.KAA10006@xxxxxxxxxxxxxxxx>
- References: <199806120937.KAA10006@xxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author