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

Re: PATCH: _diff



>>> "Sven" == Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

 Sven> Oliver Kiddle wrote:

 >> I object to using
 >> non-local variables like _diff_is_gnu and calling 'diff' instead of
 >> pulling out the first word on the command-line.

 Sven> Well, if we use something like _diff_is_gnu[$words[1]], using a
 Sven> non-local variable should be fine, right?

I don't think so, because _diff_options may be called from places where
$words[1] is not the command name, e.g. called from _prcs (maybe _cvs_diff
could call it too).

Hum, looking closer to _prcs, I see there is a problem, if I do

% prcs diff -P zsh -- -u <TAB>

the values of $words when entering the _diff_options functions are

diff -P zsh -- -u 

(this begin with diff since $words was shifted in _prcs)
and the -P option is removed from the diff options list, which is wrong.
I'd like this array te be restricted to

-- -u

unfortunately, I don't see how to do that with _arguments.
The _arguments line calling _diff_options reads

'--[introduce diff options]:*:diff options: _diff_options'

I can't use the `*::message:action' syntax here.  So I guess
I have to write an intermediate function that shift the $words 
array $CURRENT times before calling _diff_options.  Or I am missing
some syntaxic sugar in _arguments?

[...]

-- 
Alexandre Duret-Lutz



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