zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: _diff
Date: Fri, 11 Feb 2000 11:48:14 +0100 (MET)	[thread overview]
Message-ID: <200002111048.LAA29492@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Alexandre Duret-Lutz's message of 11 Feb 2000 11:14:10 +0100


Alexandre Duret-Lutz wrote:

> X-Seq: 9675
> 
> >>> "Sven" == Sven Wischnowsky <wischnow@informatik.hu-berlin.de> 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).

Err, right, I forgot...

> 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?

Of course, `--:*::...' should work (reporting anything after the
`--'), there was just a little thinko in ca_parse_line().

Bye
 Sven

diff -ru ../z.old/Src/Zle/computil.c Src/Zle/computil.c
--- ../z.old/Src/Zle/computil.c	Fri Feb 11 09:23:09 2000
+++ Src/Zle/computil.c	Fri Feb 11 11:46:04 2000
@@ -1235,12 +1235,12 @@
 	    else {
 		LinkList l = state.oargs[state.curopt->num];
 
+		if (cur < compcurrent)
+		    memcpy(&ca_laststate, &state, sizeof(state));
 		PERMALLOC {
 		    for (; line; line = compwords[cur++])
 			addlinknode(l, ztrdup(line));
 		} LASTALLOC;
-		if (cur < compcurrent)
-		    memcpy(&ca_laststate, &state, sizeof(state));
 		ca_laststate.ddef = NULL;
 		ca_laststate.doff = 0;
 		break;

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-02-11 10:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-11 10:48 Sven Wischnowsky [this message]
2000-02-11 13:06 ` Alexandre Duret-Lutz
  -- strict thread matches above, loose matches on Subject: below --
2000-02-11 13:20 Sven Wischnowsky
2000-02-11 19:27 ` Peter Stephenson
2000-02-10 14:10 Sven Wischnowsky
2000-02-10 14:44 ` Oliver Kiddle
2000-02-11 10:14 ` Alexandre Duret-Lutz
2000-02-10 12:58 Oliver Kiddle
2000-02-10 15:51 ` Bart Schaefer
2000-02-11 15:28 ` Tanaka Akira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200002111048.LAA29492@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).