zsh-workers
 help / color / mirror / code / Atom feed
* puzzling compset -P behaviour
@ 2002-03-10 16:34 Adam Spiers
  2002-03-10 16:41 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Spiers @ 2002-03-10 16:34 UTC (permalink / raw)
  To: zsh workers mailing list

$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@spiers.net -=- 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: puzzling compset -P behaviour
  2002-03-10 16:34 puzzling compset -P behaviour Adam Spiers
@ 2002-03-10 16:41 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2002-03-10 16:41 UTC (permalink / raw)
  To: Adam Spiers, zsh-workers

On Mar 10,  4:34pm, Adam Spiers wrote:
}
} $PREFIX and $IPREFIX seem to get "reset" with nested calls to
} compset -P.

Look at the doc for $compstate[restore].

You need to assign compstate[restore]=no (or unset it) inside the functions
that want their PREFIX/SUFFIX changes to remain visible outside.

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-03-10 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-10 16:34 puzzling compset -P behaviour Adam Spiers
2002-03-10 16:41 ` Bart Schaefer

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).