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

Re: Getting original words after _arguments



On Apr 19,  3:21am, Felipe Contreras wrote:
}
} 	orig_words=( ${words[@]} )
} 	_arguments -C '--stuff' && _ret=0
} 	words=( ${orig_words[@]} )
} 
} I need to have access to the original array of words, before the
} _arguments stuff is run, and so far the only I can achieve that is by
} manually storing the old ones, and then restoring them.

Hmm. The variable named "words" is special to the completion system, and
if _arguments modifies it that probably means that later stuff is going
to depend on the state in which $words was left.  You may confuse things
by stuffing $orig_words back into words.

Is there some reason you can't just work on orig_words in the rest of
your function?
 
} Is there an easier way? Surely the contents of the command line must
} be stored somewhere.

If you literally want the contents of the command line, a completion
widget is still a widget, so you can examine $BUFFER et al.  I'm not
sure this is "easier" than copying the original state ...



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