Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: WORDCHARS, etc.



Sven Wischnowsky wrote:
> The more I read about this the more I think that we should just go
> ahead and allow all zle widget functions to get (an arbitrary number
> of) arguments (strings). If no arguments are given, the function uses
> its defaults. We could than probably have a couple of generic
> functions (e.g. for word movement) and define aliases to them with
> fixed arguments (as Peter suggested with flags), probably even for
> some of the functions that are currently real builtin widgets.

Just thinking about this again.  I've moved the discussion to zsh-workers.

- How do we decide whether an argument is going to be a digit argument or a
  string?  (Wayne, how does your patch for `zle widget <num>' work?  It
  seems to assume it should set the digit argument to 1 if <num> didn't
  begin with a digit.  Is that important?  And shouldn't it handle negative
  numbers?) There's no way of telling whether an arbitrary widget wants a
  digit or a string; should be add a flag for the latter?

- Then we presumably need to add two flags, saying whether the command just
  expects typed input, like isearches (which will be treated like bindkey
  -s strings and put into the unget buffer), or whether it actually wants a
  string argument, like the proposed modifications to the movement
  commands.  If you think it's useful to have more than one
  argument, then presumably a counter giving the max number of string
  arguments is more useful than a second flag.  Where would more than one
  argument be useful (apart from specifying a numeric as well as a string
  argument)?

- The extended alias mechanism, if it's a good idea, would presumably allo
  `zle -A old-widget new-widget args-to-pass-to-old-widget'.  Then you can
  create, for example, an ad hoc isearch command with just a zle -A command
  without needing to define a function.  That would mean adding room for
  either a char * or a char ** or a LinkList in the thingy struct, though.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author