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

puzzling compset -P behaviour



$PREFIX and $IPREFIX seem to get "reset" with nested calls to
compset -P.  For example:

  % _foo () {
  echo "\nfoo  IPREFIX[$IPREFIX] PREFIX[$PREFIX]"
  compset -P '*1'
  echo "foo  IPREFIX[$IPREFIX] PREFIX[$PREFIX]"
  }
  % _foo2 () {
  _foo
  echo "foo2 IPREFIX[$IPREFIX] PREFIX[$PREFIX]"
  compset -P '*2'
  echo "foo2 IPREFIX[$IPREFIX] PREFIX[$PREFIX]"
  }
  % compdef _foo2 foo
  % foo ab1cd2e<TAB>
  foo  IPREFIX[] PREFIX[ab1cd2e]
  foo  IPREFIX[ab1] PREFIX[cd2e]
  foo2 IPREFIX[] PREFIX[ab1cd2e]
  foo2 IPREFIX[ab1cd2] PREFIX[e]

whereas I would have expected:

  foo  IPREFIX[] PREFIX[ab1cd2e]
  foo  IPREFIX[ab1] PREFIX[cd2e]
  foo2 IPREFIX[ab1] PREFIX[cd2e]
  foo2 IPREFIX[ab1cd2] PREFIX[e]

and the latter would make my life considerably easier with a set of
functions I'm writing for completing the 'larch' command.

[ Incidentally, if you haven't seen it, arch is a beautifully designed
version control system which not only learns from all the mistakes CVS
and other VC systems made, but adds plenty of very desirable features
no other system has, including extremely powerful automated tools for
merging between branches.  Homepage at: http://www.regexps.com/#arch ]

-- 
Adam Spiers -=- musician & hacker -- adam@xxxxxxxxxx -=- http://tigerpig.org/
$_=q{*{$Just =bless{},'$another ';"\$Perl \::$Hacker"}=sub{print$%[$.++];$,,$
;$_[0]},eval join+v45.62,('$z')x6};s/(?<=\$)([a-z\n]+ ?)/push@%,$+;f/egi;eval



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